Xbee PRO DIO single wire sensor problem

Simple newb question:

I have a sensor with a single 0-6v dc output attached to terminal 2 of a XBee Pro DIO.

As the the voltage changes i do not see the following sample value change:

I was expecting 1 0 at some point for the first 2 values (not 1 1 ) at the voltage cycles through its range, but the adapter does not signal a change at any voltage.

Here is the test code , modified from digital_example.py.
What am i missing ?

The XBee Digital Adapter’s 802.15.4 64bit address

Modify the destination to match the digital adapter’s address

DESTINATION = “[00:13:a2:00:40:56:19:68]!”

Create a sensor object #1

chan = 1
digital_sensor = xbeedin.XBeeDIN(DESTINATION)

Configure the digital sensor for input mode on channel 1

Note: The channel numbers start at 0. Channel 1 refers to terminal 2

digital_sensor.configure(chan, xbeedin.Input)

Print the results

print “Adapter confirmed type is %s” % (GetXBeeProductName(XBeeDigitalIOAdapter))
print digital_sensor.channels
print

Retrieve a sample from the digital sensor

value = digital_sensor.XBeeCommandGet(“is”)
sample = digital_sensor.sample(chan)
print "Channel “,chan,” sample is ", sample
print "Channel “,chan,” value is ",value
print “%d %d %d %d”%(ord(value[0]),ord(value[1]),ord(value[2]),ord(value[3]))

Telnet Session image for previous thread

Starr,

To verify this is not a coding issue, I would recommend following the steps outlined at http://www.digi.com/support/kbase/kbaseresultdetl.jsp?id=2180

Thanks for that info - the device appears to be polling in analog mode.

UART Data:

On the receiving XBee the module has to be set up to receive the incoming RF packets over the UART. By setting ATIU=0x1 the receiving module will output the incoming serial data to the UART for you to read.

1.) now, in python, how do i read the entire UART buffer into memory ?
2.) do i need PWM mode ? i dont have an oscilloscope handy…

ATIS gives me only 4 bytes, now: 1 3 222 0 instead of 1 1 223 0

The following Python test program is a quick and dirty attempt to decode a single value from a one-wire sensor using Python …
I see that I’m missing a sample_io/parseIS conversion step but cant seem to find the example in code that im looking for…What am I missing here ?

HERE is what I have …

###############################################################################

MODIFIED FOR 1-WIRE sensor TEST digital_example.py

###############################################################################

Make known the zip file

import sys
sys.path.append(“WEB/python/DigiXBeeDrivers.zip”)

Import the necessary library from the zip file

import xbeedin

Import the zigbee library for ddo_get_param function

import zigbee
from xbeedevice import *
from xbeeprodid import *
from sensor_io import parseIS

The XBee Digital Adapter’s 802.15.4 64bit address

Modify the destination to match the digital adapter’s address. OK.

DESTINATION = “[00:13:a2:00:40:56:19:68]!”

Create a sensor object #1. OK.

chan = 1
digital_sensor = xbeedin.XBeeDIN(DESTINATION)

Configure the digital sensor for input mode on channel 1

Note: The channel numbers start at 0. Channel 1 refers to terminal 2. OK.

digital_sensor.configure(chan, xbeedin.Input)

Trying to read prototype light sensor analog output as dc volts (+0 - +6v DC)

HELP --------------------------------- begin

Print the results: DIO adapter detected OK.

print “Adapter confirmed type is %s” % (GetXBeeProductName(XBeeDigitalIOAdapter))
print digital_sensor.channels
print

FROM http://www.digi.com/support/kbase/kbaseresultdetl.jsp?id=2180

Try set Xbee PRO DIO Adapter to analog read mode…

Results: (Retained in firmware after power cycle. From LED’s, Appears to work OK.)

digital_sensor.XBeeCommandSet(“a1”,2)
digital_sensor.XBeeCommandSet(“d1”,2)
digital_sensor.XBeeCommandSet(“ir”,0xe)
digital_sensor.XBeeCommandSet(“it”,0x5)

UART Data:

On the receiving XBee the module has to be set up to receive the incoming RF packets over the

UART. By setting ATIU=0x1 the receiving module will output the incoming serial data to the UART for you to read.

digital_sensor.XBeeCommandSet(“iu”,0x1)

Verify analog mode was set. Results: OK.

value = digital_sensor.XBeeCommandGet(“d1”)

print "Channel “,chan,” D1 value is ",value

print “%d”%(ord(value[0]))

Retrieve a sample from the digital sensor using ATIS…

Results: Only 3 chars in sample + 0 when viewed as ‘self’ base type. (I am getting the Tuple only?)

value = digital_sensor.XBeeCommandGet(“is”)
sample = digital_sensor.sample(chan)
print "Channel “,chan,” sample is ", sample
print "Channel “,chan,” IS value is ",value
print “%d %d %d %d”%(ord(value[0]),ord(value[1]),ord(value[2]),ord(value[3]))

Try to read value directly…

Fail. meaningless.

value = digital_sensor.XBeeCommandGet(“a1”) ## AD1 'unsubscriptable ’ type is Null here if AD1 used directly
print "Channel “,chan,” A1 value is ",value
print “%d”%(ord(value[0]))

HELP ----------------------------- end

HERE is what I Need …

Cannot see an example of how to : read the UART using only a DIO Adapter (not the LTH sensor examples provided in DIA /xbee_sensor.py)

1.) Is there a quick and dirty way to test without writing a new driver from scratch?

e.g. I need the equivalent of this, inline, as a quick test, without using base classes:
from DigiXBeeDrivers.zip/src/xbee_sensor.py

# Parse the I/O sample: 
    io_sample = parse_is(buf) 

    # Calculate sensor channel values: ## only light is sensed now, on channel 2/AD2 
    light_mv, temperature_mv, humidity_mv = \ 
        map(lambda cn: sample_to_mv(io_sample[cn]), ("AD1", "AD2", "AD3")) 

    # 
    # handle the light value - ## I just need Volts DC here (mV is fine) 
    # 
    light = round(light_mv,0) 
    if light < 0: 
        # clamp to be zero or higher 
        light = 0 
    self.property_set("light", Sample(0, light, "brightness")) 
    if do_trace: 
        msg.append( ", %d brightness" % light) 

Thanks in advance for your help with this simple engineering challenge (!) …