DIY Lux Sensor with BH1750 (Battery)

Hey, guys…

I’m really new to ESPHome and all the Arduino Stuff. I tried to search in the web, but didn’t find any satisfying solution, so you are my last help.

Im trying to build a Lux Sensor with a BH1750. The most important thing is, that I can use it with a battery ( I already built a wired lux sensor with a sonoff basic). I found a few guides how to connect a BH1750 to a wemos d1 mini or other stuff, but nothing decent for battery usage. It looks like the main problem is that a demos d1 mini drains the battery to fast (also with deep sleep).

Do you have any ideas how to realize that? I could use Wifi or a RF-Bridge for connection.

Im really stuck atm, and appreciate any help!

How often do you want it to report lux values?

Every 5-10 mins …
Maybe, if that is a possible, just when there is a huge change of the state (but I don’t think that this works, since it would „sleep“)

Back of the envelope calculation:

Every 10 minutes = 144 samples a day.

Lets say it is awake for 30 seconds to connect and report, that’s a total wake time of 1.2 hours a day.

Neglecting the sleep current (it is about a thousand times less), and assuming a wake current average of 500mA that is 0.6Ah of battery capacity required a day.

The average 18650 Lithium cell capacity is about 2.2Ah, it would run your sensor for under 4 days.

If you want wireless sensors go zigbee or zwave. Their transmitters are a lot more efficient than wifi.

1 Like

Nice analysis, however your wake current is way off, my D1’s pull less than 100ma when awake.
Also, if you’re interested in daylight values, 10 mins might be a bit too often, stretch it to 30 mins and your in the ballpark on battery but you’ll need to go bigger for longer run times. If the unit is going to be installed outside, why not pair it up with a smallish solar panel to keep the battery topped up…?

I would, like I said, it doesn’t have to be a wemos d1 mini. I can go Zigbee , RF or Wifi … but I don’t know how to do it. I don’t know how to build a Zigbee sensor. Thats my main problem.

I want to use the lux sensor for my cover automations. If the sun shines directly into my living room I want the cover go down. Thats why 30mins is to much…

The idea with the solar panel is good! Do you have a example of your wemos? Or some pictures how you created your sensor?

Luck. I build this today .
Board is WeMos D1 ESP-Wroom-02
Firmware is latest Tasmota + Deep Sleep
Deep Sleep is set to 300 sec
Pics:

3 Likes

Wow … that’s really called luck :D…

What to you think, how long will this work with battery? Could you maybe tell me also how you installed tasiota with deep sleep? Like I said, im totally new and willing to learn this :slight_smile:

When I tested board Wemos D1 mini + 18650 battery shield + BME280 sensor + ESPEasy with Deep Sleep (30 min sleep /10 sec awake) as outdoor temperature sensor battery lief was more than two months.

I’m guessing you measured that with a multimeter. Which is not fast enough to capture the real current. Using a current shunt and an oscilloscope I measured 250mA to 750mA when awake. Others have found similar results. My assumption of 500mA average is valid for a ballpark figure.

I guess it depends on the use case. But for my system I use a (wall powered) BH1750 sensor reporting every 3 minutes and it does a reasonable job of making my indoor lights react to sunrise / sunset and even passing squalls in the afternoon.

I use 5W 5V panels and two 18650 cells for my gate and shed door sensors. They are barely sufficient to make it through the winter. And these sensors only report in a couple of times a day on average. Mind you I live at 42°S.

What it comes down to is that for a regularly reporting sensor wifi on battery is not the way to go.

Using my calculations from above I get 65 days for a 10s wake every 30 minutes. So that’s a good confirmation of my wake current estimation.

I have found I need to wake for longer than 10s to get a reliable mqtt connection from the edge of my wifi range though (more like 45s).

Just FYI, the wemos D1 mini is not the best choice for battery use, simply because they use ME6211 regulators with Iq = 40uA (that’s the spec anyways, clones likely come with even worse ldo’s). Since that quiescent current burns 24/7, even during deepsleep, you can get a lot longer battery life using an esp12 module with a decent LDO with lower Iq (like ADP160AU @0.56uA, or similar). I know, it’s a lot more tedious soldering work, but it is usually worth it if it saves having to charge as often. For perspective, I have an 18650 powered esp node that wakes every 10min and warms up a DHT sensor for 30sec before it starts up the wifi radio and updates ha. This node lasts 3 months on average… in practice over several years (not just a calc). I appreciate your progress, and I don’t mention this to diminish your project by any means… just that I know there can sometimes be disappointment involved if you don’t account for Iq in a battery powered design before building it out. :wink:

[edit: On a closely related note, if you’re building battery powered stuff, you should really make a micro amp meter for testing and validation. Here’s the one I built myself… there’s a case for it too if you have a 3d printer:


]

It’s not the sleep current that makes this non-viable. 40uA running 24 hours is less than 1mAh. Which is basically zero compared to the 600mAh required by the wake state per day.

Hmm… that’s doesnt look good for my project. Seems like I have no other choice than a wired sensor.

I don’t know how other sensors work. There are Wifi Battery cameras on the market, that work like 2-3 months with one charge …

How can just a esp8266 with a lux sensor drain so much energy?

Maybe you can tell us results of your built sensor?
what is the current energy consumption with this setting?

Sorry ,I don’t have hardware for serious monitoring energy consumption.

i don’t mean values… just a approx life time of one battery charge :slight_smile: … its running since 2 days for you now :smiley:

omg budy , ask mi after two months :wink:

Im again here… I received my board and got everything working. But how do you use Deep Sleep? Do you have the shematic of the board and can share it please? I didn’t find anything about GPIO16. Also, how are you using SCL and SDA with D1 and D2? I don’t know wich GPIOs are that…

I know this is a really old post, (forgive the bump) but your use case is exactly what I want to achieve (HA reacting to interior light levels, regardless of time of day). Wall powered is great. Can you provide any details on your build of these sensors? Thanks in advance!