One thing i would really like, is being able to monitor the voltage the JeeNode and XBee are running on. Now the XBee has a %V command, specially for reading the voltage on the Vcc pin. So let’s see of i can use this.
The first thing i noticed was that the XBee i configured with the AT End Device firmware, didn’t respond to the %V command. Hmm, correct; the manual was very clear about it: the %V command is only supported by a Router and not by a Coordinator or an End Device. And it’s those End Devices (which will run on batteries) that i want to monitor…
OK.. next command to have a look at was the ‘IS‘ command, which stands for Force Sample; this command forces a read of all enabled digital and analog input lines and a small comment told me it could also return the supply voltage: “Analog samples are ordered sequentially from AD0/DIO0 to AD3/DIO3, to the supply voltage.” So lets try this one, shouldn’t be to hard i guess?
So i added support for this command to my API and started sending frames to the XBee:
Sending frame:7E 00 0F 17 01 00 13 A2 00 40 33 1F 7A A2 ED 00 49 53 FB
I won’t go into detail of every byte in the frame above, but the 2 bytes marked in red are the ASCII codes for ‘I’ and ‘S’: yes, ‘IS’, the command we want to be executed on the remote XBee. The response that came back from the XBee was encouraging, however, no supply voltage was present, only the values of some random Analog input lines i enabled:
Rcvd Frame:97 01 00 13 A2 00 40 33 1F 7A A2 ED 49 53 00 01 00 00 02 02 09 FrameID=1, Command=IS, Status=0, Command Data size = 6 (01 00 00 02 02 09)
With the help of an example i found out the meaning of the Command data:
OK… the frames that were being received looked nice, but it’s not what i want… where’s the supply voltage? The example above doesn’t show it either.. but it must be possible, right?
After searching for more than an hour, i suddenly bumped upon a setting in the X-CTU tool (in the I/O Sampling section), that had the following description:
Configure the supply voltage high threshold. If the supply voltage measurement equals or drops below this threshold, the supply voltage will be included in an IO sample transmission. RANGE:0-0XFFFF
Aahh, that must be it… this setting has a default of 0, causing the supply voltage to never be included in an IO sample! I set the value to FFFF, disabled all other I/O lines on the XBee et voila:
Rcvd Frame:97 01 00 13 A2 00 40 33 1F 7A A2 ED 49 53 00 01 00 00 80 0A BC FrameID=1, Command=IS, Status=0, Command Data size = 6 (01 00 00 80 0A BC)
This means there is 1 sample set, containing the supply voltage, and the value is: 0ABC.
Multiply this with 1200/1024 and you get the supply voltage in mV:
($0ABC =) 2748 * 1200/1024 = 3220 mV. Great!
Tomorrow i’ll add some code to my HA system to periodically send an IS command to this XBee and store the results. And then just wait and see what happens when i let a JeeNode and XBee running on alkaline batteries 24/7…