Baby night light.jpg
Smartifying a light for your baby
Very little is needed, when you have ESPHome to help.
A few months ago, we bought a TEMU-quality night light for our baby. It's extremely cute!

The light is composed of two parts:
- The shape of the cat (although we have a dispute because some of us insist it's a bear) is a silicone lamp shade.
- The base has a few LEDs wired together with a microcontroller and a tap sensor. It comes apart from the lamp shade easily — tug on the shade while holding the base. The light + microcontroller circuit is powered by three AAA cells.

The light is wonderful. We turn it on using the button on the base, then tap to cycle through colors, then tap again to get it to stay at a particular color. Our baby falls asleep to its dim, colorful glow rather quickly, and about after an hour the light turns off.
But a few things were bothering us:
- Batteries. At the end of the month, when the batteries want to be changed, the circuit shuts off much faster — sometimes within five minutes of turning it on. The light is much dimmer as well. And it's a pain to have to change batteries, even if they're rechargeable.
- We have no control over the intensity of the light, and rather coarse control over the color.
- We'd like the light to go out when we want it to go out, rather than using the timer predefined by the manufacturer. Ideally, the light goes out 5 minutes after there is no activity in the baby bedroom.
Turns out, we can do all of this!
Here's the plan:
- I'll construct a new circuit, using a Neopixel-style array of smart lights, specifically this 7-LED RGB pixel array.
- The light array is going to be controlled by an ESPHome dev board, specifically an ESP32 mini. I originally bought them brand named KeeYees and sporting micro USB connectivity, but the linked device basically the same form factor except using USB type C.
- The whole thing is going to be powered by a USB type A charger I have lying around, through a micro USB cable I have lying around. If you're following along this mini-guide, you can just use an USB type C cable.
- We'll use simple 22AWG wires to solder the requisite points on the ESPHome board and on the lights.
- Everything will be fit in a 3D-printed base, custom-made to snap fit into the lamp shade, and the light will be securely attached to the base using M2 screws.
Total part cost should be under $25, which is about what we paid for the light. Of course, we get to keep the original battery-powered base, perhaps to use as a night lantern somewhere else in the house.
The soldering part
Here is all you need to do:

- Strip the ends of three short (2 inch or less) 22AWG wires, then solder them between the light array and the dev board as per the photo:
VCC(5 volts off of the USB plug) of the ESP goes to 5VPWRon the lights.GNDof the ESP goes toGNDon the lights.- the
IO22pin of the ESP goes toDI(data input) on the lights.
- You should use 22AWG at least for the power wires, because you may end up pulling slightly more than 2 amps through the power wires.
- Verify you did not short out GND and VCC using your multimeter (set it to resistance / continuity mode).
That is all you'll need.
The software part
You'll be programming this device via USB using ESPHome, which this guide assumes you already have installed. Program the following sketch into the device:
# Pinout:
# * VCC to PWR of the light
# * GND to GND of the light
# * data pin (GPIO22 in this case) to DI of the light
esphome:
name: baby-night-light
friendly_name: Baby night light
esp32:
board: mhetesp32minikit # this will vary depending on your choice of board
framework:
type: esp-idf
api:
encryption: # Uses key set by Home Assistant
ota:
- platform: esphome
# you will want to set a
# password: "<32 hexadecimal characters>"
# to prevent other devices from OTA-updating this device
# without authorization
wifi:
ap:
ssid: "ESPHome setup"
password: "12345678"
# Lets you set up the device on Wi-Fi.
captive_portal:
status_led:
pin: GPIO2
# You can delete the two following lines once you have added
# the device to Home Assistant.
web_server:
port: 80
light:
- platform: esp32_rmt_led_strip
rgb_order: GRB
chipset: WS2812
max_refresh_rate: 16ms
pin: GPIO22
num_leds: 7
name: "7-LED ring"
# Max 2 amps consumption: 85% 85% 85%
# Calibrating for white (RGB) as the default calibration
# is too blueish / greenish due to red LEDs being less potent.
color_correct: [100%, 85%, 75%]
restore_mode: RESTORE_DEFAULT_OFF
effects:
- addressable_rainbow:
name: Rainbow
speed: 10
width: 50
- addressable_twinkle:
name: Twinkle
- addressable_flicker:
name: Flicker
- pulse:
name: Slow pulse
transition_length: 1s
update_interval: 1.06s
min_brightness: 0%
max_brightness: 100%
- strobe:
name: Color cycle
colors:
- state: true
brightness: 100%
red: 100%
green: 0%
blue: 0%
duration: 500ms
transition_length: 500ms
- state: true
brightness: 100%
red: 0%
green: 100%
blue: 0%
duration: 500ms
transition_length: 500ms
- state: true
brightness: 100%
red: 0%
green: 0%
blue: 100%
duration: 500ms
transition_length: 500ms
Build and install this to your device, then test it as follows:
- Plug your device into a 5 volt USB power supply that can provide at least 2 amperes of current (more if you later decide to bump up the
color_correctionbrightness percentages). - When the device boots, it will create a captive portal named ESPHome setup. Log into this portal using your Wi-Fi (password, if required, should be
12345678). - On the captive portal, add your Wi-Fi credentials and save them. The device will reconnect to your LAN.
- Once you've seen the device log back into Wi-Fi (check your router), get its IP address and visit it using your Web browser.
You should see a screen where you can control the lights. Turn the lights on, and verify they do turn on. Then observe after a few minutes whether they got hot to the touch (they should not). If they get hot to the touch, the color_correction brightness percentages in the sketch should be lowered (and the device re-flashed) for safety reasons.
The base part
Find the 3D part to print here. FIXME. This part is designed to fit our baby lamp shade (and quite a few other models on the market), but since I supply a parametric FreeCAD file among the downloads, you can always resize the main base cylinder and the depth of the side groove (a cut from a sketch applied to the main base cylinder) to fit your part, then re-export your custom base as a STEP or STL file.
Minor support removal under the central supports for the light will be necessary — make sure to enable supports everywhere during printing, then remove the supports gently using needle-nose pliers.
The assembly part
Now put everything together. Here are handy pictures:



Long story short:
- Snap-fit the ESP32 dev board into its slot — there are notches on the side that should fit it perfectly, and the ESP32 is meant to go "upside down" (chip face down). Be careful not to snag the wires or damage the solder points.
- Place and screw the light, one screw at a time, into its central supports. The screw (which should not exceed 8mm length from base of head to tip) might require some firmness to tap into the hole — be gentle and careful not to snap the central supports.
- Plug the ESP32 into the USB cord you plan to use.
- Now snap the base to the lamp shade.
You're done!

Adding your device to Home Assistant
When you go to the Devices & services section under the Home Assistant settings, you should see a new ESPHome device appear, named Baby night light. Pair it with Home Assistant.
Once paired, you'll get this new device under the Devices list (yours will have fewer entities — I have added extra entities beyond the simple sketch above, for management purposes):

The light entity itself will be called 7-LED ring and should be controllable. In my home I have renamed it, but here's what it looks like:

Of course, you can change the color and intensity of the light. The sketch also contains a few fun effects you can enable from this screen.
Once you've securely paired your device to Home Assistant, you may want to delete the web_server: code snippet from the sketch and re-flash the device (this time over the air). This prevents anyone else in your LAN from controlling the light without authentication via their Web browser.
Baby night light.jpg
Baby night light disassembled.jpg
Soldered.jpg
Close-up pre-screw.jpg
Close-up screwed.jpg
Top view, plugged in.jpg
Screenshot 2026-01-25 at 01-23-29 Settings – Home Assistant.png
Screenshot 2026-01-25 at 01-23-43 Settings – Home Assistant.png
Light fully assembled with lamp shade.jpg