This paper describes an autonomous, light-seeking (phototropic), mobile robot. The robot was used for a robotics demonstration at a Community College. Components common in the amateur robotics industry were used, such as a Parallax Basic Stamp microcontroller, servomotors and wheels from a Radio Control (R/C) model, a servo control chip, and a CdS photoresistor and potentiometer. The robot was assembled using duct tape, Velcro, and rubber bands. No soldering was required. Electrical connections were made using the wire-wrapping method. A full listing of the control program is included.
This mobile robot was developed to serve as a demonstration at a meeting of the Technology Club at the Seattle Central Community College. The club had a desire to become involved in robotics, and was making their first step by inviting us to introduce them to the industry (sport? Vocation? Avocation? All-consuming compulsion?) Initial discussions within the club were tending toward mind-numbing complexity. We were informed that there was the impression that robotics was exceptionally complex, and required state-of the-art machining and electronics capabilities. By combining components readily available in the amateur robotics and R/C hobby industries, we hoped to counter that impression and show the students that a capable mobile robot could be constructed with ease. The result was a light-seeking mobile robot called "PhotoBot". PhotoBot is assembled using duct tape and Velcro, and involves no soldering. The only tools needed are an X-acto knife, a small phillips-head screwdriver, scissors, and a wire-wrapping tool with associated wire.
It has been my experience that students at this level that want to become involved in robots seem to have confidence in their ability to write software, and dont have too much inhibition in that area. Usually, however, they have very low confidence in their ability to make something mobile using motors, wheels, and batteries. The PhotoBots simple construction was an attempt to demonstrate how simple the vehicle part of a mobile robot could be. The robot was assembled by the students during the seminar.
Our demonstration was apparently successful, as now (three weeks later) all the members of the club have completed a Cybug (www.robotstore.com), and are anxious to continue on with their next robot project.
Figure 1: The PhotoBot. Note the big potentiometer knob to the left, and the CdS "eye" (the small white circular object facing forward). The servo pots removed from the servos during hacking are strapped underneath.
The robot consists of: a Parallax Basic Stamp 2 on a carrier board (www.parallaxinc.com), two hacked servos with wheels, a battery pack for the servos, a 9V battery for the stamp, a CdS cell, and a 10K potentiometer. In addition, a Ferrettronics FT639 chip (www.ferrettronics.com) is used to provide the square-wave signal for the servos. This chip is optional, as the Stamp itself can be programmed to provide the square wave signal. It does, however make servo operation easier and we now tend to use it whenever we use servos with a microcontroller. There are also several LEDs mounted on the carrier board, used to track the active subroutine. These are not necessary for the operation of the robot, but they do look cool. A length of 18AWG wire is bent to form a tailskid, and a couple of rubber bands hold the Stamp carrier board on top of the servo battery pack. Keep it simple.
To fit within the time constraints of the demonstration at the college, the carrier board was pre-wired. The FT639 was in place, as well as the LEDs. Also, one of the servos was pre-hacked, leaving one to be operated upon during the demonstration. The wheels and servo control horns were pre-assembled units. The software was complete, tested, and loaded into the Stamp.
Figure 2: Top View
The Basic Stamp is located in the center of its carrier board. Just forward of the Stamp, a portion of the (white) FT639 chip can be seen. It is partially obscured by the white/red/black wires from the servos. The potentiometer knob that is used to adjust the CdS system for ambient light is to the right. LEDs and their associated resistors are mounted on the left side of the board. The 9V battery extends out the rear (bottom in this photo).
Two Hobbico CS55 Deluxe servos (www.towerhobbies.com) provide motive power. These particular servos were chosen for their ease of hacking. In these servos, the feedback pot is held inside the case with a couple of small screws, which can be easily removed. There is enough wire length available such that the pot can be relocated outside the case, which is a great convenience. There is a small plastic clip that retains the pot shaft in the output gear. The clip can be removed using a little leverage from the X-acto knife. (In fact, if you want to, the clip and the pot can be replaced, thereby "un-hacking" the servo.) The knife is also used to cut the stop off the output gear. In order to make the servos stop rotating at a particular (square) wavelength, the signal can be provided to the servo (via the white wire), and the pot adjusted until the servo stops rotating. Thereafter, adjusting the wavelength will cause the servo to move in either direction. Those that have struggled with finding the "centered" position with repeated software changes (for each and every hacked servo) will appreciate the convenience of this feature of the CS55. For a more generic method of modification of servos for continuous operation, see the Encoder article by Kevin Ross (www.seattlerobotics.org/guide/servohack.html).
Sometimes the most frustrating thing in making a mobile robot is the mobility, and in particular the wheels. It is important to find wheels that roll well on many surfaces, are simple to attach, and easy to construct. The wheels and tires on the PhotoBot are DuBro 1.75 inch model airplane wheels. Wheels like these are available at most hobby shops, or through mail order at (www. Towerhobbies.com). Supplied with each new servo is a selection of angular and circular cranks, called "control horns" in the R/C industry. These fit on the splined output shaft of the servo and provide a connection with miscellaneous rods and clevises used in R/C cars and airplanes. They are held in place on the servo shaft by a short phillips-head set screw that screws in the end of the shaft. For the purposes of a robot, however, you will find the circular horns useful in that they are about the same diameter as the wheel rim. Fastening one to a wheel, with the horns center hole concentric with the wheels center hole, provides an easy connection with the servo output shaft. Before gluing, drill the wheels center hole larger to allow the head of the set screw to pass through. We used the adhesive "JB Weld", available in most hardware stores, to hold the servo horn onto the wheel. The connection can also be made mechanically, by drilling holes through the wheel (not the tire!) and using thread or thin wire to "sew" the horn onto the wheel. Once fastened, the assembly can be placed on the servo shaft, and the set screw inserted through the (larger) wheel center hole.
The two hacked servo "propulsion units" are placed bottom-to-bottom, with lengths of duct tape along their sides to hold them in that position. With the wheels attached, the entire propulsion system is complete, waiting only for voltage and a square-wave command. Such is the beauty of hacked servos. A pad of self-sticking Velcro is placed on one side of the servos (which is now the top). Onto this is placed a flat, 4-cell (AA size) battery holder. The mating Velcro is attached to the bottom of the battery holder. Typically, R/C servos are run at 4.8 volts supplied by four ni-cad batteries. However, the servos can be operated at the 6-volt level supplied from four alkaline batteries as well. Higher performance R/C airplanes routinely use the greater voltage to get quicker movement from the servos. I have not observed any great decrease in servo life using six-volt battery packs.
The Basic Stamp and its carrier board can be perched on top of the batteries, and held in place with elastomeric retention devices (rubber bands). Little robots like this one always seem to sprout lots of loops of wires and such, which makes them look as if they have a crown of spaghetti. I find that wrapping a simple rubber band around it all makes for a better coiffured machine. My daughter, Hannah, puts her hair in a "pony-tail" for the same effect.
For a tailskid, the heavy-gage wire can be secured to the robot by snaking it through the mounting lugs of the servos. Keep the easy things simple.
Figure 3: Rear view with the left wheel removed
In this view, looking at the rear of the PhotoBot, the robots left wheel has been removed and placed on the right to show the control horn glued to the wheel. In addition, the 18AWG wire used as a tailskid can be seen snaked through the servos mounting lugs. The 9V battery has been removed. The 9-pin connector for the cable to the PC is at the upper right.
Sensors, and the integration of sensors with the overall robot system, are challenging parts of robotics. Modern microcontrollers go a long way towards making things easier, but inevitably the interfacing of sensors involves some electronics. I have found Kevin Ross articles on basic electronics, published in the Seattle Robotics Society newsletter, "Encoder", to be of great value. Also, chapter 5 in the book "Mobile Robots" by J. Jones and A. Flynn (A.K. Peters, 1993, now in revision A) is devoted to sensors and is also an excellent source of guidance. The PhotoBot uses a single photo-resistor to sense light and dark. The photoresistor is connected to a pin of the Stamp using a voltage-divider arrangement with another variable resistor (potentiometer). Connections are made using the wire-wrapping tool. See section 5.3.1 of Mobile Robots or Kevin Ross Encoder article (http://www.seattlerobotics.org/encoder/)for good discussions about interfacing a photoresistor to a microcontroller. A second variable resistor is used on the PhotoBot in place of the single fixed resistor shown both in the book and in Kevin Ross article. Doing so will allow adjusting the light-sensing circuit to operate in a wide range of ambient light levels. We found this necessary because the light level in the room where the presentation was made at Seattle Central CC was unknown when we constructed the circuit. As you will see in the program, the software is arranged to illuminate an LED when the photoresistor "sees" light. By watching for illumination of the LED, the potentiometer can be adjusted so that the triggering level for the light-seeking behavior is just below the brightness level of the ambient light.
The battery pack of the PhotoBot consists of four AA size rechargeable alkaline batteries. If you havent gone rechargeable for your robots, you soon will. We have found the rechargeable alkalines, while having a higher initial cost, are a better value than NiCads. The battery holder is a flat 4-cell holder purchased from Radio Shack. For maximum simplicity, the red and black wires from the battery pack can simply be twisted together with the red and black wires from the servos. The PhotoBot shown here is slightly more sophisticated in that the wires from the battery pack terminate in the male portion of a standard R/C battery pack connector. This mates with the other half, which is in turn connected to two 3-pin headers on the Stamp carrier board. The connectors on the servos conveniently mate with standard tenth-inch headers, so these can be used on the carrier board to make connection with the servos very easy.
Figure 4: Coming right at you! This front view of the PhotoBot shows the wheels and servos on the bottom (with the two servo potentiometers trapped behind the rubber bands, topped by the battery pack, then the Stamp on its carrier board. The CdS "eye" is the smaller round object to the right of the larger white pot knob. The whole thing stands about 3 inches high.
The program for the Basic Stamp is written in a language called Pbasic. This is the language that comes with the Stamp, and it is a close relative to BASIC. A DOS-based editor is supplied with the Stamp, and can be operated on a very modest PC. The program for the PhotoBot is straightforward, and uses no programming "tricks". The primary behavior for the PhotoBot is to seek light by circling slowly. This is done by running one servo slowly, and the other only slightly faster. When light is "seen" by the "eye", the secondary behavior of "running to the light" takes over. The PhotoBot runs by setting both servos to fast forward. When PhotoBot loses sight of the bright light, it stops running and resumes the seeking behavior. Adjusting the pot to account for ambient light can cause the PhotoBot to chase after lights only slightly brighter than ambient. For demonstration purposes, we had the Bot chase a flashlight, but its also fun to watch the PhotoBot run after brighter objects around the room such as lamps, TVs, engineers wearing bright white shirts, etc.
In this program, the SEROUT commands are unique to the FT639 chip, which is connected to Stamp pin 0. The numbers in the brackets are position commands for the servos. Each position command consists of two 8-bit words. For example, [0,136] are two 8-bit words that command the servo connected to the FT639 pin 1 to go to the centered position of 128 (halfway between 0 and 256). To understand this, you need the secret codebook that comes with the FT639. Some other subroutines (setup, setpulse, setheader, and setactive) are also secret and are needed for the FT639. If you program the stamp to output the square-wave signal, these commands and subroutines will not be needed.
The subroutine "seeklight" is the basic behavior. In it, the left servo is started forward slowly, and the right servo more quickly, causing the Bot to circle. The embedded subroutine "look" is a loop that keeps checking the state of pin 7. On the PhotoBot, the CdS cell voltage divider is connected to pin 7. Without bright light on the CdS cell, pin 7 is "high" (voltage on the pin is slightly greater than 1.5V). When light shines on the cell, its resistance drops, and the voltage on pin 7 also drops below 1.5V. The Stamp will see this as a change of state of pin 7, and will branch to the subroutine "foundlight". This subroutine commands both servos full forward, and then loops to keep checking the state of pin 7. When the state of pin 7 changes back to 1 (because the CdS cell no longer sees bright light), the program branches back to the subroutine "seeklight", and resumes the seeking behavior. The "low" and "high" commands in the subroutines serve to turn the LEDs on and off, with the red one indicating the subroutine "seeklight", and the yellow one the subroutine "foundlight".
'Program: PhotoBot'This is the control program for the robot "PhotoBot". It uses the
'FT639 chip. Basic values are set with constants.
'The program assumes the servos can be adjusted to stop with the position
'command of 128 (i.e. the pot can be accessed)
'These constants are used by the FT639
pin con 0
baud con 16780
header con 108
pulse con 85
pause 5000 'wait 5 seconds
gosub setup 'these steps initialize the FT639
gosub setpulse '
gosub setheader '
gosub setactive '
'This is the main portion of the program.
gosub trimservos 'allows centering of servos - both big yellow LED's ON
gosub ledtest 'turns on all the LED's (just for fun)
gosub seeklight 'initiates slow turn - phototropic behavior
halt: serout pin,baud,[0,136,16,152] 'stop the bot
seeklight: high 14 'illuminates the red LED
low 15 'extinguishes the yellow LED
serout pin,baud,[12,135] 'starts L (no. 1) servo fwd slowly
serout pin,baud,[24,152] 'starts R (no. 2) servo fwd quickly
if in7 = 0 then foundlight 'pin7 changes state when light is seen
goto Look 'keep looking for light
foundlight: low 14 'extinguishes the red LED
high 15 'illuminates the yellow LED
serout pin,baud,[0,128] 'L (no. 1) servo fwd full
serout pin,baud,[31,159] 'R (no. 2) servo fwd full
if in7 = 1 then seeklight 'pin7 changes back to 1 when light is lost
goto runtolight 'keep running until pin7 changes
trimservos: gosub halt
high 11 'illuminates both large yellow LEDs
pause 15000 'now turn pots to stop servo movement
low 11 'extinguishes both LEDs
ledtest: high 11 'the high command turns on all the LED's
low 11 'and the low command extinguishes them
'Subroutines used to set up the FT639
setactive: serout pin,baud, 'sets active mode
setup: serout pin,baud, 'sets setup mode
setpulse: serout pin,baud,[pulse] 'sets pulse length
setheader: serout pin,baud,[header] 'sets header length
Parallax Inc. Basic Stamp (I or II) with software (www.parallaxinc.com)
Basic Stamp Carrier board with cable (for the real purist, this is optional, but it does make the job a lot easier) 9-V battery
Ferrettronics FT-639 servo controller (optional)
10K potentiometer (the Photobot used one salvaged from an old stereo)
Headers or plug strips (two three-pin sections, optional, to fit the servo connectors)
Battery holder for 4 AA cells
Four AA batteries
Two Hobbico CS-55 servos or equivalent
Two Du-bro 1.75 model airplane wheels
Six inches or so of heavy wire (18 AWG)
Wire-wrapping tool and wire
The robot described in this article, "PhotoBot", is a light-seeking (phototropic) two-wheeled mobile robot. It was designed to be assembled during a two-hour seminar at a community college, where it was hoped it would give students a more confident outlook towards mobile robotics. This hope was fulfilled.
The PhotoBot uses common amateur robotics components such as a microcontroller (the Parallax Basic Stamp), servos, airplane wheels, and a few electronic components. No soldering is necessary. The program for the Stamp is straightforward and is included.
Seattle, WA, USA