I've posted this on the main StackOverflow and was suggested to post this here:

By rule of thumb, I've searched at least 10 different sources for my question before coming here.

My question is: if I have a Raspberry Pi that is connected via UART communication to an Xbee with a connected analog sensor (say IR distance sensor), can I read the sensor data directly from the Xbee on the UART communication?

The only sources I can find only address an Xbee collecting the sensor data and then sending it over the RF signal to another Xbee. None of the sources seem to explicitly address the Xbee acting as an ADC for my Raspberry Pi target.

  • \$\begingroup\$ I don't see why you should not be able to do it. The Xbee reads the ADC, and sends the data to your Raspberry Pi over the UART channel. Of course, you need the appropriate software on both, the Raspberry Pi and the Xbee, to accomplish it. \$\endgroup\$
    – Guill
    Oct 27, 2017 at 8:34

1 Answer 1


To read analog (or digital) pins (ie. your sensor data) via the local serial port, send the appropriate D0, D1, D2, D3 command.

Example (Transparent Mode):
Snd: <guard>+++<guard>
Rec: OK
Snd: ATD0<cr>
Rec: 42 ( the data )

For API mode, wrap the Dx command in an AT frame.

  • 1
    \$\begingroup\$ Finally, Thank you! Data sheets seemed to show that but were rather unclear. \$\endgroup\$ Dec 13, 2017 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.