Search This Blog

Wednesday, 22 April 2015

Getting XBee comms up and running between a Raspberry Pi and Linux


  • Useful instruction on configuring XBee without the X-CTU program (Windows).  Make sure that the XBee on both ends is 9600 baud (it should be by default).
  • Set up minicom on the Pi and on the PC.  Make sure that serial port is set up as  9600 baud, 1N8 w. no hardware flow control.  Now typing in one minicom window will echo in the other.  Hey - we've got wireless comms!
  • Let's do this programmatically.  With minicom up and listening at one end, let's use python on the other.

#!/usr/bin/python
import serial
import time
connection = serial.Serial("/dev/ttyUSB0")
connection.baudrate = 9600
connection.setParity('N')
connection.setByteSize(8)
connection.setStopbits(1)

while True:
  time.sleep(5)
  connection.write("hello\n")


  • Well, that seems to work ok!  

No comments:

Post a Comment