Download (direct link):
For best results, solder all connections and then use insulating electrical tape to cover any exposed wires. Wrap tape several times around each wire where it connects to each motor. This tape layer helps to keep the wires from pulling out.
To control the Rover, use your thumbs to push the switches back and forth. Release the switch, and it returns to its center, which is the off position.
When the switch is off, the motor that the switch is connected to stops.
Because you mount the motors in mirror image, to go forward (or backward), one motor turns clockwise and the other motor turns counter-clockwise. Rotate the switches on the wood or plastic so that you can press both switches forward with one motion to move the robot forward and press both switches backward to reverse direction.
Driving Miss Rover
After going through the setup in the preceding sections in this chapter, you can take your robot out for a spin. You steer Rover like this:
Make your robot turn by pushing one switch forward and the other switch back.
Press the switches to get the robot to move forward, go backward, or make turns.
term LinG - live, informative, Non-cost and Genuine !
Chapter 15: Cool Robot Projects to Amaze Your Friends and Family 339
The arrows on the wheels of the robot representation in Figure 15-10 show you the direction that you flip the switches to achieve the motion that you want. In this figure there are only two wheels; weíve added a caster at the front of our robot for balance, but the two rear wheels drive the robot and steer it, just as the two wheels in Figure 15-10 do.
HARD RIGHT TURN
HARD LEFT TURN
term LinG - live, informative, NDn-cDst and Genuine !
340 Part V: A Plethora of Projects
Giving Rover Some Smarts
You control the basic Rover, which you can read about in the previous sections, by wire. You can have some fun driving Rover around the den, but some folks would say you donít have a true ďrobotĒ because it doesnít think on its own. Well, you can add a brain to Rover with way less effort than you may think. All it takes is a few changes to the motors so that they can accept electronic commands, the addition of a sensor or two to tell the robot that itís run up against an obstacle, and a microcontroller to tell the robot what to do when it does hit a snag (or a chair, or a wall).
To program your robot, you need to use a microcontroller. At the heart of the Smart Rover is a BASIC Stamp 2 microcontroller. We introduce these puppies in Chapter 13. If microcontrollers are a new concept to you, you can go and leaf through that chapter to get a feel for them.
For this project we assume that you have plugged a BASIC Stamp 2 into a BOE development board. (For more about these two items, read the next section or head back to Chapter 13.)
Matting over microcontrollers
If you feel confident enough in your microcontroller knowledge to go on, we quickly recap:
^ A microcontroller is a computer in the form of a chip that you connect to your robot through I/O (input/output) ports. By downloading programs from the computer to the robot, you can literally control the robotís actions.
^ You program the microcontroller just as you program a desktop computer. You tell the microcontroller what to do, and it tells the robot.
^ You write this program on your PC and then download it to the microcontroller, usually through a serial or USB cable.
^ After you download the program into the microcontroller, itís stored in non-volatile memory, and here the program stays until you replace it with another program. The program remains in memory, even when you turn the power off and remove the batteries.
In Chapter 13, we discuss a nifty little microcontroller named the BASIC Stamp
2, from Parallax. This microcontroller was designed with the beginning robot builder in mind. The BASIC Stamp 2 is a 24-pin integrated circuit. You can use this integrated circuit right out of the box in your projects, or stick it into a
team LinG - live, Informative, Non-cost and Genuine !
Chapter 15: Cool Robot Projects to Amaze Your Friends and Family 341
development board, such as Parallaxís Board of Education (BOE) to allow you to easily experiment with the BASIC Stamp. Chapter 13 also describes the BOE in more detail, so check it out to get more background.
DC motors out, R/C servo motors in
Before you get to program a microcontroller, you have to use different motors so that you can control them electronically. The basic Rover that we describe in the first project in this chapter uses two DC gear motors. These motors work ideally for switch control, allowing you to readily change the direction of the motor just by flipping a lever. But these kinds of motors need a bit more circuitry before you can operate them electronically. Specifically, they need an H-bridge, which does electronically pretty much what mechanical switches do in the basic Rover.
We promise not to make you buy or build an H-bridge; instead, use two inexpensive (about $10 to $12 each) servo motors that are designed for use in radio-controlled (R/C) gadgets such as model airplanes. The BASIC Stamp 2 can operate these motors directly, without any additional circuitry.