Page 1 of 1

RPi + Roostick to control Roomba?

Posted: Fri Nov 09, 2012 2:24 am
by mkopack
Hey gang...

After seeing the recent story on the front page about the RPi controlled Roomba, I decided to dust off my old 500 Discovery series, and my old USB Roostick+cable.

I installed PySerial

Then I hooked up the Pi, plugged the roostick+cable into the Roomba and into the Pi's USB Hub.

lsusb shows:

the Hub
3 "Standard Microsystems Corp" entries
The mouse
The Keyboard
and finally: "Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light"

Unplugging the roostick and running lsusb again shows that it's that last item in the list that is the roostick.

I threw together a little python test program, basically exactly what's in the Roomba SCI interface document:

Code: Select all

import serial

ser = serial.Serial(0, baudrate=19200,
# wake up robot
ser.setRTS (0)
time.sleep (0.1)
ser.setRTS (1)
time.sleep (2)
# pulse device-detect three times
for i in range (3):
       ser.setRTS (0)
       time.sleep (0.25)
       ser.setRTS (1)
       time.sleep (0.25)

Seems like no matter what I put in for the device it comes back saying it can't connect.

Looking in /dev, I see /ttyUSB0 show up when I plug the Roostick in... But trying to use /dev/ttyUSB0 as the port gives an exception "Port is already open" error.

Any ideas???

Re: RPi + Roostick to control Roomba?

Posted: Sat Nov 10, 2012 1:35 am
by mkopack
Ok, nevermind, got it working!

Here's a little test program that establishes connection, turns on a couple of the lights, and plays a tone...
(And Python is NOT my primary language, so I'm sure there's plenty to be done to make this better/easier...)

Code: Select all

import serial
import time

# main....
ser = serial.Serial("/dev/ttyUSB0",baudrate=57600, timeout=0.1)

# everything has to be sent as hex code bytes. So using the SCI programmer's 
# guide to get the decimal codes, convert to hex
# and put them in here with \x in front of each 2 digit byte to denote hex...

# make a song with some tones
#now play it.

My wifi adaptor, and webcam came in. Just waiting on the powered hub (should have arrived today, so probably tomorrow or Monday) and I should be able to start putting it all together into a little roving telepresence bot :)

Re: RPi + Roostick to control Roomba?

Posted: Wed Nov 14, 2012 6:20 pm
by doitnowlabs
Cool! I probably should have bought a RooStick too, but I'm too cheap for that. ;)

Re: RPi + Roostick to control Roomba?

Posted: Sat Nov 17, 2012 5:16 pm
by mkopack
Well, I actually found a full library for talking to Roomba over Python. ...

Looks pretty easy to control the Roomba via that...

I'm also trying to figure out how I want to do the control/interface... Was thinking maybe some sort of Web interface. Not sure yet... Also trying to figure out how I want to stream video from the webcam.