Serial connection between Raspberry Pi and Roomba

microcontrollerraspberry piroboticsroomba

I have a Raspberry Pi with this FTDI cable and a Roomba 560. The Roomba has an SCI port to allow for control of the roomba via serial. I installed the PySerial library on the pi and send valid commands to Roomba, but the roomba doesn't respond. I have the TXD of the cable attached to the TXD of the roomba, the RXD on the cable wired to the RXD on the roomba, and a ground on the cable wired to the ground on the roomba (everything in it's respective port). I do not have power going from the cable to the roomba or vice-versa.

What I can't figure out is why the commands aren't working. There's no error message upon running the python code. This is the information sheet for the Roomba's SCI port.

Code:

import serial

ser = serial.Serial('/dev/ttyUSB0')
# this is the defualt Roomba baud rate
ser.baudrate = 57600

# Start SCI - puts into safe mode
ser.write(chr(128))
# Enable full mode
ser.write(chr(131))
# Spot clean
ser.write(chr(134))

print 'Done'

Best Answer

Sounds like you have the Pi and Roomba both talking on the same wire, and both listening on the other wire.

Connect the Pi's TX line to the Roomba's RX line, and vice versa.

First rule for troubleshooting serial communications: Swap connections on pins 2 and 3!