XBee Direct I/O with ADC

XBee radios can now record and output multiple channels of digital and analog data without using microcontrollers. The latest firmware (version 10A1) supports up to seven channels of analog input, nine channels of digital I/O and two channels of analog (pulse-width modulation) output. These will be great for creating small sensor modules or miniature output modules with low power and very low complexity.

Andrew Schneider and I cobbled a couple experimental modules together last weekend, and I recreated them for a demonstration to my Project Development Studio class. Here’s the presentation on XBee Direct that I gave to the class. Firmware updates can be performed with MaxStream’s X-CTU software, and you’ll certainly need to do this if your XBee’s were purchased before 2007.

Direct I/O should be considered for wearables, remote controls, toys, covert sensors, computational jewelry or anything airborne. Photos of the input and output circuits are below, along with the AT commands for this setup, with one analog (potentiometer) and one digital (switch) input, and the corresponding outputs (motor & LED):

ATID3456 –> PAN ID
ATMY1 –> my address 1
ATDL2 –> destination address 2
ATD02 –> input 0 in analog mode
ATD13 –> input 1 in digital in mode
ATIR14 –> sample rate 20 milliseconds (hex 14)
ATIT5 –> samples before transmit 5
ATWR –> write settings to firmware

ATID3456 –> PAN ID
ATMY2 –> my address 2
ATDL1 –> destination address 1
ATP02 –> PWM 0 in PWM mode
ATD15 –> output 1 in digital out high mode
ATIU1 –> I/O output enabled
ATIA1 –> I/O input from address 1
ATWR –> write settings to firmware

Input Module with Potentiometer and Switch

Output Module with Vibrator Motor and LED

178 Comments on “XBee Direct I/O with ADC

  1. When I consult the analog input AN1 of my Xbee. The value you get is 02 AD
    . How I can interpret this hexa value?. As I can stop volts?.


  2. Hello Falaudi,

    i read your articles, they are impressive, i also have a problem can you answer it?

    its stated in digi international and maxstream modules that these can directly transmit and recieve RS485 data. How can it be done? I just want to remove cables going from plc’s to the machineries and vice versa. Along with RS485 data there are a few digital input and output cables which also need to be eliminated. Is it possible? and is it possible in one zigbee module at one end? how? and what pins shall i give data+ and data- of zigbee devices? please publish some schematic for this and what will be the software and harware requirements for this?

    you can mail me if you wish to.


  3. hey Falaudi,

    Dont you think there is some bug in the above experiment?
    Or maybe i didnt get it properly, please guide me.
    In the above experiment, i am trying to send analoge signal to AD0(pin20) from sender xbee and recieving at pin 20 at base xbee, but i am not able to get any pwm output. I have properly configure both the radio modules, have tried with digi series1 version 10A5, 10E6, and 10EC all but cant get the output at base pin. Whereas, i can read the hex data at terminal, but this tutorial says we can get pwm output and even digi says on their site we can get pwm out and convert to analogue by placing a capacitor accross.
    I have done all the harware properly, vref to vcc etc. believe me there is nothing wrong with the connections etc. seems like this cannot be done..
    Please answer asap where am i wrong?

  4. Hello Mr Faludi,
    I have been doing some research on my project area (wireless servo control with Xbee) and routinely land on your reference material.

    I have been working on trying to control a micro servo wirelessly. I have figured out how to do this with XBee radios (series 2) and Ardunio UNO hardware. That solution worked fine for initial demo. However, I am trying to reduce the physical footprint and power consumption at the receiver end (location of the servo). I tried using an ATtiny85 in place of the Arduino UNO, but found the 8-bit processing caused too much jitter. I have recently tried using the XBee (series 1) Direct I/O and PMW output capability due the small footprint and low battery usage. However, my servo is not responding correctly to input. I am testing using DIGI input/output examples with simple ADC conversion of potentiometer attached to transmitting XBee D0 (ATD0=2; ATIT=5; ATIR=14; ATIA=FFFF; ATID, ATMY, & ATDL set appropriately) and micro servo attached to receiving XBee RSSI/PWM0 (ATP0=2). The setup works for controlling the brightness of a LED with the potentiometer, and the servo does indicate it is getting some signal, but not moving much.

    I am thinking the XBee radio PWM output voltage is too low to drive a micro servo. Any recommendations for me would be greatly appreciated.

    Thank you

    • You will want a external microcontroller (or the Programmable XBee) to interface with a servo. The XBee’s PWM output modulates the pulse frequency, while a servo is typically controlled by modulating a pulse’s duty cycle. More here.

      • Thank you for the quick response. I understand your reply.

        My interpretation, the XBee is converting an analog input to a varying pulse frequency; where as, I need the frequency to be steady (e.g. 50hz) with a modulated pulse width (duty cycle) based on the analog input.

        I have thought about configuring a micro controller (e.g. arduino) to generate the servo PWM signal and then send the generated pulses over XBees (e.g. direct wireless communication) without signal manipulation.

        I have been looking for an example of this, but haven’t come across one. All the ones I have come across use micro controllers at the servo end or as you point out are doing frequency modulation vice duty cycle. Are you aware of some resources that you can point me to?

        Thank you

  5. Hi experts,
    I need to control an LED on Pin 18 (D2) in the remote Xbee (End device) from a coordinator Xbee communicating to it.

    I was able to make LED ON(glow) on the coordinator device using the AT command(ATD2 5), but i didn’t get any reference on ON/OFF an LED connected to remote Xbee by using commands sent from coordinator Xbee

    Any help on this would be appreciated.

    Thanks in advance.

  6. Hi Rob –
    Absolutely love your book and have read it cover to cover. I’m interested in Direct IO but have a specific project in mind. A wood-working friend has a large wood-working shop. When working he puts his iphone in a small office area so he doesn’t know when it vibrates or rings or someone is contacting him. My intent is to setup a “notification light” that his phone is ringing. I imagine the following project but would like to attempt it with no micro-controller.
    – use Peizo sensor SEN-10293
    – attach Peizo to old iphone box
    – have friend put iphone in box
    – when phone vibrates use peizo to detect vibration
    – wire peizo directly to Zigbee COORDINATOR (Series 2 ZB) to cause signaling event
    – wire LED’s to 2-3 other ROUTERS (Series 2 ZB) to blink “on” when peizo activates

    Is this setup possible or am I making it harder on myself than necessary? I think the sensor below is analog output and am unsure about the hook up there.

    thanks – am very interested in xbee direct for now want to see how far I can take it.

    • Sounds doable but you might want a microcontroller to smooth the output of the piezo sensor rather than simply linking the input to an output. Certainly try it that way first and see how it goes, but plan on incorporating a microcontroller like Arduino if you don’t initially get the results that you want.

      Glad you liked the book! Thanks.

  7. Hello Sir, I am using XBee S2 for my project. While configuring the device i am not able to change the ATIT and ATIR values as you have done. What could be the reason. Guide me.
    Thank You.

  8. Hi sir! I am using a Xbee S1 and i’m trying to use two for direct io. I have problems with the DIO6 and DIO7. I switched them to Digital output low (4) and then when i use the transmitter radio (power it up), the values of the DIO6 and DIO7 remained constant. What could be the problem? THanks.