My "Smart Night Light" project

A while ago I was inspired by Ben’s multi sensor project… An ESP8266 wifi based device sending sensor data out using MQTT. Perfect for OpenHAB

But I want to take it a step further and build all the components into an off the shelf Night Light so that it can be powered directly from the wall socket and also have a decent look and feel.

I’ve started by buying a $10 night light which runs off 240V and has some bright LEDs in it. The plan is to use the existing power supply to run a wemos D1 mini with a bunch of sensors and NeoPixel stuffed into it.

I’ll keep coming back and updating this thread with my progress.

I plan to have the following sensors…

  • Temperature
  • Humidity
  • Light Levels
  • Movement
  • NeoPixel LEDs

Anyone with other suggestions of sensor types i should try cram in there? Anything not too expensive obviously :grinning:


I planned to do similar couple years ago, but … be aware that temperature sensor will most probably give you wrong values as internal power supply will heat up the box and led’s as well when they are on (easily 10 celsius degrees). When box is connected to power and it feels warm, then temperature is over 37 celsius degree. Wrong temperature will most probably also influence to the humidity accuracy. At least try to assembly sensors as far below from the power supply you can and increase the ventilation of the box. You can also try to calibrate values.

I also ordered and received one very tiny Hi-Link power supply module from eBay, but as I abandoned my project I have never tested how much it warms. At least they promise low power consumption (no-load loss <0.1W). There is also 3.3V version available.

Hey @pauli_anttila thanks for commenting… Yeah for sure the DHT22 temp and humidity sensor will be mounted on the outside of the box, probably at the back somewhere.

Interesting project!

If the light is to be located somewhere you can easily access, you may also add a control button. Could be a physical pushbutton, a capacitive touch sensor, a proximity sensor…

Otherwise I don’t think of other sensors that would be useful.
I’m also working on diy room sensors, my first two prototypes are doing the same measurements you are planning (temp, humidity, light and motion). I’ll design a PCB before assembling some more, so I’m also very interested if somebody has other suggestions for sensors!

@doum I wish I could do my own PCB… Maybe I’ll have to have a go at it once I have my design finalised. I’m going to want about 10 of these sensors so might be worth it.

I was thinking CO2 or Carbon Monixide monitoring maybe?

Maybe even a vibration sensor… No major earthquakes where I live but they can be felt sometimes…

Okay pictures speak 1000 words… I’ll explain how for I’ve got and how a little later.
This is the test rig (ignore the toothbrush charger below it)…

And this is some data coming from it displayed using Grafana…

And this is what it looks like in the sitemap for now.



Can you pls Share your Code? I’m working on something similar but have Trouble to get the Motion detector running and get this transferred to openhab (and you seem to have this running)


Ahhh crap!
Looks like the sd card in my raspberry pi dev environment has got corrupted. Meaning I’m going to have to get this all working again on another machine. Man, I wish I had at least posted my items configuration to this topic already :frowning:

Thought I’d try a raspberry pi again for my OpenHAB environment but this has annoyed me to where I’ll be keeping my windows based machine as my primary OpenHAB box for sure!

Okay, managed to read some data off the SD card so was able to get access to the items file. Have copied it to OneNote for safe keeping will post here later.

Next issue is while doing some testing I must of shorted some pins out because a quick puff of smoke and my night light is now dead… :joy:

Time to start working on a tidier version 2 I guess!

Hi @TommySharp

Did you get anywhere with your project?

Yeah I did actually… Although only built the one as I couldn’t find anything pretty put them in and ideally I wanted all the components to squeeze nicely into an off the shelf night light.

I’ll dig out what I ended up with and post some photos.

I ended up going with EspEasy running and the Wemos D1 Mini as it was fairly straight forward to setup the sensors.

Just a few ideas, using other sensors, if your wanting to keep the size small. The DHT22 can be replaced with a BMP280 that’s a 3rd the size, uses I2C protocol and provides pressure, temp and humidity. If using Esp Easy firmware it also gives the the dry bulb temp. For light sensing a small photocell with two resistors takes up very little room. Not much you can do with the PIR sensor, their just plane bulky, but you could maybe use an RCWL motion sensor see here for the specs.