7 Steps to Build a #RRGGBB Multicolor Lamp (Part 1)

Gonzalo Cervantes
May 6, 2019 · 6 min read
#00bf72 and #ff0000

For years I wanted to craft a plug and play RGB bulb with full control of every single LED of the set. Just a bulb that could be screwed like a regular one, set the wifi network up, and that’s it!

With this approach, there is no need to use a HUB.
The lamp/bulb is connected directly to the router.

But wait! You could buy something like that for a few bucks.
Yeah, but I didn’t want to be tied to any API, app or remote control.

My intention was not to create a standard of DIY lights. There are lots of options to buy or build better than this.
My idea was to control the whole process and use the LEDs as I please.

1. Where to start

Necessary things:

  • A broken LED bulb (0US$).
  • A board with an ESP8266 chip (~5US$).
    I used the Wemos D1 mini because it is widely used.
  • A tiny 5v adapter (~2US$).
    The one I’ve used is not an iPhone adapter. It’s a cheaper replica but it does its job pretty well.
  • NeoPixel LED Ring, 16 x 5050 Ws2812 (~3US$).
  • A few thin wires (0US$).
  • A broken micro-USB connector (optional).

2. Connect and test the ring

First, solder the ring and the Wemos like this:

Basic Wiring (D6 is not mandatory)
  1. Install Arduino IDE (https://www.arduino.cc/en/Main/Software).

2. Test the ring with this example made by Shae Erisson with some minor modifications:

Necessary library: https://github.com/adafruit/Adafruit_NeoPixel

3. Choose the board: LOLIN(WEMOS) D1 R2 & mini.

4. Select the USB port:

5. Burn the example:

Burning Code with Arduino IDE

Finally, It should look like this:

Dummy example running

But it feels like:

3. Let’s burn the final code

You have 2 options =>


  1. Download the project code:
  2. Open the lamp_begins file and change the SSID with your wifi network name and its password.

Then choose the local IP. If you don’t know how the local IP should be, the easiest way to get it for any OS is visiting this site: https://www.whatismybrowser.com/detect/what-is-my-local-ip-address.
In my case, the local IP of my laptop is, so I’ve chosen for the lamp.

Please, check twice the first 3 numbers of the IP and the gateway.
Otherwise it won’t work.

Lines 73 and 74 of the example.

Now, burn it in the same way you did with the project file you have changed.

3.2. Step by step.

Please read the comments of each code file.

4. HTTP request. Let’s set some colors.

It’s very simple.
Just call the local IP slash the HEX colors separated with hyphens. That’s it. With this code example, you can set 2^n colors up to 16: 1,2,4,8,16.

One color
2 colors
8 colors

4.1. Back to the board. Let’s make it red (#ff0000).
Go to your browser and GET:

It should look like this:


Instead of using your browser, you can use the Postman app.

4.2. Let’s set 2 colors(#ff0000 and #00ffa2). GET:

It should look like this:

4.16. Let’s make a rainbow.

5. Let’s connect everything (complete wiring)


I left the micro USB port of the Wemos free in order to update the board and fix potential bugs.

If you want, you can solder both cables (VCC and GND) to the Wemos board, but that could be impractical.

You can use other digital pinout. D6 isn’t mandatory.

Keep in mind that it is important to leave about 20cm (8") of cable between the 5v adapter and the tip of the cable in order to make the installation easier.

5.1. Detach the 5v adapter and solder the cables

Protect the soldering using hot glue

6. Assemble everything

Hot glue the LED ring to the bulb case
Try to leave the antenna free like the picture above
Top View: My new lock-screen wallpaper

7. Use examples

7.1. Shortcuts

If you are an iOS user, you might use the Shortcuts application. It’s really useful to create routines. Let’s create one using the bulb.


7.2. Watch OS app

I’ve built this app for my apple watch in order to handle the lights from it.
You can change the quantity of colors in the picker using the crown.
Every colors triggers a GET call like GET http://192.168.x.x/hex_color_here

WatchOS Color Picker

7.3. Notifications instead of triggering manually

I’ve crafted a Drip Irrigation System for my wife’s plants. As you can see in the picture below, there is a tank full of water with 3 pumps inside it, one per each group. Those pumps provide the plants with water. At the top of the tank, there is an ultrasonic sensor connected to a Wemos which triggers notifications when the water level is too low or too high.

Too much water notification

7.4. Etc.. Do whatever you want



There are 256³ (16 million) possible colors using #RRGGBB notation using only one value. If you use more than one color at the same time, the number goes too high. I think it would be (256³)¹⁶=256⁴⁰⁹⁶ possible combinations.
So, enjoy playing with it.

In the second part, I’ll make the network changing easier without needing to burn the code again, and I’ll add more features.

Bonus Track: data backup

I forgot to mention that using the lamp_with_data_backup code, every time you set a combination of colors, those values will be saved in the memory of the board. So, if the power goes down or you unplug the power cable, the lamp will reconnect itself to the network and it will set the saved combination of colors.

Suggestions are more than welcome!
Made with ❤

The Startup

Get smarter at building your thing. Join The Startup’s +789K followers.

Sign up for Top 10 Stories

By The Startup

Get smarter at building your thing. Subscribe to receive The Startup's top 10 most read stories — delivered straight into your inbox, once a week. Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Gonzalo Cervantes

Written by

Product Manager at SmartForce

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +789K followers.

Gonzalo Cervantes

Written by

Product Manager at SmartForce

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +789K followers.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store