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
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 ?
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 (!) …