Solar powered MQTT wifi particulate matter sensor

ESP8266-based SDS011 particulate matter sensors are very common, but I don't have a power outlet on my balcony. So I decided to build a solar-powered sensor. Instead of sourcing a solar panel and building a case (weather-proof of course) myself, I decided to get a solar-powered outdoor LED lamp from Aliexpress and retrofit my electronics into the lamp case.


The lamp contains 2 18650 NiMH batteries with 2000 mAh at 3.7 V which should give us plenty of power for our circuit if we manage to get the sleep current (which will dominate the total power consumption) down to some mA. It took me some trial-and-error to get it right, but now the sensor runs on solar power even on short foggy dark Swiss winter days. The circuit diagram shows the ideas I came up with:



  • the ESP8266 is in deep sleep most of the time. We wake it up every 10 min to take a measurement. The connection between RST and D0 makes sure it initializes properly on wake-up.
  • since the SDS011 needs 5 V but the batteries only deliver < 4 V under load, we use a step-up converter to generate 5 V. We control the EN pin of the SX1308 buck converter via D2 of the ESP.
  • after waking the SX1308 we measure the battery voltage (hence the voltage divider between B+ and B-) and only turn on ESP wifi and the SDS011 if the battery voltage is above 3.2 V.
  • the 1N4148 diode in the Vcc line of the ESP8266 brings the battery voltage (which can reach 4.2 V if there's no load) down to ESP-safe levels.
  • if everything checks out, we turn on the SDS011, take a measurement and publish the values to a MQTT broker.
  • initially I tried to power the ESP from a supercap during deep sleep. It's still in there, but it's not needed any more.
  • the usual ESP12-E circuitry (pulldown for D8, pullups for RST, EN, D3 and D4) is not shown for simplicity reasons.

The source code can be found here.

all images Creative Commons License - last change: 2019/06/09
a 2019 daduke production. all rights reserved.