Introduction: WiFi RGB Cellular Lamp Using the ESP8266
In this post, we build a beautiful RGB cellular lamp that can be controlled over WiFi. The control page consists of a colour wheel which allows you to quickly change colours and you can also specify the RGB values directly to create a total of over 16 million colour combinations.
The video above covers everything you need to know and also explains how the lamp is put together.
Step 1: Gather the Components
We would need a WeMos D1 Mini or compatible ESP8266 board, a microUSB breakout board and some 5V, WS2812B addressable RGB LEDs. You can use the links below as a reference:
- WeMos D1 Mini: https://www.ebay.co.uk/itm/NodeMCU-Lua-ESP8266-ES...
- MicroUSB Breakout: https://www.ebay.co.uk/itm/Micro-USB-DIP-Adapter-...
- WS2812B LEDs: https://www.ebay.co.uk/itm/WS2812B-RGB-5050-SMD-St...
The D1 mini board has a microUSB connector and 5V output but power from the USB connector first passes through a diode and a 500mA fuse before reaching the pin. We need much higher current than this as each LED can take up to 60mA at full brightness. That’s the reason why we will use a microUSB breakout board to power this lamp.
Step 2: Prepare the Lamp 3D Model
Download the models using the following link and print it as per the scaling you want.
3D Model On Thingiverse: https://www.thingiverse.com/thing:1883446
I used the files marked 140 and scaled it down to 70% as I didn't want something too big.
It is recommended that you glue the stand to the base once you add the LEDs, but in the video, I tried inserting the stand inside the base and this resulted in a slightly unstable finish. I will reprint the base and stand and glue it later.
Step 3: Add & Wire the LEDs
You then need to cut the LED strip to length and add as many as you need. I decided to add a total of 26 LEDs in two layers, as seen in the images. The power pins are all connected in parallel, but the data has to flow from the input pin to the output so keep this in mind.
I also cut a slot in the stand so that the wires could slide easily as the board will be sitting on the outside.
Step 4: Prepare the Sketch
Download the sketch using the following link and open it up in the Arduino IDE.
You will need to add the number of pixels or LEDs along with your WiFi network name and password as the board needs to connect to it. You can also change the default RGB values for the lamp when it powers up.
You would need to install the ESP8266 board support package & the Adafruit NeoPixel library for this sketch.
Installing the ESP8266 board support package:
- Open up the preferences window (File->Preferences), add the following URL (http://arduino.esp8266.com/stable/package_esp8266com_index.json) to the board manager section and then close the window.
- Open up the board manager from (Tools->Boards->Board Manager) and type in ESP8266 and install the package that is available.
- Once done, close the board manager and select the correct board settings as shown in the image.
Installing the Adafruit NeoPixel library:
- Open up the library manager (Tools->Library Manager)
- Type in "Adafruit NeoPixel" and install the library that shows up
Once this is completed, hit the upload button and wait for the sketch to upload. Then, open up the serial monitor and wait for the IP address to be listed. Most modern WiFi routers automatically reserve the IP addresses for devices, but you can also manually reserve an IP address by changing the DHCP settings.
Step 5: Connect Everything Together
Use the connecting diagram to connect everything together. Be sure to use a suitable power supply depending on the total number of LEDs. It is recommended to use a 5V, 2A power supply for 26 LEDs as in this build and the USB power hub we built earlier will work just fine.
Step 6: Test the Lamp
Type in the IP address into a web browser on your computer or mobile phone and click the Control button. You will then obtain a colour wheel. Simply select the colour you want the lamp should automatically change colours. You can also type in the RGB values directly if needed.
That's how easy it is to build a very nice RGB cellular lamp that looks beautiful! Using the web browser is not entirely convenient but I will be integrating this lamp into a home automation project along with some more sensors. That should improve the overall usability. If home automation does interest you then do follow us to stay notified using the relevant links below:
- YouTube: https://www.youtube.com/channel/UCbWiK1A5RqAugSquBHuyBdA
- Instagram: https://www.instagram.com/bnbe.club/
- Facebook: https://www.facebook.com/BnBe.club
- Twitter: https://twitter.com/bnbe_club
- BnBe Website: https://www.bitsnblobs.com/