Super Simple RGB WiFi Lamp

by thebigpotatoe in Circuits > Art

75745 Views, 760 Favorites, 0 Comments

Super Simple RGB WiFi Lamp

Super Simple RGB WiFi Lamp
IMG_20190923_000231.jpg
IMG_20190923_000412.jpg
IMG_20190922_235636.jpg
IMG_20190914_140318.jpg
IMG_20190922_235540.jpg
IMG_20190923_000919.jpg
IMG_20190923_000739.jpg

Intro:

This project started when my girlfriend was complaining about the large empty feature wall of our new apartment. Since we both decided to hang something up there, I knew I wanted to put something of my own design up there. I started researching for inspiration across the and ended up reading a lot of Instructables which are pretty amazing, with some unique and beautiful designs. But what I kept finding is that most require either expensive tools such as 3D printers and CNC routers, or items that are highly specific to their design like old lamp shades or car bumpers for example.

I have many of these great tools available to me since I am a development engineer in heavy industry. But I wanted to challenge myself and build the most Super Simple WiFi RGB LED Lamp that anyone can build. I wanted to create a design that anyone can not only replicate, but modify with ease with minimal tools and resources available to them. To do this there were a few criteria I wanted to meet;

- Use the minimal amount of tools to build, hopefully using only common household tools

- The materials must be sourced from a location that generally anyone can has access to, such as a generic big brand hardware stores and global online retailers

- Not require anyone to access, touch, or wire high voltage circuits

- Not know any code or have ever coded before, but are willing to get started

- Have the end result be as simple and intuitive to use as possible

- Use no cloud or external services like apps for website hosting and functionality

After a bit of head scratching and browsing a couple of websites for materials, I hand drew some simple sketches of what I manage to come up with. The result was a single piece of dressed timber with some LED's taped around it using by an ESP8266 as the light driver that I would then hang on a wall. For control I wanted to create a browser based website that would be available via a home network or directly through the ESP itself.

On paper, this design was perfect, as it had 3 parts to be purchased from the hardware store, a couple more from the electronics store, and a few from online. And coupling this with a hopefully clear Instructable, that makers are able to follow along and create their own!

Supplies

The materials required for this build will be detailed later in this Instructable. But to start the tools required will be;

  • Drill - Used for drill some holes in the timber and aluminium. This is the only more exotic tool I couldn't avoid using. If you don't have one I'm sure you can borrow one from family, friends, or even a local school or club. It can just be a regular hand drill and does not have to be powerful at all.
  • Drill bits - For drilling through the timber and aluminium. If you don't have any, they are not expensive to purchase a really cheap set from your local hardware store. If you use the exact same ones as myself, you will need a 2.5mm, 5mm, and 7 mm bits.
  • Ruler (or measuring tape) - Used for measuring everything up of course.
  • Scissors - These will be used for cutting and stripping the wires. A pair of wire strippers would be handy also.
  • Screw Drivers - This will depend on the screws you buy or have lying around. You may need Allen keys if you choose to take that path.
  • Tape - Of the sticky variety.
  • Computer - Can be a laptop or desktop of any flavour. You will need to install the Arduino environment and some USB drivers on it, so admin rights are needed.
  • Micro USB cable - To connect your computer to your ESP8266.

Cementing the Design

Rainbow Macro Blurred Render.png
IMG_20190921_182033.jpg
Drawing.PNG
Front of Design.PNG
Rainbow Render.png

After hand scribbling, it was time to design in a real CAD package; Fusion 360. This was the first time using Fusion as I usually use other traditional CAD packages, but wanted to branch my knowledge into a new one. At first it is a little unintuitive for someone with other CAD experience, but after using it for a couple of hours it is apparent how easy it is to knock up designs and take some pretty renders of them.

I wont detail the exact methods and measurements of everything I did in Fusion 360, as it would be pointless. I have however attached the final file if you would like to download and edit it yourself. The design also comes with a handy drawing detailing everything for you and what you can change, so be sure to have a read of that before modifying.

The basic design consists of only a couple of components in fusion 360 to get the lamps profile. These are;

  1. The timber at 1100 x 140 x 19mm (Based on what my hardware store has. More on this later).
  2. The aluminium strips at 20 x 20 x 1.5mm jointed on the rear of the timber. The upper one has mounting holes and the lower has the power entry. Both will have the LED's stuck to them.
  3. The ESP8266. I had a model i downloaded from somewhere in STL format from a previous project. Adding it gives a great scope of size. This is mounted on four 12mm standoffs.
  4. The faux terminal block positioned in the middle of the wood on the back
  5. A couple of simulated bolts. These are Allen cap bolts as that's all i could get from the add in.
  6. Lastly the WS2821b LED's i would be using. These i jointed to the aluminium and coloured with a rainbow all around for the render.

After I had drawn the design, I double checked that I could procure each of the parts by calling the individual stores and checking that all was in stock. Since this is a basic design I made sure to chose very commonly available items, but its always safe to check.

I finished the design by applying materials and appearances to each of the parts. For the timber I used the amazing 3D textures available in fusion 360. Specifically I used the 3D pine in it as this is the material i chose to build the light out of. Have a look how close it matches the final product, amazing!

For the LED's I used an emmisive appearance and changed the colour for red green and blue renders. I then painstakingly applied a different rainbow colour to each to create the rainbow renders.

Procuring the Parts

MVIMG_20190914_122624.jpg
IMG_20190914_124743.jpg
IMG_20190914_125813.jpg
IMG_20190914_130230.jpg

With our design finalised and drawn, all of the bits and pieces for it can be procured from their various sources. Below is a list of the parts I purchased with the links to them for your info. In the brackets I have also included possibly where to get the materials with links for other shops in the USA and UK.

Electronics is always a hard one since most brick and mortar stores have shut in favour of online retailers. So if you are struggling on where to buy any of these have a look at this write up to find a shop that has what you need close to you. If all else fails there's always heaps on eBay, amazon, or your favourite online store I'm sure.

To start went to the hardware store as its one of my favourite places in town. Here I purchased just three things;

  • The Timber - (Possibly from Home Depot and B&Q) I went for a 140mm x 1200mm x 19mm piece of dressed pine. Being dressed means all of the hard work of making it pretty has been done for you by the store. When choosing a piece, you must look for warping of the timber, as well as knots. This, after all, is designed to be hung up. After choosing the perfect piece, almost all hardware stores will trim lengths down to what ever you need. For myself I got them to go from 1200mm to 1100mm.
  • The Aluminium - (Possibly from Home Depot and B&Q)To match the timber, I went for a 20mm x 20mm x 1.5mm right angle with a length of 1000mm. I opted for the thinnest piece as this design is not heavy at all, so does not need much strength for mounting. Hardware stores should also be able to cut these down for you. Don't forget you will need two of these.
  • Wood screws - (These will be available anywhere) To attach the aluminium to the wood I opted for some short 12mm wood screws with a phillips head. These will bite into the wood allowing for a solid connection to the timber. Be sure to get screws that are long enough for good support, but short enough so not to poke through your timber.

I then went to my local electronics store; Jaycar. I'm not sure what the chain brick and mortar versions are in the states or the UK, so i have used digikey and RS components for reference here. Heads up these are affiliate links, so if you decide to purchase from there thanks for the support.

  • Terminal Connector - (Possibly from Digikey or RS Components) These come in all shapes and sizes, but the main thing you are looking for is to have three screw connections, one for power, ground, and signal. As for current, you will have to match that to the number of LED's (more on that later), but for safety 10 amps terminals and above will suit fine for most applications.
  • Jumper Wires - (Possibly from Digikey or RS Components) These are invaluable when playing with electronics. They have a single connection at each end either male or female for connecting bits together. For this project, we need the male to female connections.
  • Standoffs- (Possibly from Digikey or RS Components) These are to mount the ESP8266 off the timber to cool and allow for connecting the wires to it.
  • Right Angle Header - (Possibly from Digikey or RS Components) These help angle the pins of the ESP8266 out away from the board for a better connection with the jumper wires. I did not manage to purchase one of these in time for the build (thanks Australian delivery times), but i would highly recommend these over bents pins.
  • Bolts- (These will be available anywhere, even the Digikey and RS Components) To mount the ESP8266 and terminal block i used M3 bolts. Any ESP8266 should also use M3 holes, but try purchase a Terminal connector with similar sized holes to suit. Otherwise simply buy bolts to suit your terminal block. I went for a length of 20mm as this would go through the standoffs and into the timber enough.
  • Power Supply - (Possibly from Digikey or RS Components) This will be addressed in the next section, but I purchased a power supply capable of running my lights. This is very important and will vary case to case due to the LED's, so I have suggested very large power supplies. If you know what you are doing, you can adjust the current output. If not the suggested power supplies will suit 66 LED's. But more on this in then next section.
  • (Optional) Very Large Capacitor - (Possibly from Digikey or RS Components) If you are having issues with your ESP8266 resetting all the time, chances are the LED's as stealing too much power instantaneously from the power supply. Putting this huge capacitor of 1000uF or more in will solve those issues. This is a very common solution to a very common problem with these micro controllers.

Now, since I live in Australia, our part stores are heinously expensive when it comes to electronics such as the ESP8266 and any strip LED's in particular. So I usually head to eBay or Amazon where there are stacks and stacks for very cheap

  • The ESP8266 nodeMCU - This is a particular platform of the ESP8266 which is great for starting on. It has a USB connection for programming and power making it super easy to use (and fix when you upload a bad program... trust me). There are a couple of form factors for these, but since our design is flexible, you can purchase any of them.
  • The WS2812b LED's - I opted for a 3 meter roll of WS2812b's with 30 led's per meter with a sticky backing. This was to keep the power levels down and in turn the heat for these. If you want you can purchase more per meter, but keep in mind of the power requirements. If you have a look at the end result, its still amazing even with fewer LED's. You also don't have to go for WS2812b's, they are what i used, but there are many more out there as outlined in this fantastic write up. Just make sure that you get a strip with the wires already soldered on the end for you.

A Note on Powering WS2812's

IMG_20190914_165615.jpg
IMG_20190914_173241.jpg
IMG_20190914_173332.jpg
IMG_20190914_173420.jpg

This has been said many times but needs to be reiterated; one thing that beginners (and experts for that matter) always ignore on most electronics projects is power. Power is almost always a cause of problems when starting a project as it is usually underestimated. This is especially true for applications requiring large numbers of LED's to be powered on and switched frequently like this project.

The WS2812b's are thirsty 5050 packaged LED's and require a fair amount of current to use. With Adafruit's estimate at at around 60mA per chip on full white. In this project the total number of LED's used is 66 which, when projected comes to 3960mA! Add the 300mA of overhead you need for the ESP8266 and you can see this is a huge amount of current and will blow up under specified power supplies.

To check the actual current consumption for my purchased LED's, I measured the current seen at full white when all 66 LED's were on (also each of the channels for reference). This came to 2.24 Amps instead of the 3.96 Amps predicted, which is was glad about to start with as this meant i could use a smaller power supply. But this is not always the case and will depend on your LED's.

If you cannot measure how much current your LED's will draw, the safest method is to over estimate the power supply current rating and buy something accordingly. In every project there is no harm in over specifying how much current the power supply should be able to supply. In this case, the only thing that thing that will be on fire may be your back pocket. But better that than your hard work.

If at this stage you think you should try find lower power LED's, there were two important reasons why I chose a strip of WS2812b's with 30 leds/m. The first is the small number per meter means less LED's and therefore less power required in total. The second is that the WS2812b's are essentially have on board constant current power supplies, which means as voltages fluctuate within optimal conditions they remain the same brightness. This takes a lot of work out of keeping the LED's around the strip the same brightness and colour.

The chips are also dimmable meaning that if you want to use less power, you can just set it to a lower brightness! However if you aim to use a smaller power supply with this is a method, it is bound to fail, as sooner or later the brightness may go above what you specified and things will blow up.

With this all stated, there is just one thing to keep in mind; over specify your power supplies current rating for your application and you will never run into issues.

Attaching the Aluminium to the Timber

IMG_20190914_140944.jpg
IMG_20190914_141233.jpg
IMG_20190914_141541.jpg
IMG_20190914_142446.jpg
IMG_20190914_142731.jpg
IMG_20190914_143010.jpg
IMG_20190914_143031.jpg
IMG_20190914_143142.jpg

After procuring all of the parts, its now time for the fun part, Putting it all together. I started by cleaning up my work area making sure there was no dust or dirt that could stain the timber as it will be on display. I then took the following steps to mount the aluminium to the back of the timber;

  1. Start by laying out the aluminium, ESP8266, and terminal block onto the back of the timber. Position everything so that it looks good and try see if you have any clashes or height issues before continuing.
  2. Next, measure and mark out where everything should go. I started by marking where the corners of the aluminium strips will be from the corners of the timber. On my drawing this is 20mm down and 50mm in from the side edges, centred about the middle. The ESP8266 and Terminal block I just placed near the centre as the absolute position does not matter, and then put a pen through their holes to mark.
  3. Next, I drilled the holes through the aluminium for mounting the it to the timber using a 7mm drill bit. The diameter of the hole must be bigger that the screw used but smaller than its head to allow it to fasten correctly. These holes do not have to be marked out or precise as you will not see them. I did this over a bin to catch the shavings. Note that after drilling you may have to debur the hole. Do this by getting a larger drill bit and by hand turn and apply medium pressure on the hole to remove the sharp edge on both sides.
  4. I then drilled the holes for the power and wall mounting as outlined in the drawing. Using the same method as above i then deburred the holes to remove the sharp edges. This is very important for the power cable hole!
  5. After deburring, align the aluminium back up with the markings from earlier and tape it down on either end. Here, use the same drill size as you did to go through the aluminium (7mm here) to mark the timber where your holes are.
  6. After marking, I used a 2.5mm drill bit with some tape on it 10mm up from the tip (as in the pictures) to drill where I just marked. The bit should be smaller than the threads on your wood screws, but not to small such that the timber will crack when driving them in. The tape is to stop you from over drilling the depth through the timber. These holes will now allow you to mount you aluminium strips to the timber with the wood screws.
  7. Take the wood screws and the correct driver for them and drive them into the timber through your aluminium. Use enough force to drive it flush but not to much to break anything.

Adding the Terminal Block and ESP8266

IMG_20190914_152246.jpg
IMG_20190914_141233.jpg
IMG_20190914_143844.jpg
IMG_20190914_143943.jpg
IMG_20190914_144439.jpg
IMG_20190914_144650.jpg

Now the aluminium is mounted, we can move onto mounting the terminal block and ESP8266. Before mounting the ESP8266 I had to bend the legs out on the power, ground, and D1 pin. This was because I did not have a right angle header available to me at the time of making this. Whilst this is not an elegant solution, it does work and provide a secure connection to the ESP. To mount it and the terminal I took the following steps to do so;

  1. Where I had marked my holes, I took my 2,5mm drill bit and tape, and drilled down to the tape on one marked point of the ESP8266 and terminal block.
  2. I then took one of the M3 bolts, and using the correct driver, forcefully twisted it into the new hole. This taps out the hole with a M3 thread with a good amount of bite force such that the ESP8266 and terminal will not come off.
  3. Next I undid the M3 bolt and mounted the terminal and ESP with it through just the one hole. Using the 2.5mm drill bit and tape, I drilled another hole using the terminal or ESP as a guide. By using the actual part as a guide the holes will be precise and allow easy mounting.
  4. After drilling the second hole, I pushed another M3 bolt into it. This secured both the ESP and terminal so that I could drill out the remaining two holes and once again, push the M3 bolts into them.
  5. After drilling and taping these holes. Undo all of the screws to clean the area of wood chips and debris. This will also allow you to inspect you handy work on the holes.
  6. Next I mounted the terminal block. This was as easy as all the holes lined up perfectly. It should feel nice and solid in place, if not it will be hard to use a good force on the terminal screws later on for mounting the wires. So if need be, redo the mounting holes now using the same method and maybe a smaller drill bit if your holes are not to standard.
  7. To mount the ESP8266, you will need tighten each corner with a M3 bolt through a 12mm spacer. Before mounting it, if you are smarter than I and have a right angle header as I suggest in the materials section, now is the time to put these on. If you want to follow what I have done, you should bend the legs now. Doing up the M3 bolts and spacers will be a bit fiddly with all the bits and lining it up, but produces the best result.

Sticking the LED's On

IMG_20190914_155505.jpg
IMG_20190914_155803.jpg
IMG_20190914_160044.jpg
IMG_20190914_155758.jpg

Please note that the WS2812b's and other addressable LED's have a data direction. This will be labelled on the strip usually as IN for the input and OUT for the output of the data signals. Before attaching or cutting any strips or cables, please check the orientation of your LED's. You will want to connect the data IN to the terminal block in this project.

Now that you have mounted all of the difficult and time consuming hardware. We can get going on how to stick the LED's on. To do so I took these steps;

  1. I started by cleaning the aluminium with some soapy water. This will remove dirt, grease, and shaving from the hardware store and drilling process. This is critical for the sticky backing to adhere well.
  2. After, I pushed the power cables for the LED's through the power hole and aligned the first LED as close to the hole as possible. Using some masking tape I stuck it down in this position.
  3. I then unwound the rest of the 3 meter roll and wrapped it around the aluminium in a test fit to see where I needed to cut it. Through this process I also taped it in various section to hold it in place.
  4. With the roll unwound, I also aligned it where I had even numbers of LED's on the top and bottom as well as the two sides. This will be important for you to know later on as we will need to set this up in the code. In the end, I had a perfect 30 on the top and 30 on the bottom as well as 3 on each side for a total of 66 LED's. These also fit perfectly since I used 1 meter strips of aluminium and and spacing of 100mm between the tops of the them.
  5. When you are satisfied with how your LED's are aligned, you can cut the strip off where you need it and undo the holding tape. Usually it is a good idea to cut across the little copper terminals. However in my case to fit the strip in happily I cut the strip across the black portion. This is okay in our case as we cannot add any more LED's to the strip later anyway.
  6. Now for the fun part, start to unpeel the sticky backing on the LED's starting at the first led where your power cables are and stick the first led down where you had it. Continue along the strip in this fashion until you are all the way around. For the sides where i had no aluminium for this I simply cut a little bit of the sticky cover and put it back on. This is not necessary but will stop things from sticking to it.

Wiring It All Together

IMG_20190914_161028.jpg
Wiring Diagram.png
IMG_20190914_174313.jpg
IMG_20190914_152625.jpg
IMG_20190914_154739.jpg
IMG_20190914_160324.jpg

That's it for sticking the LED's on. From here we can start to wire everything up. The steps I took to do so were as follows;

  1. Take the end of the power cable for the LED's and chop it off at the correct length to connect it to the terminal. You can use anything to chop this, but a pair of kitchen scissors work fine. With the wire cut you can strip approx 10mm of the plastic off the end for mounting using the scissors as well.
  2. Take the new stripped wire and screw it into the terminal block. For my terminal block I used left for power, middle for data, and right for ground. Be sure to always double check these connections when making them.
  3. Next take three of your jumper cables and plug the female end onto the 5V, GND, and D1 of you ESP8266. For identification, I used red for power, black for ground and green for data, but choose any colours you would like.
  4. We can now screw the male end of the jumper wires into the other side of the terminal block matching exactly what the power, ground and data terminals for the LED's are.
  5. Next we can prepare the power supply. Depending on what one you bought this step may be different. But if it has come with a moulded end use this step. In the end all we want are the bare wires in the terminal block. So start by chopping the end of the wire off to expose the inner wires of the power supply. You can then strip the insulation back to expose the bare wires allowing you to connect them to the terminal block. This is sometimes easiest to do with a knife on double layer insulation, just be careful.
  6. Depending on what model of power supply you have purchased, it will either be easy or difficult to determined the polarity of the wires. Most of the time you can tell from the colours of the internal wires being black and red, other times it may be harder. In these circumstances its easy to check with a multi-meter, but for this Instructable to be simple, the easiest method I can suggest is to use an led to check which way it lights up. If you find yourself in a place where you do not have a multi-meter and it is hard to tell which wire is what, there is a great discussion here on what you can do.
  7. After you know which way around your power supply polarity is, you can push the cable through the power cable hole on the aluminium and connect it to the terminal block. This is on the same side as the LED's so simply unscrew the power and ground terminals and add the wire of the power supply onto it. Tighten these firmly so that the connection is a good as possible. Give it a little tug to make sure its in tight.
  8. At this stage it is good to test if you got everything connected the right way, so go ahead and power on the power supply. If nothing blows up you have it connected correctly. The lights will not do anything, but the ESP8266's little blue light will flash just briefly. If not its time to debug, first, check all of your connections are correct twice, make sure all wires are tightened down nicely and that the header haven't fallen off. If all of that is okay, you may have a dud somewhere.

Programming Your ESP8266

Github Download.PNG
Boards Manager.png
Add Library.png
Board setup.png

NOTE: When connecting to your ESP8266 via USB, ALWAYS disconnect the 5V lead from the pin on board. Failure to do so will either cause the LED's will draw power from the ESP8266 and blow up your board (or worse your computer) or fight with your power supply also blowing up your board and power supply rendering them useless. Leave the grounds connected as everything needs to be referenced to the same ground.

Before we turn on the light after connecting everything together, we need to program our ESP8266. This will require you to connect to the ESP8266 via USB and upload some code from the Arduino IDE. At this stage please don't have your power supply on when connecting via USB as this might blow up your ESP8266. Programming will involve a couple of step as the code I have written for a the sketch contains a few external libraries we need to install for it to compile. This is not hard at all, and following these steps we can get the code uploaded to the board easy.

To program the ESP8266, I like to use the Arduino IDE as it is nice and simple to get going. If this is your first micro controller project, the Arduino IDE and ESP8266 is a great gateway into the fantastic world of IoT. For this Instructable, I will be keeping this section concise so that I am not repeating what is already available on the internet in much better quality than I can write. I have of course suggest links for when you may get stuck.

First off though you must have the Arduino IDE installed and know how to use its basics. I will not go into great detail here as the Arduino website and various other sources have amazing tutorials on how to use it. To download it look on their downloads page for the correct version for you operating system.

Once installed we can get to the nitty gritty, installing the ESP8266 boards and required libraries. To install the ESP8266 into the Arduino environment, head over its GitHub page and find the "Installing with boards manager" part of the readme. By following the 4 simple steps over there by pasting the link into the "Preferences" (under the file menu) of the Arduino IDE will add the ESP8266 as a supported platform. After pasting it in, reboot the IDE to finish the process. If you get stuck on this step be sure to check out other literature such as Sparkfun's tutorial on how to get the ESP8266 running on the Arduino IDE.

Please note that you must use ESP core version 2.5.2 for this code to work. You can change back to this version in the boards manager.

To keep things super simple for this project I have collected all the necessary files and libraries and that work for the sketch of this project over at My GitHub project page. To get everything all together, click on "clone or download", then the "download as .zip". This will get you everything from the GitHub page in a .zip package. Unzip this downloaded folder to anywhere you want so you can access the content, remember where you have done this.

Included in this .zip folder are all the external libraries under "External Libraries" folder and the sketch to upload under "Super Simple RGB WiFi Lamp" folder. Head into the "Super Simple RGB WiFi Lamp" folder and click any of the the .ino files in there. This will open the Arduino IDE with the sketch. If you try to compile this, it will complain that there are missing libraries that need to be installed.

The external libraries are zipped up in the folder "External Libraries" and have code that allow the sketch to run. Luckily the Arduino IDE has an easy way of installing any library so long as it is a .zip package. The Arduino website has a great guide on how to install libraries from zip file for your operating system. So if you are unsure of how to do it head over to this link and check it out. All you need to do is install all the libraries via this method and the sketch should be able to compile. To do so click on the little tick in the top left corner.

If your sketch compiles congrats! Your IDE is all set and ready to upload to the ESP8266. To do this we need to have selected the "NodeMCU v1.0" under the "tools->board" menu, but we also need to set one option. Under the tools menu where it says "flash size:" it might have "4M (no SPIFFS)". We need to change that to "4M (1MB SPIFFS)" to get the full functionality of the sketch. Once selected you also need to select your serial port to your board under the "port:" option under tools. Now, click the upload button (top left, arrow next to the tick) and wait for the sketch to upload. You should see the ESP8266 blink its little blue led a couple of times in upload. If all went well you should open the Serial Monitor under the tools menu again to see what the ESP8266 is saying. There should be a bunch of debug there for you to read.

Next we will tune your light to make sure it outputs the light correctly!

Setting Up the Sketch

IMG_20190923_195729.jpg
IMG_20190923_195737.jpg

Now that you have your IDE working, allowing you to upload new sketches to your ESP8266 on your lamp, we can go ahead and tune it. This is so that we can map the LED's on your light to what the sketch expects to output for the various modes. We can also setup your WiFi on the sketch the way you would like and a few other small variables that we need to set.

The first variable, if you have purchased WS2812b leds, is the data pin. In this example we use D1 on the board which in software is pin 5. This is confusing and to do with the way the board is labelled vs the actual pin used on the chip. Be careful of this as it has caught me out multiple times. In the sketch this is set to 5, and I suggest you keep it there as other pins sometimes don't work.

#define DATA_PIN 5

Next, we need to know how many LED's are on the light. At this stage it is handy to count them out and number them around so you know which is what. We need to set how many we have in the code so the script can work off that amount. This is done with the NUM_LEDS variable;

#define NUM_LEDS 66

Since the ESP8266 needs to sync its clock to the real world, it uses NTP to collect the UTC time. UTC is the time in England and not helpful if you are elsewhere in the world. To change this i have add an offset variable you can set to your timezone offset. For me here on the eastern seaboard of Australia this is +10. For New York for example, this would be -5;

#define UTC_OFFSET +10

The next thing we need to do is map the LED's so the code knows which is where. If you have a look at the uploaded image, I have written what number each LED is around the back of my lamp. Since I now know what LED is where, I can type this into the code and let the script know which LED's it needs to turn on when. I have split the groups of LED's into 4 sections; top, bottom, left, and right.

int topLeds[] = {18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47};<br>int bottomLeds[] = {14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51};
int leftLeds[] = {48, 49, 50};
int rightLeds[] = {15, 16, 17};

These are basic arrays that need you to put in the LED's in correct order. The easiest way to do this is to work clockwise from one corner of the light entering the LED's into the correct arrays. Have a look at the uploaded image again and what comes with the script should show how to do this correctly. Take note that the bottom LED's start at 14, go down to 0, back up to 65 and back down to 51. This is because the end of the LED strip is actually in the middle of the light. By typing these in in the correct order allows the script to work correctly. If you get this wrong when you turn it on, remember you can type it in and try again!

The last thing to set up which is optional, are your WiFi credentials. If you set these up the device will attempt to connect to your WiFi network. I recommend doing this as it is the easiest way of getting connected to your network, or if you choose not to, the device will start its own WiFi network you can connect with your phone or laptop! By careful when entering these values as they are case sensitive to the name of your WiFi network. Failure to get the case right on each character will result in the device not connecting.

String SSID = "Your Wifi Network Name Here";
String Password = "Your Wifi Password Here";

If you have to re upload the sketch to the board, i suggest setting the "Erase Flash" setting under tools to "All Flash Contents". By doing this, the save file of the config will be deleted allowing for new data such as newly typed in SSID's and Password to be set and stored correctly.

If you have set up you sketch correctly its time to click upload. Go ahead and click the upload button and wait for the sketch to boot. The best way to check if the device is working is by opening the serial monitor in the Arduino IDE. Here you can see all of output the device is spitting out.

First Light!

Super Simple RGB WiFi Lamp
IMG_20190922_235926.jpg
Website Home Page.PNG
Website Colour.PNG
Website Rainbow.PNG
Website Clock.PNG
Website Bellcurve.PNG
Website Night Rider.PNG
Website Wifi.PNG

If all has gone correctly you should see the device say it is connected to your network. This should now tell you where you can find your device on the network with either an IP address or the mDNS name. The most reliable way to access the web page is through the IP address that the ESP8266 says its connected to. Just copy and paste the link from the serial monitor into a web browser.

If you decided not to put in your WiFi credentials in the last step, the device will start its own network you can connect to with your phone. Simply go into your WiFi settings on your phone and connect there. Then when promoted to sign in on Android or iPhone click that to open the web page. If you decided not to put in your WiFi credentials, and want to connect it to your network later, or if you want to change network, you can do this on the inbuilt website!

If you get a response from either method and the website loads fantastic, that's it! Hopefully after pressing a few things you get the same as what I show in the video. Only without the weird flickering I think due to the camera trying to adjust in the low light. Go ahead and play around with the inbuilt mode that I have programmed into the lamp. these include;

  • Straight Colour
  • Bell Curve
  • Rainbow
  • Clock
  • Night Rider

These are more detailed over on the projects GitHub page on how to use as well as how talk to the device itself if you are interested. Since it is a WebSocket server talking JSON, you can connect it with something like Node-Red really easily. If this is something you would like me to detail, let me know in the comments.

Thanks for reading, and even more if you gave this a go! I'm happy to keep support going for Modes and updates on the code when I can. But I'd love to hear what kinda of Modes you would like and maybe like to see implemented. Happy Making!