Roomba control via a PC

Inside the Roomba and Scooba and more, Cool mods, Repair and Upgrades - including the all new iRobot Create Kit. Let's void that warranty baby!

Roomba control via a PC

Postby mfortuna » February 5th, 2006, 11:08 am

I found out about this list via the roomba group on yahoo. It's very nice to have multiple roomba resources on the web.

When I first heard about the OSMO/hacker I decided it was something I'd like to experiment with. I'm a telecom hardware engineer so the HW part of it is not a big challenge. The software part of it will be tough. I just finished a first round of driver software and I'm going to continue to add functionality as time goes on.

My equipment list is as follows:

1) A Parallax Basic Stamp on a USB developement board. This board has a 20 pin apps module carrier as well as a breadboard for prototyping. It connects to a PC via a USB port and has a built in USB to serial bridge. I decided to use the stamp based on past experience with an older stamp (the BS-1). The big limitation with the BS-1 is 2400 baud limit when I/O pins are used as a serial port. The Basic stamp I'm using (BS2SX) has 16 general purpose pins and can run a serial port at well over 100K baud.

2) A Parallax/A7 Bluetooth transceiver. This card is designed to plug into the Parallax developement board. It implements a simple serial port that connects to the BS2SX, it also has a few control pins.

3) A D-link DBT-120 USB to Bluetooth adapter.

4) Free Basic. A free basic compiler down loadable off the web.

5) A 7 pin mini din connector from Mouser electronics plus an old RC servo lead. Wired together these allow a BS2SX to Roomba connection.

First I'll describe the BS2SX software. This is a basic language that gets interpeted by the BS2SX processor. What the code does is wait for a command to come over the bluetooth serial port. It parses the command and issues it to the roomba. All commands return either data or an ack back to the PC via bluetooth.

The PC software lacks a user interface so I have been hard coding a couple routines. One reads and displays all roomba status and the other just displays battery status in a loop. The SW basically opens a serial port which is mapped by bluetooth to communicated to the BS2SX.

I have two roomba Reds, one was bought with a bad charging system. My battery routine when run on my good versus bad roomba clearly shows the battery is not charging on the bad roomba. It also got into a bad state were the charge number went to 65000 mah. I had to clear that by reseting the charge circuit, but it still doesn't charge.

So I have a good foundation for the future which includes commanding the roomba to drive. I plan on keeping it in safe mode so it will automatically stop when it encounters trouble.

I've already thought of some SW improvements. I had to add a delay between receiving data from the roomba and issuing a new command. The bluetooth module supports HW flow control so I may add this to prevent a command from being lost by the BS2SX.

Mike
User avatar
mfortuna
Robot Master
 
Posts: 4522
Joined: February 5th, 2006, 10:35 am
Location: NH

Postby mfortuna » February 5th, 2006, 3:13 pm

Other improvements I forgot to mention are running the Stamp and BT module power off the roomba and adding the provision to wake up the Roomba via its DCD pin. Right now I'm using a 9V battery.

Mike
User avatar
mfortuna
Robot Master
 
Posts: 4522
Joined: February 5th, 2006, 10:35 am
Location: NH

Postby THX-1138 » February 5th, 2006, 5:13 pm

:D Hello mfortuna! Welcome to this board, bit more dynamic than Yahoo's. Eitherway it's great to have someone like you into this forum, as you see we have a diverse amount of electronic enthusiasts that have groupped together in order to create various projects. We are talking about improving on iRobot's algorithms, situational awareness, Artificial Intelligence, Avatars, Security Robotics, etc. but all have a common ground and that is Roomba with it's hacker module. Please continue to contribute, ask questions and join into many of available ongoing discussions to the benefit of all interested.

Regards,

Nikolai :wink:
User avatar
THX-1138
Robot Master
 
Posts: 2802
Joined: June 23rd, 2005, 8:16 pm
Location: United States of America

Postby mfortuna » February 12th, 2006, 5:03 pm

Thanks for the warm welcome!

I did some more experimenting today (around a trip outside to snow blow, we are getting hit hard in New England).

I added some error checking in my basic stamp code, mainly with the intent to not hang the basic code running on the PC. The stamp now checks for a timeout from the roomba, a bad command from the PC, and a timeout from the PC.

I ran into my first annoyance with the stamp. It holds 4K instructions (which also includes strings) so I was annoyed to get an eeprom full error while trying to download code. Turns out the stamp's eeprom memory is broken into 8 equal segments. If you can't fit all the code in one, you have to create source code for each segment and link them together. The stamp jumps from segment to segment via a "run" command. It's kinda like a context switch and take about 400 usec.

After getting that fixed, I added a drive command and actually drove the roomba forward via bluetooth. I thought it would stop or not start if the bumper sensor was on but it turns out safe mode only turns off the roomba if it detects a cliff or wheel drop.

More experimenting to come!

Mike
User avatar
mfortuna
Robot Master
 
Posts: 4522
Joined: February 5th, 2006, 10:35 am
Location: NH

Postby guest1 » March 1st, 2006, 5:04 am

Would you mind posting some of your source code?
guest1
 

Postby mick » April 2nd, 2006, 7:45 pm

I tried using a basic stamp2 and am having problems with ther serial ports. Since the BS2 uses software UARTs, the concern is being able to read the multibyte responses quickly enough (on the read Sensor packet, to determine the bump sensor, as well as determine the distance/angle values to use for driving in a straight line.) Even at 19200 baud, iterative SERIN commands are not fast enough. Maybe multiple parameters on the same SERIN command would do the trick, but that requires more of the precious RAM space.

Another shortcoming is the EEPROM space as noticed earlier. Just an iterative bump sensor (which does not have the overrun problem since the bump sensor is the first byte in the sequence, and since the bytes don't come back until more than 5 milliseconds after the request is issued) the BS2 can do bump detection just fine at 19200, but takes 2/3rds of a Kbyte. For performance reasons it may be necessary to put both algorithms in the same 2Kbyte region, which might be a bit tight/may not fit.

Still looking at this.
Mick
mick
 
Posts: 4
Joined: March 29th, 2006, 5:55 am

Postby mfortuna » April 3rd, 2006, 1:16 pm

I didn't notice the request for source code. I'll post it when I get a chance.

I haven't done any robotic experiments since the weather improved, too much to do outdoors. The next thing I was going to work on was my drive command, including bump sensor detection.

I'm using a BS2-SX which can easily run serial ports at 57.6 Kbaud and up. It also has a faster processor than a BS2. I also have built a BS2 kit with the intent it would be part of whatever solution I came up with that could fit inside a Roomba or take up less space topside.

Mike
User avatar
mfortuna
Robot Master
 
Posts: 4522
Joined: February 5th, 2006, 10:35 am
Location: NH

Postby mick » April 3rd, 2006, 6:22 pm

PS2SX works at 57600? cool. I was confused when reading the specs which say it only goes to 9600 baud on the programming interface.
http://www.parallax.com/dl/docs/prod/st ... arison.pdf

Have you gotten the 2SX to work with the read sensor 26 byte command at 57600 with no drops?

Mick
mick
 
Posts: 4
Joined: March 29th, 2006, 5:55 am

Postby mfortuna » April 4th, 2006, 8:34 am

I've only done the 10 and 6 byte commands. They have always worked fine for me.


http://www.parallax.com/dl/docs/prod/stamps/web-BSM-v2.2.pdf

Table 5.94 lists the maximum baud rates for various stamps.

Mike
User avatar
mfortuna
Robot Master
 
Posts: 4522
Joined: February 5th, 2006, 10:35 am
Location: NH

Re: Roomba control via a PC

Postby mfortuna » June 28th, 2012, 6:42 am

My vague plan was to have the stamp simplify the interface between the PC and the robot, plus do some background tasks to free up the PC. This was 6+ years ago, it is safe to say I am not working on this.
Mike
Reds x 3, Dirt Dog, Disco (now a parts bot), Create, Scooba 350, and Security Dawg
Evolution Mint
User avatar
mfortuna
Robot Master
 
Posts: 4522
Joined: February 5th, 2006, 10:35 am
Location: NH


Return to Robotic Hacking

Who is online

Users browsing this forum: vic7767 and 143 guests