Doing some DIY as a hobby, I'm making a small humidity-temperature radio sensor.
An ATmega328 is reading from a DHT11 sensor and then transmitting data to a Raspberry Pi by an STX882 radio transmitter. It is powered by a 9 V battery using a 7805 5 V regulator with 10 µF and 100 µF capacitances.
The C code on the ATmega is reading humidity and temperature and then sending it every 30 minutes:
const unsigned long DELAY = 30*60*1000UL; // 30 minutes
void loop() {
delay(DELAY);
send_data(); // Maybe a little overcomplicated, but I think it is not the point
}
This was working like a charm, but the battery life has been unexpectedly short. It was brand new, and I made some sporadic tests with a short delay, with no abnormal heat coming from anywhere.
When I was satisfied, I put the 30 minutes delay and leave it alone (which was maybe a bit hazardous?), but after less than 24 hours the battery was 5.4 V dead. The 30 minutes delay was approximately respected for its lifespan though.
What could explain such a short battery life? Could it be the 5 V regulator? How could I build a long-lasting circuit?
PS: I'm still trying to Fritzing some diagram, but this takes age for noobs like me...
I used a 6lp3146 generic brand alkaline 9 V battery which apparently provided 300-500 mAh at 100 mA current, which is far more than what my circuit use.
Here is all information I could gather from the datasheet:
+-----------------+-------------+----------+-----------+---------+
| | DHT11 | STX882 | ATmega328 | 7805reg |
+-----------------+-------------+----------+-----------+---------+
| Voltage | 3-5.5 V | 1.2-6 V | 2.7-5.5 V | |
+-----------------+-------------+----------+-----------+---------+
| Active current | 0.5-2.5 mA | 34 mA | 1.5 mA | |
+-----------------+-------------+----------+-----------+---------+
| Standby current | 0.1-0.15 mA | <0.01 µA | 1 µA | 4-8 mA* |
+-----------------+-------------+----------+-----------+---------+
*"bias current"
If I understand correctly, my system is active for a few seconds every 30 minutes, so the standby current is all that should matter, and it is indeed driven by the 7805 regulator.
So yes, in the worst case, with 300 mAh I should be able to keep the system alive for only 40 hours.
Is there a way I could feed my system 5 V for a much longer time without a much bigger size?
For the record, here is a very good video about LM regulators vs. buck converters: Buck converter vs. linear voltage regulator - practical comparison