Saving power
To allow the running of your project on batteries for any meaningful time, you will have to take measures to reduce the current usage. The temperature sensor that you created in Chapter 2, Collecting Sensor Data, draws around 80 mA. Suppose you run it on some rechargeable AA batteries rated at 2,000 mAh. This means that the batteries are expected to last about 2,000 mAh / 80 mA, which equals 25 hours.
It is sufficient to say that a wireless sensor network is not so useful when the batteries have to be changed every morning. Fortunately, there are a lot of things that can be done to save power.
The first step in reducing the current usage is to find out where all this current is going. On this sensor, the current usage is roughly divided as follows:
Main microcontroller: 10-15 mA
16U2 microcontroller (serial-to-USB): 15-25 mA (even when not using USB)
Power LED: 6 mA
5 V regulator: 5 mA
3.3 V regulator on the Arduino: 0.1 mA (more when loaded)
3.3 V regulator on the XBee shield: 0.5...