28 Jun, 2006

Line following Roomba

Posted by crackerben 09:35 | Permalink Permalink | Comments comments (11045) | Trackback Trackbacks (2078) | General

The other day I was marveling at the efficient operation of my roomba when it occurred to me that it would be really nice if roomba would get me a beer. While gestating the idea my first thought was to have roomba follow a line to the fridge and back. And a short while after that I realized that roomba already had 4 downward facing optical sensors AKA the cliff sensors. I decided to hack them up and make them sense light/dark lines instead of cliff/no cliff. I haven't actually made the roomba get me a beer yet, I'm thinking of using a PIC to interface the roomba serially, and a 4066 switch IC to change between normal and beer retrival modes. Anyway I've shown here how to hack up your sensors as a first step. Enjoy!

 I found that the sensors are standard IR emitter detector pairs that are driven by a square wave. I also found through experimentation that a 100 ohm resistor in series with a 100 ohm 10 turn potentiometer soldered in parallel with the detector could provide usable adjustment to differentiate between carpet and a black tape. Below is the procedure I used.

1)      Remove the battery.

2)      Remove the 4 screws that hold the grey bumper cover in place, disconnect the connector in the middle of the bumper, and gently slide the grey cover straight up and off of the black bumper substrate.

3)      Determine what side of the sensor contains the photodiode. I’ve found 2 ways to determine what side the photodiode is on. The first way is to look at the bottom of the sensor; there will be a small circle on either end. The clear circle is the LED, and the dark circle is the photodiode or detector. The other method is to use a digital camera. Most digital cameras can see infra red light and therefore can see the light emitted from the LED (this trick also works with TV remote controls). In order to have all of the LED’s light the connector in the middle of the bumper must be re-connected, the battery must be installed and the power button must be pressed.

4)      Slide the shrink tubing up on the leads of the 2 outermost detectors, solder wires to them carefully avoiding short circuits.

5)      Replace the bumper cover, while routing the wires you’ve soldered out the top of the robot.

6)      Solder a 100 ohm resistor to a multi turn 100 ohm potentiometer. The ones I used are precision 1/2" wire wound style. I only used these because I had them lying around; digikey part number 490-2968-nd would be cheaper if you're buying pots.

7)      Attach the pots to roomba, I used 2 sided foam tape.

8)      In order to tune sensors turn both pots to one stop, power up roomba, and hit clean.

         If the roomba plays the blat tone turn bot pots to their other stop.

9)      When roomba plays its normal tune turn hit power to stop the robot and turn one pot a single turn the other way and hit start again, repeat until the robot plays it’s blat tune indicating the sensor is tripped. Then turn the sensor one and a half turns in the opposite direction.

      Repeat procedure with the other pot.

11   Your roomba should be ready to follow lines.

 As a side note he roomba wants to avoid crossing lines, but without external control it won’t follow a single line, instead 2 parallel lines a few inches wider than the roomba works pretty well (see photos)

 As another side note the light produced by the sensor assemblies reflects differently than normal light so some experimentation with different tapes is useful. The best result I’ve found have been from 2”  masking tape spray painted flat black.

 

Below is a link to video of the roomba in action.

 http://northridgerepair.com/plog/imgs/P1010037.MOV

 

 


28 Jun, 2006

Line following Beer fetching roomba part 2

Posted by crackerben 08:50 | Permalink Permalink | Comments comments (9831) | Trackback Trackbacks (400) | General

Last night I interfaced a parallax basic stamp 2e (I had a few lying around and they require no external hardware) with my roomba and began the process of teaching my roomba to fetch.

Below is the stamp code I have so far, it isn't pretty but it works. There is a whole lot of cleaning up and optimizing I still need to do. For this stage of testing I bypassed the potentiometers and have put 150 ohm resistors in their place. I still intend on using a 4066 switch IC to change the sensors mode between normal cliff sense and line detect.

Here is a rundown of what the stamp software does at this point-

Sets roombas baud to 2400 via the device detect line and a serial command
Sets roomba to passive mode
Monitors remote control input, breaks sub when right circle is pressed
Sets roomba to safe control mode, plays tune to indicate beginning of line following (beer fetch) routine
Starts a normal clean operation
Monitors cliff sensors while roomba cleans normally, sops roomba and exits on line/cliff detect
Enters full control mode and plays another tune to indicate line found
Moves roomba forward a few inches to (theoretically) pass the line between the two sensors.
Begins drive forward/check sensors loop-
If bump sensor is triggered roomba turns 180 degrees
If a line is detected roomba turns about 30 degrees and continues forward

Here’s the stamp program


http://northridgerepair.com/plog/imgs/ROOMBEER.BS2

And another video

http://northridgerepair.com/plog/imgs/P1010041.MOV