So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By grad
#61344 Hi all, I have a new question for you!
My NodeMCU project is composed with: NodeMCU board and DHT22 Sensor.
The goal is take temperature and humidity every 15 minutes and send this data to my raspberry REST client.
After I've realized how to use the DeepSleep mode I tried to use as an energy source 3 AA batteries via micro USB.
Now, the job works very well for some hours... In my opinion it should have been lasted at least for few months...
Probably the power supply via usb is not a good idea...
Could you suggest me an external power supply solution? I would like my IoT gadget to last at least 1 year, it's possible?

Thanks a lot in advance,

User avatar
By torntrousers
#61345 NodeMCU boards aren't so good with battery power. The voltage regulator on the board is not very efficient and even if powering the board directly to its 3.3v pin then the other components on the board keep using power even when the ESP is deep sleeping so you can't get the deep sleep current consumption to be very low.

For a battery powered ESP its better to use something like a an ESP12 on its own. The problem with that is finding a long lasting battery power supply that can deliver around 3v to 3.3v. You can use a couple of alkaline batteries directly connected to the ESP, but the ESP will fail as the batteries get flat and the voltage drops to around 2.8v, which with a couple of alkaline's means 1.4v per battery and there is a lot of life left in alkaline battery still when its at 1.4v.

So better is to use three alkaline batteries and have the ESP12 on one of those white adapter boards and using a low quiescent current voltage regulator to drop the 4.5v down to 3.3v. Something like an XC6206 or HT7833 work well. Like that you can get most of the capacity out of the battery and you should be able to get the deep sleep current to be less than 30 micro amps, which makes it negligible compared to the awake current.

Then how long it will last mostly depends on how often it wakes up and does something and how long it stays awake each time. Say it wakes up and sends a reading every 15 minutes and it takes 3 seconds each wake up to connect to WiFi and send its reading then the current consumption would be roughly:

75mA for 3 seconds 4 times an hour
75mA for 12 seconds an hour =
75mA for 12 seconds out of 3600 seconds =
75mA for 0.003333 of an hour

Say a AA alkaline batter has a capacity of 2000mAh then

2000mAh / 75mAh / 0.33333 =
8000 hours, so divided by 24 hours a day =

333 days, so almost a year on 3 x AA alkaline batteries
(and that roughly matches what I've found from trying it)
User avatar
By torntrousers
#61346 One way to extend that is to try to reduce the awake time. Taking 3 seconds to connect to WiFi seems really slow. I've tried various things to reduce that and can sometimes get it to connect in less than a second (so 3 x 333 = two an a half years on a AA batteries which would be great) but its really inconsistent and doesn't last and randomly goes back to taking 3 seconds. I suspect there are bugs in the ESP8266 SDK which make the WiFi connection so slow.
User avatar
By ratfink
#73903 I am doing much the same as you and have found the best way is to use Lithium Ion rechargeable batteries. They produce a nominal 3.2volts and have a fairly good energy density. I have one larger format IRC18650 cell which has been running for several weeks now without even charging the battery after it arrived. I also have some AA sized 'allegedly' 1000mah China ebay ones, and am still testing those but am aiming for a minimum of two weeks between charges. My field testing exposed to outdoor temperatures is about to start so I will report back.

I am usig a dht22 on a full size NodeMCU board with some additional circuitry to detect a change from light to dark and trigger and immediate wake up outside of the 15 min cycle. I find that the unit draws about 50ma for up to 10 seconds (I have to allow time for some data transmission over 3G), which is less than 1 minute of use per hour. In theory I should get 20 hours continual use out of one of the AA cells so with a 24 min per day duty cycle should see 40 days per charge but expect temperature and the quality of the cells to play a part.