Retrieving supply voltage

Hi all,

I’m still very new to both XBee and Python, so this might be easy, yet I haven’t been able to solve my problem yet.

I have an XBee /L/T Sensor and would like to retrieve the current supply voltage of the device.

I have created a simple Python script like this:

import sys

import zigbee
from xbeedevice import *

def main(args):
device = XBeeDevice(‘00:13:a2:00:40:53:2a:77!’)
print str(device.XBeeCommandGet(‘%V’))

if name == ‘main’:
rc = main(sys.argv)

The odd thing is, it doesn’t fail, but it gives me weird values like P, H, B, 8 etc.

Any ideas?

I am also new to the Xbee world and also working through how the LT/H works. You may have resolved this already and be a few steps ahead of me, but this is what I have determined.

According to the reference manual %V only applies to modules configured as routers so I guess the results for an LT/H sensor is unclear.

I have been reviewing the DIGI python files (refer attached) to determine how the DIA tool manages the Xbee module and determines low battery on an LT/H sensor. These routines read DIO11 (set P1=3) and return true/false for low battery.

Attached is the py file from the DIGI DIA distribution which may help explain.

The “problem” with measuring supply voltage on a sleeping device it is leads to a small current leak at ALL times, meaning even when it sleeps so battery life falls - remember, the XBee is a daughter-module so has limited I/O options.

So most of the Digi products (all?) don’t offer direct access to the battery voltage, but offer the indirect comparator signal (the “low Battery” flag) which I think really just means the output of the voltage regulator has fallen below the expected voltage by some margin.