Software: Hek has already set up the software for battery operation. You can report the battery condition as a percentage (see above) and the low power sleep time can be set as well.
Hardware: I had one of these available, which is basically just a processor, a 3V3 regulator and a power indicator LED:
It was modified for low power operation - see attached image - PCB layout varies depending on manufacturer:
- disconnect the power indicator LED by cutting the track between the LED and the resistor in series. Saves about 1.5 mA
- disconnect the 3V3 regulator as it’s not used. Cut the Vout pin with a sharp fine wire cutter. Saves about 220 uA.
- install the FTDI header excluding the Vcc pin connection. We don’t want the PCB powered by the USB cable while programming it - a 3V3 FTDI was used - be careful you plug it in, the right way up:
https://www.sparkfun.com/products/9873
- the device is powered by two AAs in series and connected to the PCB using one of these ultra low power step up convertor/power regulators:
https://www.sparkfun.com/products/10967
When powered down, the CPU, DS18B20 temp sensor and radio consume (very roughly) 120 uA - which is stuff all and similar to the self discharge rate of the batteries.
The battery lifetime can be calculated by determining the average current of the set up using the general equation:
I avg = (t0I0 + t1I1 … + tx*Ix) / (t0 + t1 … + tx)
Note these figures are indicative only - your results may certainly vary. Currents are measured at the battery with a battery Voltage of 3.0 V
idling: I0 = 28 mA, t0 = 0.65 sec (using the delays I set up in the sketch)
transmitting: I1 = 31 mA, t1 = say 50 mSec (time is just a guess)
sleeping: I2 = 120 uA (very roughly), t2 = 15 minutes (the temperature sampling rate)
Using the above figures the effective current = 0.142 mA The sleep current is difficult to measure accurately, so this figure may vary and that would effect the lifetime calculation.
Assume the batteries are good for 2000 mAhr, then that gives a lifetime of 14,101 hours, which equals 19.6 months. The lifetime is pretty much dominated by the sleep current and sensor sample rate. Assuming the figures & calculations are correct (let us know if they aren’t), it’s likely the batteries would die partly of old age rather than through actual usage.
I used a 1 M and 470 K resistor in series, connected to the battery plus and ground and connected the tap point to the A0 input on the CPU. The tap point is bypassed with a 0.1 uF capacitor to keep the noise level low, at this otherwise high impedance point. The ADC is set to use the internal reference of 1.1V - so Vmax at ADCmax = 1.1*(1e6+470e3)/470e3 = 3.44V That then has to be converted to a useable percentage to suit Vera’s battery devices.
More info here:
This site suggests the operating current while sleeping could be lowered even further:
It could be argued that the step up convertor is not required at all - just connect the PCB directly to the batteries. A few pro and cons:
[ul][li]Operating Voltage is held at 3V3 versus the brownout detector threshold of 2.7V kicking in for a direct connection - noting the latter can be disabled.[/li]
[li]Batteries can be sucked totally dry using the regulator.[/li]
[li]Regulator is 80% efficient while a direction connection is 100%.[/li][/ul]
I suppose you could try both methods and report back in a year or so!
When you think that all this sophisticated stuff can still run using a few microAmps, you really have to wonder at how science has progressed electronic devices over the last fifty years. Pity the bits are so frigging small you can’t see them without a microscope, let alone trying to solder them together.