The Scribbler Robot represents a great value to the robotics enthusiast. It's affordable and comes completely assembled with a built-in Parallax BASIC Stamp 2, drive motors and a host of on-board sensors. It comes preprogrammed with seven simple routines to demonstrate its sensors and motors. Software and a serial cable are included so it can be programmed in PBasic and it offers a simple GUI that lets children use it to draw patterns on paper as it rolls along. Although it has been used in a few introductory college courses, I believe that Scribbler has been largely dismissed as a "kiddie" robot. It is similar in many ways to its popular kit-based brother, the Boe-Bot, except that the Scribbler's sensors and I/Os are hard-wired. It is just as programmable and a good match for this project.
For Phase 1 of this project, we'll use a TV remote control to drive and steer Scribbler around, and track toward the remote control beam. This is great fun and only requires an infrared remote and an hour of programming; no robot modifications are necessary. In Phase 2 we'll build a simple charger that Scribbler can locate and dock with using its on-board sensors. This will require minor robot mods and some electromechanical construction, but I have kept things as simple as possible so that you can get similar results. I'll call out the specific items I used so you can duplicate my hardware if desired.
There is a wealth of online information on programming Scribbler and BASIC Stamps, and much of the programming info written for Boe-Bot applies to Scribbler as well. Andy Lindsay, who works in Parallax's education division, is a genius, and his books "What's a Microcontroller" and "Robotics with the Boe-Bot" are required reading for any robot enthusiast. The links below provide the information that we hunger for.
BASIC Stamp Editor download:
www.parallax.com/tabid
Infra-Red (IR) with the Boe-Bot:
www.parallax.com/Portals
Robotics with the Boe-Bot:
www.parallax.com/Portals/0/
What's a Microcontroller?: www.parallax.com/Portals/0/Downloads/
STEERING
Like many more expensive robots, Scribbler's differential drive isn't perfect. Electromechanical variations between the two motors, fluctuating battery voltage and the lack of wheel encoders all can cause each wheel to turn at slightly varying rates, so the robot's software must be periodically recalibrated to go (mostly) straight. It will generally tend to steer left or right somewhat, and perhaps not consistently. Fortunately, the robot can still track to an IR source using its IR sensor. Further, it can distinguish between multiple IR sources, so Scribbler could consistently navigate from A to B to C with line-of-sight restrictions. The single IR sensor senses the presence of an IR signal, but not its direction. As a result, our simplified tracking routine is as follows:
signal detected = drive forward, signal not detected = turn until signal detected
IR REMOTE
Scribbler reads IR control pulses on a carrier frequency of ~39 kHz. Low intensity signals (like our charger beacon) have line-of-sight restrictions, while most remote controls emit high energy signals that reflect off walls and ceilings for thorough coverage in a room. We'll control the robot using SONY television IR codes. You'll want a nice big universal remote configured as such for several reasons. First, you want large buttons for good control ergonomics. Ideally, get one with control buttons styled as four obvious directional arrows: forward, reverse, left and right. Next, you need to broadcast a strong IR signal that the robot detects easily through its tiny forward-facing aperture. Finally, we want a strong TV remote IR signal to significantly overpower our charger beacon's continuous low-intensity signal. I used Radio Shack Remote No. 15-2142.
PROGRAMMING
LedCenter PIN 9
LedLeft PIN 10
Speaker PIN 11
MotorRight PIN 12
MotorLeft PIN 13
ObsTxRight PIN 14
ObsTxLeft PIN 15
LightCenter PIN 1
LightLeft PIN 2
LineEnable PIN 3
LineRight PIN 4
LineLeft PIN 5
ObsRx PIN 6 Stall PIN 7
Now you can drive the robot around with the IR remote buttons shown in the diagram. This program monitors the wheels' stall sensor on pin 7 and tries to stop the robot if it hits something. This sensor is most reliable at full speed. If you run the PBasic editor with the robot hooked up to your serial port, the IR command codes received will display in a DEBUG window. Use these codes to modify the software to use different buttons if desired.
You'll also need to calibrate your robot's straight-line driving ability by changing the numbers in the "fwd" and "bwd" subroutines. Their pulsout commands drive the left motor (on pin 13) and right motor (on pin 12). Values are 3000 for full speed forward, 2000 for stop, and 1000 for full speed reverse. Proportional numbers give proportional speeds. Ideally, pulsout 13, 3000 and pulsout 12, 3000 would drive the robot straight forward. But if your robot curves left, you need to slow down your right motor. In this case, you might try pulsout 13, 3000 and pulsout 12, 2900 then adjust as necessary.
TRACKING IR
The most interesting aspect of this program is having Scribbler follow your IR remote beam. Press the MUTE button, and the 3 green LEDs light to indicate TRACKING mode. It drives forward any time it senses a MUTE signal. When no MUTE signal is detected, the robot circles left. The remote's intense IR signal overwhelms Scribbler's IR sensor unless you point it away from the robot. Press & hold MUTE while you lead the robot around the room by aiming the remote at the floor or wall. Different features around your room will reflect the IR beam differently, and it is interesting to see how sensitive your robot is to the reflections. Your remote will "time out" after 30-60 seconds of holding the mute button, so release and press again. Pressing the STOP button will end tracking mode, as will a motor stall condition.
To make the robot track directly toward your remote, you must reduce the intensity of the IR signal. The easiest way is to cover your remote's IR LED with a layer or two of black electrical tape and poke a small hole in it. Of course, you'll have to trigger tracking mode by pointing your reduced-output remote directly at the robot's IR sensor.
PHASE 2
CONFIGURING THE CHARGER
Charger IR Beacon
You can adjust the LEDs' series resistors to suit your environment. I got a detection range of 10+ feet using 82 ohm resistors. Lower resistances emit stronger signals that can be tracked from farther away, but they may reflect off various surfaces and give false signals. Scribbler will use the PBasic COUNT command to identify your particular beacon, so you must calibrate your software to recognize your beacon signal. Once your beacon is working, aim your Scribbler at it while attached to the serial port and run this one-line program to view the pulse rate of your particular beacon.
aaa:COUNT 6,15, B0:DEBUG ? B0:GOTO aaa
My beacon's pulse rate was 18-19. Your exact values may be different, but the important thing is that your results should be steady, not varying by more than +/- one unit. You'll use this range of numbers to calibrate your tracking software.
If you don't have access to a frequency counter to adjust the pot to 39 kHz, you can try the following procedure, assuming that your beacon is built and functioning properly otherwise: run that same one-line program above, which counts the IR pulses received. With your Scribbler connected to your PC and the DEBUG screen displayed, let your robot see the working beacon and adjust the beacon's 10K trimpot until you see numbers displayed in the DEBUG window in the range of 15-24. Adjusting the pot won't change the values displayed, but will tune the beacon's carrier frequency to match the robot's IR sensor. Find the pot's range of adjustment that works, and center the pot in this range.
If you're familiar with 555/556 circuits, notice the 1N914 diode between pins 1 and 2. Without it, the modulation duty cycle is 50% and Scribbler's IR detector can't see it for more than a second. The diode drops the duty cycle under 50%, which Scribbler can continuously detect. I lost sleep figuring that out!
No comments:
Post a Comment