# Connecting a Raspberry Pi to a roomba via an FTDI cable

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'


It turns out that the statement in the Roomba SCI spec sheet about ports is either outdated or incorrect. The Roomba 5XX series (and 7XX series) uses port 115200 to communicate, and that's what was wrong.

Wiring: I wired the TXD of the cable to the RXD of the roomba (so the orange cable would go into port 3 on the roomba), and vice versa. I also wired the ground and that was all that was needed.

• Glad to hear it's working. Maybe post the final way your connector is wired so other people can reference it? – Guy Sirton Feb 10 '14 at 19:11
• I second that, I got a Roomba 564 (the pet version) and been meaning to hook it up to a Pi, so that info would certainly come in handy when I finally get around to it. – ThomasH Feb 11 '14 at 0:55
• I added how I wired it, it was just TXD to RXD/vice versa and ground. Nothing else is necessary. – Ian Hyzy Feb 12 '14 at 17:14

Try:

ser = serial.Serial('/dev/ttyUSB0', 57600)


(though from a quick look at the docs your way should work too).

A very common mistake is switching RX and TX. The TX from your board need to go into the Roomb'a RX. Given your note about connecting TX to TX you've almost certainly wired this wrong. TXD in your cable (JP1-4) is an output and needs to go into RXD in the Roomba which is the corresponding input. Looks like reversing these shouldn't cause any damage as your cable schematic shows a 100ohm resistor in series with TXD.

I see there's also a "device detect" input on the Roomba which seems to only be needed when the Roomba is "sleeping" but you may want to wire it to RTS so you can control it.

• I switched the two and it's still not responding. – Ian Hyzy Feb 10 '14 at 6:29
• @IanHyzy: Hmm. Something damaged is always possible but there are lots of other things that could go wrong. The two interfaces seem to be compatible though, both 5V TTL. You can try looping back TX to RX on your Pi and you should be able to read back what you've sent. That will test your code and your Pi. – Guy Sirton Feb 10 '14 at 6:41
1. Even though the port is automatically opened when the Serial object is created, make sure that is open using ser.isOpen(). If it is not opened, then open it with ser.open()
2. Try to add a small pause between the ser.write commands
3. Make sure you connected the ground to the correct pin. Maybe you connected it to pin 5 (on the roomba connector) instead on 6 or 7
• ser = isOpen() always returns True, I added a .1s pause in between each command (didn't seem to have an effect), and I have the cable grounded correctly. – Ian Hyzy Feb 10 '14 at 15:54