Home/Support/Support Forum/XBee Pro S3B with Raspberry Pi 2
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

XBee Pro S3B with Raspberry Pi 2

0 votes
Hello,

We got one of your XBee-PRO® 900HP Development Kits and the XBees work great when connected to PCs and using XCTU. I then tried to connect them to a couple Raspberry Pis to see if I can connect with them.

The information I'm getting from the net is that You should be able to read and write to the serial and access them this way. I hooked the hardware up this way:

https://sonyarouje.files.wordpress.com/2014/12/connection_diagram_bb.jpg

The Python code for the receiver is below:

#!/usr/bin/python

import serial

serialport = serial.Serial("/dev/ttyAMA0", 9600)
while 1:
x = serialport.readline()
print "%s" % (x)

The Python code for the transmitter is below:

#!/usr/bin/python

import serial

serialport = serial.Serial("/dev/ttyAMA0", 9600)
while 1:
serialport.write('L')

I'm new to Python, so I might have done something dumb here. If anybody has any suggestions on code or hardware I would appreciate it. A working example would be great too.

Thanks
asked Feb 19, 2016 in 3rd Party Python and API development in other Languages by SuperCad New to the Community (3 points)
edited Feb 19, 2016 by SuperCad

Please log in or register to answer this question.

3 Answers

0 votes
Hello,

You have written x = serialport.readline(), which could receive the data until '\n' or EOL is received on the XBee receiver module.So from Transmitter side you must have provision for EOL(end of line) character. Or you could specify the length of string in the argument.

Try for x = serialport.read(size=1) in this case to receive character 'L' from the transmitter.

Thank you.
answered Feb 22, 2016 by abhishekjp.ospl New to the Community (4 points)
0 votes
Thanks for your response. I did try that after I posted the question, but I'm still not getting any communication.

Do you have any other suggestions?
answered Feb 22, 2016 by SuperCad New to the Community (3 points)
0 votes
I got it to work with the USB, but my boss wants me to use the GPIO to interface with the XBee, which is still giving the same result. Does anyone have any other suggestions?
answered Feb 25, 2016 by SuperCad New to the Community (3 points)
...