The Bluetooth readout node running the “smaRelay” code is ready to go:
As mentioned yesterday, I’ve decided to take the easy way out and completely power down the Bluetooth module and go through a full powerup/connect/readout cycle about once every 5 minutes.
The advantage for me of a battery-powered unit, is that I don’t have to locate this thing near a power outlet – it can be placed out of sight, unobtrusively doing its work.
I seem to have developed an allergy for power cables and wall warts all over the place…
The power on/off logic held a little surprise, about which I’ll report tomorrow.
Here’s is the new part of the updated smaRelay.ino sketch:
Quite a different use of the watchdog here:
- on powerup, go into low-power mode and wait for 5 minutes
- prepare the watchdog to perform a reset in 8 seconds
- power up Bluetooth, connect to the SMA, and read out some values
- then power down Bluetooth and power up the RFM12 radio
- send out a data packet over RF12
- lastly, turn the radio off and power down
- let the watchdog do the reset and make this sketch start over
This approach has as “benefit” that it’ll fail gracefully: even if anything goes wrong and things hang, the hardware watchdog will pull the ATmega out of that hole and restart it, which then starts off again by entering an ultra-low power mode for 5 minutes. So even if the SMA is turned off, this sketch won’t be on more than about 1% of the time.
Here’s the energy consumption measurement of an actual readout cycle:
The readings are a bit noisy – perhaps because I had to use 1 mV/div over a 1 Ω resistor (the 10 Ω used before interfered too much with this new power-switching code).
As you can see, the whole operation takes about 4 seconds. IOW, this node is consuming 153 milli-Coulombs every 300 seconds. That’s 0.5 mC/sec, or 0.5 mA on average. So the estimated lifetime on 3x AA 1900 mAh Eneloops is 3800 hours – some 5 months.
Update – The first set of batteries lasted until March 18th, 2013 – i.e. over 4 months.
Good enough for now. Deploy and forget. Onwards!