Building a night light using an ESP8266 and an Ardafruit NeoPixel Ring

Christian Kellner
2 min readJan 17, 2021

In the not too distant future, my daughter will be born. Of course, in the first months, she will sleep next to our bed. As my wife needs to feed the baby in the night, we were searching for a night light. It should be super simple. Just a button to turn on the light, best would be red light. However most of the night lights that you can buy either are very expensive or they have motion sensors or some fancy stuff that you don’t need.

After some time I decided to build a super simple night light myself. All you need is:

- an ESP8266 (or ESP32)
- an Ardafruit NeoPixel Ring (any version will do, I have the one with 13 LED’s)
- some box (I just used a tupperbox)

Wiring

The wiring couldn’t be simpler.

ESP 5V  -> NeoPixel 5V
ESP Gnd -> NeoPixel Gnd
ESP D4 -> NeoPixel Data Input
Wiring
ESP 8266 -> NeoPixel Wiring

Yes, I know an ESP is totally oversized, but I still have a few of them lying around…

Code

I’ve decided to run the whole thing using a powerbank. If one presses the button to enable the powerbank, the light goes on, if one shuts down the power bank, the light goes off. Simple as that. Only thing you have to keep in mind when doing this is to add a tiny delay after initializing the pixel. Otherwise some led’s will not turn red.

That’s it. You can change the brightness of the LED’s, however, 100% was perfect for my use case. Last thing to do is wrapping everything in a box and installing it next to the bed.

Happy hacking.

Boxing the components
Putting everything in the box
And this is how it works

--

--