WiFi RGB Cellular Lamp – ESP8266

Published by frenoy on

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

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.

USB Serial Port Circuitry & Need For Breakout Board

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

70% Scaling For Models

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

Cut To Length & Stick
Solder Wires To End Strips Before Adding Second Layer
Make Sure Data Can Flow From The Input Pin To The Output Pin
The Final Wiring For My Setup
Clip The Base To Allow The Wires To Flow To The Bottom Easily

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 link at the bottom of this post and open it up using the Arduino IDE.

Specify The Number Of LEDs
Enter The Network Name & Password
Change The Default RGB Values If Needed
Serial Output When Connected

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

Connection Diagram
Wiring The Modules To Test
Make Sure The Power Supply Can Deliver The Required Current
Trim The Wires & Sticke The Boards To The Base
Assemble The Base & The Stand, And Test

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 & Click The Control Button
Click The Colour Wheel To Change The Lamp Colour
You Can Also Specify The RGB Values Directly
The Final Setup

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.

Download Sketch: https://github.com/bnbe-club/rgb-cellular-lamp-diy-9