Power optimisation
For the emonTx to run on two AA's for as long as possible, the Mains AC: non-invasive 3.0 energy monitoring circuit and code was optimized for low power. See below for a brief account of the changes.
1. Reduce CT circuit voltage divider values from 10K to 470K
This reduced quiescent power consumption across the resistors from 0.25mA to 5.3uA at 5V
2. Reduce number of samples from 6000 to 1490
This reduced the time needed for a reading from over 1s, to 332ms. As the number of samples are reduced it is important that the time taken for the samples is an integer of the period the the waveform.
The period (one wavelength) of mains 50Hz is 20ms. Each sample was measured to take 0.188ms. This means that 106.4 samples/wavelength are possible. 1480 samples takes 280.14ms, which is 14 wavelengths.
3. Put Atmega 328 into sleep mode in between readings
We followed this example to use the watchdog timer to put the device into sleep mode for 4 seconds (watchdog value 8) in between readings. In sleep mode the Atmega 328 consumes 0.03mA with an RF transmitter and CT monitor circuit. The power consumption during readings is 13mA
Rough battery life estimation calculations
Therefore, the device is on for 332mS consuming 13mA, then asleep for 4s consuming 0.03mA
This gives an on/off ratio of 4/0.332=12. The battery life should be extended by this amount.
An AA alkaline battery has 2000 to 3000mAhrs of capacity. If the device was not put into sleep mode the battery would last for 2500/13=192hrs=8 days.
Since the device is in sleep mode for a proportion of this time, the average power consumption is 13/12=1.083mA plus the sleep mode power consumption of 0.03mA
This should give a battery life of 2500/(1.083+0.03)=2246hrs= 93.6 days = 3 months
In reality, the battery will not last this long, at least not using two AA's, since the Atmega 328 will stop working due to low voltage before the batteries are depleted. Using three A's would be better, but our enclosure does not allow for this. The Atmega 328 should work down to 1.8V.
Real world battery life test
A real-world test was setup to verify the above calculation. Here is the result:
The test actually ran for 5 months from two AA batteries! A great success.