User Manual

MPR/MIB User’s Manual
Wireless Sensor Networks
Doc. # 7430-0021-06 Rev. A Page 23
Figure 6-4. Photo of using the Molex connector to attach the AA battery pack. Photo courtesy of
Nick Sitar, UC Berkeley, 2004.
6.3 MICAz Battery Voltage Monitor
The MICAz has an accurate internal voltage reference that can be used to measure battery
voltage (V
batt
). Since the eight-channel ADC on the ATMega128L uses the battery voltage as a
full scale reference, the ADC full scale voltage value changes as the battery voltage changes. In
order to track the battery voltage, the precision voltage reference (band gap reference) is
monitored to determine the ADC full-scale (ADC_FS) voltage span which corresponds to V
batt
.
To compute the battery voltage:
1. Program the application code to measure ADC channel 30 – the Internal Bandgap
Voltage reference.
2. Compute battery voltage, V
batt
, from ADC reading (ADC_Count) by:
CountADCFSADCVV
refbatt
__×=
where:
V
batt
= Battery voltage
ADC_FS = 1024
V
ref
= Internal voltage reference = 1.223 volts
ADC_Count = Data from the ADC measurement of Internal Voltage reference
The TinyOS component VoltageM.nc can be wired into an application to provide this
measurement capability. The reserved keyword TOS_ADC_VOLTAGE_PORT is mapped to ADC
Channel 30 in the MICAz.
6.4 MICA2 Battery Voltage Monitor
The MICA2 units have an accurate voltage reference that can be used to measure battery voltage
(V
batt
). Since the eight-channel, ATMega128L ADC uses the battery voltage as a full scale
reference, the ADC full scale voltage value changes as the battery voltage changes. In order to
calibrate the battery voltage a precision external voltage reference is required. The MICA2 uses
an LM4041 (Mfg: National Semiconductor) 1.223 V reference (V
ref
) attached to ADC channel 7.
X NOTE: ADC channel 7 is also used for JTAG debugging on the Atmega128 processor. MICA2s and
MICA2DOTs ship with the JTAG fuse enabled. When this fuse is enabled the input impedance of channel
7 is lowered which affects the voltage reference measurement. The fuse must be disabled if ADC channel
7 is used. See below for information on setting ATMega128L fuses.