XBee AIO Struggling to get Accurate values from Current Loop on Terminal 1 Thermo couple

Hi,
New to Digi kit but not networking. I`ve tried to find info on my own but I’m struggling. Lack of know-how, correct direction, docs. Can you please help.
Using Python script from Digi wiki
I have a brand new Connect Port X4 and an AIO with a 4 to 20 mA thermocouple on Terminal 1 to measure temp in degrees. I want to run a python script and return an appropriate value to STDOUT etc.
I have run the following to set to Current Loop (4-20mA) and analog input on terminal 1 & 2
from xbee import ddo_get_param, ddo_set_param

addr = ‘[00:13:a2:00:40:98:17:29]!’

##Enabling current loop on terminals 1 and 2
ddo_set_param(addr, ‘D8’, 4)
ddo_set_param(addr, ‘D4’, 4)
ddo_set_param(addr, ‘D6’, 4)

##Enabling terminals 1 and 2 for analog input
ddo_set_param(addr, ‘D0’, 2)
ddo_set_param(addr, ‘D1’, 2)

Changes applied using:
##Applying changes and writing to flash
ddo_set_param(addr, ‘AC’)
ddo_set_param(addr, ‘WR’)

To obtain value I use:
##Taking a sensor sample, printing the raw binary string to STDOUT
sample = ddo_get_param(addr, ‘IS’)
print sample

Return is always: 9Ðùÿ

Appears Malformed?

Using http://www.roubaixinteractive.com/PlayGround/Binary_Conversion/Binary_To_Text.asp converts to

00111001110100001111100111111111

Do I parse and take the decimal number?

Value never changes although ohms on terminal Pair does

Two issues:

  1. How can I retrieve convert to meaning full data? Spent a day looking at digi docs and forums but struggling.
  2. Why is value constant when temperature is not?
    Points:
    • Documentation in detail appears limited unless I’m looking in the wrong place.
    • Thermocouple tested and records values fine on Siemens 1200. I`ve also tested Terminal 1 positive and negative on multimeter and appears ok as in fluctuates ohms when temp applied/taken away.
    • I wonder if I have set it up correctly?

Can anybody help or point in correct direction.

Many thanks

Aidan

First, how old is your adapter? A skeleton is that product’s closet is there are 3 different hardwares, and each requires only certain generations of firmware. One symptom of the wrong firmware is you’ll get numbers larger than 1023.

The easiest solution might be to set the IR parameter to 15000, which means every 15 seconds the adapter should forward the IS data without you polling.

Hi,

thank you for relpy.

Information below:

Connect Port X4 firmware: 0x2170 - latest one
Xbee AIO Adapter firmware: 0x26a0 - as shipped

I have disected the output as follows:

ASCII:9 Dec:057 Hex:39 EBCDIC:IT Bin:0011 1001
ASCII:Ð Dec:208 Hex:D0 EBCDIC:} Bin:1101 0000
ASCII:ÿ Dec:255 Hex:FF EBCDIC:Ÿ Bin:1111 1111
ASCII:T Dec:084 Hex:54 EBCDIC:è Bin:0101 0100
ASCII:ù Dec:249 Hex:F9 EBCDIC:9 Bin:1111 1001
ASCII:ÿ Dec:255 Hex:FF EBCDIC:Ÿ Bin:1111 1111

to see if anything came from it but still studying it.

I am in the process of updating the AIO adapter firmware but on digi site can only find firmware linked to the XBee-PRO RS-232 Adapter ZB on the product support site. However it appears as though its for all XBee adapters?

I get the impression i need to convert the data to make it meaning ful as in temp-degrees etc once problem of extraction is solved.

Do you think I`m on the right lines?

regards

Aidan

UPDATE!!

Hi,

update firmware to: XBee / XBee-PRO ZB firmware ver. 2xA0

Quote “This file contains an ebl_files subdirectory, which contains the files necessary to do over-the-air firmware updates to XBee/XBee-PRO Adapters and modules on ZB networks.”

from:
http://www.digi.com/support/productdetail?pid=3714&osvid=0&type=documentation

but now can`t access - values etc. Can see it but no access.

CAn anyone help? Perhaps wrong firmware or OTA update went wrong. However latest firmware detected.

Also Xbee AIO adpater now with following info:

[6fcb]!

00:13:a2:00:40:98:17:29!

end device

0x0301c105

Use to say Analogue Adapter.

Model no of zigbee: XBP24-Z7SIT-503J revF
DOB: 040512 05-52

Help! Long night ahead!

Cheers

Aidan

Its also a XBeePro S2 if this info helps.

regards

Aidan

Hi,

I have now tried to re-update firmware but get transmit error.

Sugar!

regards

So you have new hardware - that is good. You will require ‘atleast 2664’ firmware on that adpater. I have used this adapter (as example) with Omega RTD-to-mA converter without problem.

Hopefully your loop is wired correctly - I would add setting P3 = 5 to your code, plus set the correct DIP switch on the bottom to enable pin #6 to output 12vdc 50mA. Then run terminal #6 to your ‘+’ on the 4-20mA tranducer, and run the ‘-’ to pin #1. Thus your current flows from pin 6 (as source) to your sensor, then returns to pin #1 (the ‘input’), which uses a precision resister to ground (which is pin #5 but this is hidden from you!). So the AI adapter is really just reading the voltage drop across the precision resister.

Since the result in binary, you’ll find it easier to do something like this (I have a ‘def’ I cut-n-paste into code).
__print ‘sample(%d)’ % len(sample),
__for by in sample:
____print ‘%02X’ % ord(by),
__print

The first byte must be 0x01 or you are not seeing an ‘IS’ response. That is as documented in the ‘XBee Analog and Digital IO Lines’ and the ‘ZigBee IO Data Sample Rx Indicator’ sections of the manual. I can’t say why your response seems wrong - only stating the theory.

Assuming you have 2 ADC enabled, you should be getting a 10 byte binary response.

sample[00] = 0x01 always
sample[01-02] = the bit mask of enabled DIO lines
sample[03] = the bit mask of enabled ADC lines (0x03? in your case)
sample[04-05] = the DIO lines values, which should NOT contain any ‘1’ bits not also set in the DIO mask
sample[06-07] = ADC#1 value, 0-1023
sample[08-09] = ADC#2 value, 0-1023

The current loop formula would be:
mV = raw_value * 1200.0 / 1023
mA = mV / 51.1 (which is AIO_LOOP_R_OHMS)