Chapter 13

Sensitive Sam Walks the Line

In This Chapter

bullet Getting the overview of all Sam can do

bullet Looking over the very cool (and somewhat complex!) schematic

bullet Arming yourself to deal with building issues

bullet Getting your shopping list in order

bullet Walking through the steps to make the circuit and assemble the cart

bullet Trying out Sam and taking things further

Okay, we have to admit this right upfront: This project is Earl’s absolute favorite in this whole book. Sensitive Sam is a motorized cart. You stick black electrical tape on the floor to create a little path or track for Sam, and Sam uses his sensors to follow the tape around corners and in interesting loops you devise for hours of fun. He also has a little horn you can blow (to warn the cat that he’s coming). What’s not to love?

In this chapter, you discover how to give Sam the “eyes” he needs to sense where he’s going and also how to build a radio remote control device to tell him what you want him to do. Although you’ll find lots of little components and connections going on here, don’t be intimidated; after you get going, we think you’ll find it’s a pretty fun project. (Earl did!)

The Big Picture: Project Overview

You’re probably wondering what this Sam guy looks like and what he’s capable of. Glad you asked. Here’s the low down on Sam, who

bullet Has three wheels: This design makes the cart stable. If you use four wheels, you need to include a suspension mechanism to ensure that all wheels stay in contact with the floor at all times. We use one unpowered wheel in front and two independently powered wheels in back. This way, if the motor for one of the wheels in back is shut off, the cart turns in the direction of the motor that was shut off (left or right).

bullet Sports two eyes: These eyes help Sam figure out where to go. Sam’s eyes — phototransistors pointed at the floor — sense infrared (IR) light that is sent out by IR LEDs and then reflected by the floor. By laying down a track of black electrical tape on the floor, you create an area that reflects less of the IR light.

We set up the circuit so that when Sam’s eyes hover over reflective floor, the motors turn. If one eye is over the black tape or other nonreflective surface — for example, where a bend comes in the tape track — the motor connected to that eye shuts off, causing the cart to turn and follow the tape. When the eye is back over the reflective floor, the motor turns back on, and the cart goes in a straight line again.

bullet Responds to a remote control: This remote uses radio waves to send its commands to Sensitive Sam. (This is the same technology that a key chain remote control device uses to open the doors on a car.) You can set the switches on the remote control to tell Sam to turn on/off, slow down or speed up, or honk the horn. When you flip a switch and press the transmit button, that effect kicks in.

Sensitive Sam is shown in Figure 13-1 in all his glory.

Figure 13-1: Our very own Sensitive Sam and his feline friend, Willoughby.

Figure 13-1: Our very own Sensitive Sam and his feline friend, Willoughby.

Here are the types of activities you’ll do in this project:

1. Put together the electronic circuit for the remote control transmitter and then fit the breadboard into a plastic box with switches.

2. Put together the electronic circuit that decodes the radio signal and controls the movement of Sam in response to his sensor eyes.

3. Mount the circuit onto a chassis along with DC motors, wheels, and a few switches.

In the end, you create a cart that follows a track all by itself and responds to your every command. It also has a cute little horn that you can toot.

Scoping Out the Schematic

You need to get your arms around two schematics to master this project. The first is the transmitter circuit that you use to send Sam his commands. The second is the receiver circuit that helps him understand what the heck you’re saying!

Transmitting Sam’s commands

You use the transmitter circuit to send signals to Sam to start, change speeds, and sound his horn. Here’s an explanation of what’s going on in this circuit:

bullet VR1 is a voltage regulator that takes the 6 volts supplied by the battery pack and supplies a steady 5 volts instead. We added this because although the IC specs say it should work with 6 volts, it blew out the first time we tried using 6 volts. Better safe than sorry!

bullet The transmitter module sends out a radio signal at 433.9 MHz that’s modulated with the code provided by the encoder.

bullet IC1 is an encoder. The radio signal that the remote control sends out is modulated, depending upon how you have the switches set, by this encoding IC (see Figure 13-2). In this figure, the top line shows the code that tells Sam to speed up, and the bottom shows the code that tells Sam to slow down, based in the width of the fourth pulse from the right. The radio receiver in Sam sends this code to a decoding IC to turn Sam on/off, honk the horn, or change the speed.

Figure 13-2: The top line speeds Sam up; the bottom slows him down.

Figure 13-2: The top line speeds Sam up; the bottom slows him down.

bullet Pin 14 is a transmit enable pin. When you press the normally open (NO) pushbutton switch between Pin 14 and ground, the encoder sends a signal to the transmitter module. This signal contains information that tells the decoding module whether the toggle switches (S1–S4) between Pins 10, 11, 12, and 13 and ground are open or closed.

bullet R1 is a resistor that sets the frequency of an oscillator that’s internal to the encoder. The signal from this oscillator is required to generate the encoded signal.

bullet S5 is the on/off switch.

Figure 13-3 shows what’s going on in the transmitter circuit.

Figure 13-3: Sam’s transmitter circuit.

Figure 13-3: Sam’s transmitter circuit.

Helping Sam receive his commands

The receiver circuit that Sam uses to make sense of all your transmitted commands is shown in Figure 13-4. Here’s how this one works:

bullet The receiver module separates the coded signal sent by the transmitter from the 433.9 MHz carrier wave. The output of the receiver module at Pin 2 is the decoded signal, as shown in Figure 13-2.

bullet VR1 is a voltage regulator that takes the 6 volts supplied by the battery pack and supplies a steady 5 volts because the transmitter module has a maximum voltage of 5.5 volts. We provided a separate battery pack for this section of the circuit to provide a stable supply for the radio receiver. We found this setup gives much more consistent reception than setting up the receiver to share a battery pack with the rest of the circuit.

bullet S1 is the on/off switch for the circuit.

bullet IC1 decodes the signal sent by the transmitter. Pins 10, 11, 12, and 13 are outputs of the decoder that are at 0 volts if the corresponding toggle switch on the encoder is closed (connected to ground). The outputs are at about 5 volts if the corresponding toggle switch on the encoder is open (not connected to ground). These outputs stay at one voltage until they receive another signal to change.

bullet The 10 microfarad and 0.1 microfarad capacitors (C1–C4 and C7–C12) placed between the +V and ground buses at the +V input of each of the ICs are used to filter electrical noise from the DC motors. That noise can prevent the ICs from getting the correct supply voltage.

bullet IC2 is an LM555 timer that generates a square wave at Pin 3. This square wave alternates between 5 volts and 0 (zero) volts. The frequency of the square wave is determined by the values of R2, R3, and C5; we discuss this process in Chapter 9. When you tell Sensitive Sam to slow down, this square wave causes the voltage to the motor to switch on and off rapidly, with 6 volts to the motor half the time and 0 volts to the motor half the time. When you ask Sam to speed up, 6 volts are sent to the motor constantly. This is a simple form of pulse width modulation, which is commonly used to control the speed of DC motors.

bullet C6 is a capacitor that reduces the occurrence of noise on Pin 5 of IC2, which could cause false triggering of the LM555. This might occur if Pin 5 were left unconnected.

bullet Q1 turns the horn on and off. Q1 is a transistor that turns on when decoder Pin 12 is at 5 volts. Turning on Q1 allows a current to flow through the buzzer. To turn on the buzzer, you put the toggle switch connected to the encoder Pin 12 on the transmitter in the open position and push the transmit button. To turn off the buzzer, you put the toggle switch connected to encoder Pin 12 on the transmitter in the closed position and push the transmit button.

bullet Q2 and Relay 1 control Sam’s speed. Q2 is a transistor that turns on when decoder Pin 10 is at 5 volts. Pin 4 and Pin 6 are normally connected (NC), and Pin 4 and Pin 8 are normally open (NO). Turning on Q2 allows current to flow through the coil in Relay 1 and connects Pin 4 to Pin 8. Pin 4 is the output of Relay 1, and Pin 8 is where you input the square wave from IC2 into Relay 1. When Q2 is off, no current flows through the coil in Relay 1, and Pin 4 is connected to Pin 6. This makes the output of Relay 1 approximately 5 volts. To ask Sam to go full speed ahead, you put the toggle switch connected to the encoder Pin 10 in the closed position and push the transmit button. To ask Sam to slow down, you put the toggle switch connected to the encoder Pin 10 in the open position and push the transmit button.

bullet Use Q3 and Relay 2 to tell Sam to start or stop. Q3 is a transistor that turns on when decoder Pin 13 is at 5 volts. Turning on Q3 by having the start/stop transmitter toggle switch closed allows current to flow through the coil in Relay 2 and connects Pin 4 (the output of Relay 2) to Pin 8. This tells Sam to run his engines. When the start/stop transmitter toggle switch is open and Q3 is off, no current flows through the coil in Relay 2, and Pin 4 is connected to Pin 6; this makes the output of Relay 2 zero (0) volts.

bullet IC3 is an H-bridge motor controller. Although this controller is capable of controlling more functions than just going straight ahead (as you can read about in Chapter 11), all we need it to do here is supply the voltage to drive each motor forward. The battery pack attached to Pin 8 of IC3 supplies power for the motors. You connect the output of Relay 2 to the enable pins (1 and 9) of IC3. When 5 volts is provided by Relay 2 to the enable pins, IC3 supplies power to the motors. When 0 volts is connected to the enable pins, IC3 doesn’t supply power, so Sam just sits there.

bullet The left and right sensors allow Sensitive Sam to take control of himself. When the track curves or Sam drifts so that one of the sensors is over the black electrical tape, power is cut to the motor on that side. This causes Sam to move away from the tape. When the sensor again hovers over a reflective floor, power is restored to that motor, and Sam straightens out.

On the schematic, the orange (O) and green (G) wires connect to an LED, with R4 and R6 limiting the current to protect the LED from damage. The blue (B) and white (W) wires connect to a phototransistor. When the sensor moves over a reflective surface, such as hardwood floor, the phototransistor is on, and the base of Q5 or Q4 is connected to ground. This turns off Q5 or Q4, which leaves the output of Relay 3 or Relay 4 connected to Pin 11, allowing the motor to run. When the sensor is over a nonreflective surface, such as black electrical tape, the phototransistor is off, and the base of Q5 or Q4 is connected to a positive voltage through R7 or R5, turning on Q5 or Q4. This disconnects the output of the relay from Pin 11 and also shuts off the motor.

Figure 13-4: The receiver schematic revealed.

Figure 13-4: The receiver schematic revealed.

Building Alert: Construction Issues

Sam is sensitive, and so are some of the issues you’ll encounter when building him. For example, the motor lugs used in this project are made of thin metal and will break off if you put too much stress on them. By using stranded wire, rather than solid wire, you can minimize the stress on the lugs. Throughout the construction instructions that follow, we indicate when to use stranded wire.

Another construction issue to be aware of is the antenna. You solder antenna wire to one lead on both the transmitter and receiver modules. A 12" 20 gauge wire makes a dandy antenna; unlike 22 gauge wire, 20 gauge wire is stiff enough to stay upright. The only complication is in soldering the wire to the leads on the modules, so here are a few tips:

bullet Keep the soldering time to a few seconds to avoid damaging some of the solder joints in the module.

bullet Leave 1/4" of lead below the solder joint to allow you to insert the adjacent leads fully into the breadboard.

bullet Soldering the 20 gauge solid wire directly to the lead is acceptable; however, soldering a few inches of stranded wire to the end of the antenna, covering that joint with heat shrink tubing, and soldering the stranded wire to the module lead prevents the leads from being twisted while you work with them.

Warningbolt

Twisting can put too much stress on the lead and break it off, which is more likely to happen if you solder solid wire directly to the lead.

Perusing the Parts List

We broke down the parts shopping list into two . . . um . . . parts: a list for the transmitter circuit parts and a list for the receiver circuit and container parts.

Tallying up transmitter bits and pieces

The circuit that sends signals to Sam telling him what to do involves the following parts, several of which are shown in Figure 13-5:

bullet LM7805 5 volt voltage regulator (VR1)

bullet Four SPST toggle switches (S1, S2, S3, S4)

bullet SPST normally open (NO) momentary push button switch (S4)

bullet Holtek HT12E encoder (IC1)

bullet 1 megohm resistor (R1)

bullet TWS-434 RF transmitter module

AttentionShoppers

We bought this at Reynolds Electronics (www.rentron.com); Hobby Engineering (www.hobbyengineering.com) carries a similar module.

bullet 400-contact breadboard

bullet One 4 AA battery pack with snap connector

bullet Five 2-pin terminal blocks

bullet Plastic box

We use Radio Shack part #270-1806.

bullet An assortment of different lengths of prestripped short 22 AWG wire

Figure 13-5: Key com- ponents of your transmitter.

Figure 13-5: Key com- ponents of your transmitter.

Running down receiver and container parts

The circuit that takes transmitted signals and explains to Sam what’s expected of him involves the following parts, several of which are shown in Figure 13-6:

bullet Holtek HT12D decoder (IC1)

bullet L293D H-bridge (IC3)

bullet LM555N-1 timer (IC2)

bullet Five 2N3904 transistors (Q1–Q5)

bullet 6 volt buzzer

bullet RWS-434 RF receiver module

AttentionShoppers

We bought this at Reynolds Electronics; Hobby Engineering carries a similar module.

bullet Four 1 amp or greater solid state relays, DPDT (double-pole, double-throw) or SPDT (single-pole, double-throw)

AttentionShoppers

We used the Shinmei RSB-5-S DPDT that we found at Jameco (www.jameco.com). A SPDT would also work, but we used the DPDT because it allows for more flexibility for which side of the relay we could run wires to. Make sure that the relay you buy has a pinout pattern that fits a breadboard; many of them do not.

bullet Two DC gear motors GM2 each with a 25/8" wheel or equivalent

We use these because the suppliers (Hobby Engineering (www.hobbyengineering.com) or Solarbotics Ltd. (www.solarbotics.com) carry wheels made to fit them.

bullet Two metal brackets used as motor mounts

We found 3" x 5/8" mending braces made by National Manufacturing Company at our local hardware store. These worked great.

bullet One 11/2" inch swiveling castor

bullet Six 0.1 microfarad ceramic capacitors (C1, C3, C6, C7, C9, C11)

bullet Six 10 microfarad electrolytic capacitors (C2, C4, C5, C8, C10, C12)

bullet 51 kohm resistor (R1)

bullet Three 10 kohm resistors (R3, R5, R7)

bullet Two 150 ohm resistors (R4, R6)

bullet 330 ohm resistor (R2)

bullet Two 830-contact breadboards

bullet Two Fairchild QRB1134 sensors

bullet Three 4 AA battery packs with snap connectors

bullet Ten 2-pin terminal blocks

bullet Four 8-32 11/2" panhead screws

bullet Four 8-32 nuts

bullet Four 6-32 1/2" panhead screws

bullet Four 6-32 nuts

bullet Four 4-40 3/4" panhead screws

bullet Four 4-40 nuts

bullet Two wooden boxes

• 2" wide x 5" tall x 11/4" deep

• 51/2" wide x 81/2" long x 21/2" deep

We found one at a local craft supply store that was just the right size to hold the electronics for this project and a smaller wooden box to glue on the front of the bigger box to mount the sensors.

bullet An assortment of different lengths of prestripped, short 22 AWG wire

Figure 13-6: Important pieces of the Sam project.

Figure 13-6: Important pieces of the Sam project.

Taking Things Step by Step

The steps involved in making Sensitive Sam sensitive are

1. Making the transmitter circuit and fitting it into your remote control box

2. Making the receiver circuit that goes into Sam

3. Putting together the chassis that contains the receiver circuit (Sam’s body)

Making the transmitter circuit and remote control box

The transmitter circuit fits into a remote control box and allows you to turn Sam on and off, speed him up or slow him down, and sound his horn. Here’s what’s involved in making this circuit:

1. Place HT12E (IC1) and five terminal blocks on the breadboard, as shown in Figure 13-7.

The five terminal blocks shows in this figure will be used to connect two wires each to various components in the circuit. The wires from these terminal blocks will go to the battery pack, the on/off switch, the transmit switch, and the three toggle switches.

Figure 13-7: Place the IC and terminal blocks on the breadboard.

Figure 13-7: Place the IC and terminal blocks on the breadboard.

2. Solder an antenna wire to Pin 4 of the transmitter module, as shown in Figure 13-8.

Tip

See the earlier “Building Alert: Construction Issues” section of this chapter for some tips on how to do this.

Figure 13-8: Transmitter and voltage regulator (VR1) pinouts.

Figure 13-8: Transmitter and voltage regulator (VR1) pinouts.

3. Insert the voltage regulator (VR1), a 1 megohm resistor (R1), and the transmitter module on the breadboard, as shown in Figure 13-9.

Figure 13-9: Insert a resistor, voltage regulator, and the transmitter on the breadboard.

Figure 13-9: Insert a resistor, voltage regulator, and the transmitter on the breadboard.

4. Insert wires to connect the IC, voltage regulator, transmitter, and the terminal blocks to the ground bus. Then insert a wire between the two ground buses to connect them, as shown in Figure 13-10.

Sixteen shorter wires connect components to ground bus; the long wire on the right connects the two ground buses.

Figure 13-10: Make ground bus connections.

Figure 13-10: Make ground bus connections.

5. Insert wires to connect the IC, voltage regulator, and transmitter to +V; then insert a wire between the two +V buses to connect them, as shown in Figure 13-11.

Figure 13-11: Connect components to the +V bus.

Figure 13-11: Connect components to the +V bus.

6. Insert wires to connect the IC, voltage regulator, transmitter, and terminal blocks, as shown in Figure 13-12.

Figure 13-12: Hook up the ICs, terminal blocks (TBs), transmitter, and voltage regulator.

Figure 13-12: Hook up the ICs, terminal blocks (TBs), transmitter, and voltage regulator.

The next step is to drill all kinds of holes into which you can pop various components to create the remote control box. Follow these steps to do so:

1. Drill holes in the box where you will mount the on/off switch, speed switch, horn switch, start/stop switch, transmit switch, and antenna, as shown in Figures 13-13 and 13-14.

Warningbolt

You can rearrange the switches. Just be careful not to put a switch where it will be in the way of the battery pack when you mount it inside the box.

Figure 13-13: Box with all the switches and buttons in place.

Figure 13-13: Box with all the switches and buttons in place.

On the end of the right side of the box, you can see the hole used to feed antenna out of box.

Figure 13-14: Use this hole to feed the antenna out of the box.

Figure 13-14: Use this hole to feed the antenna out of the box.
Tip

See Chapter 4 for more information about choosing drill bit sizes for particular components. In that chapter, we also offer advice about how to customize a box for your projects. Make sure you use safety glasses when drilling, and clamp the box to your worktable!

2. Slip the shaft of the switches through the drilled holes and secure with the nuts provided.

3. Solder the black wire from the battery pack to one lug of the on/off switch and solder an 8" black wire to the remaining lug of the on/off switch, as shown in Figure 13-15.

4. Solder an 8" wire to each of the two lugs on the pushbutton transmit switch, as shown in Figure 13-15.

Figure 13-15: Wires soldered to the on/off switch and transmit switch.

Figure 13-15: Wires soldered to the on/off switch and transmit switch.

5. Solder 6" wires to each of the two lugs on each of the three switches mounted on the cover, as shown in Figure 13-16.

Tip

If you have 22 gauge stranded wire, consider using it for connecting the switches mounted on the cover. Stranded wire is more flexible, which makes getting the cover on the box easier. As we discuss in Chapter 4, solder the end of the stranded wire to gather all those loose strands.

Figure 13-16: Wires soldered to the speed, horn, and start/stop switches.

Figure 13-16: Wires soldered to the speed, horn, and start/stop switches.
Warningbolt

Repeat after us: Heed all the safety precautions about soldering that we give you in Chapter 2. Use adequate ventilation when soldering to avoid inhaling fumes, and be sure to get a soldering iron with a stable stand so there’s no danger of it falling off your work surface.

6. Secure the breadboard and battery pack in the box with Velcro, as shown in Figure 13-17.

Remember

As you place the breadboard in the box, carefully feed the antenna wire out of the box through its hole and secure the antenna wire with a wire clip.

7. Attach the wires from the battery pack, on/off, transmit, speed, horn, and start/stop switches to the terminal blocks, as shown in Figure 13-17.

Figure 13-17: Transmitter circuit in place.

Figure 13-17: Transmitter circuit in place.

Making the receiver circuit

The receiver circuit will eventually reside in Sam’s body, taking the signals that your remote control unit sends telling Sam how to behave. Here are the steps to build the receiver circuit:

1. Take two 830-contact breadboards and join them by inserting the tabs into the slots along the sides to make one large breadboard.

2. Place the HT12D (IC1), the LM555 (IC2), the L293D (IC3), the receiver module, and ten terminal blocks on the breadboard, as shown in Figure 13-18.

Figure 13-18: Place the ICs and terminal blocks on the breadboard.

Figure 13-18: Place the ICs and terminal blocks on the breadboard.

3. Place the four RB5-5-S relays (Relay 1–Relay 4) and five 2N3904 (Q1–Q5) transistors on the breadboard, as shown in Figure 13-19.

Insert each transistor lead into a separate breadboard row with the

• Collector lead to the left side, as shown in Figure 13-19

• Base lead in the center

• Emitter lead to the right

The collector pin of Q2 goes in the same breadboard row as Pin 16 of Relay 1. The collector pin of Q3 goes in the same breadboard row as Pin 16 of Relay 2. The pin designations of the 2N3904 transistors and the LM7805 voltage regulator are shown in Figure 13-20.

Figure 13-19: Place the RB5-5-S relays, LM7805 voltage regulator, and 2N3904 transistors on the breadboard.

Figure 13-19: Place the RB5-5-S relays, LM7805 voltage regulator, and 2N3904 transistors on the breadboard.

Figure 13-20: The 2N3904 transistor, LM7805 voltage regulator, and RB5-5-S relays pinout.

Figure 13-20: The 2N3904 transistor, LM7805 voltage regulator, and RB5-5-S relays pinout.

4. Insert wires to connect the ICs, voltage regulator, transistors, relays, and terminal blocks to the ground bus. Then insert wires between the ground buses to connect them, as shown in Figure 13-21.

Tip

The ground buses are designated by a negative (–) sign on this breadboard.

Thirty-one shorter wires connect components to ground bus; the two long and one short wires on the left connect the ground buses.

Figure 13-21: Connect components to ground buses.

Figure 13-21: Connect components to ground buses.

5. Insert wires to connect the ICs, the terminal blocks, relays, and the voltage regulator to the +V bus. Then insert wires between the +V buses to connect them, as shown in Figure 13-22.

Tip

The +V buses are designated by a + sign on this breadboard.

Figure 13-22: Connect components to the +V bus.

Figure 13-22: Connect components to the +V bus.

6. Insert wires to connect the ICs, terminal blocks, relays, and discrete components, as shown in Figures 13-23, 13-24, and 13-25.

The receiver module pinout is shown in Figure 13-26.

Figure 13-23: Hook up the IC, terminal blocks, relays, and discrete components.

Figure 13-23: Hook up the IC, terminal blocks, relays, and discrete components.

Figure 13-24: Hooking up yet more wires.

Figure 13-24: Hooking up yet more wires.

Figure 13-25: Place the rest of the wires.

Figure 13-25: Place the rest of the wires.

Figure 13-26: Receiver module pinout.

Figure 13-26: Receiver module pinout.

7. Insert the following, as shown in Figure 13-27:

• Six 0.1 microfarad ceramic capacitors (C1, C3, C6, C7, C9, C11)

• Six 10 microfarad electrolytic capacitors (C2, C4, C5, C8, C10, C12)

• 51 kohm resistor (R1)

• Three 10 kohm resistors (R3, R5, R7)

• Two 150 ohm resistors (R4, R6)

• 330 ohm resistor (R2)

Use both the schematic and the photo to help you place each component. For example, the schematic shows that the + side of C5 is connected to Pin 2 of IC2 and the other side of C2 is connected to ground, so insert the long lead of C2 in the same row as Pin 2 of IC2 and the short lead in the ground bus.

Figure 13-27: Insert capacitors and resistors onto the breadboard.

Figure 13-27: Insert capacitors and resistors onto the breadboard.

Use the following key for the callouts in Figure 13-27.

1. C1 from +V bus to ground bus

2. C2 from +V bus to ground bus

3. C3 from +V bus to ground bus

4. C4 from +V bus to ground bus

5. C7 from +V bus to ground bus

6. C8 from +V bus to ground bus

7. C9 from +V bus to ground bus

8. C10 from +V bus to ground bus

9. C5 from Pin 2 of IC2 to ground bus

10. C6 from Pin 5 of IC2 to ground bus

11. R1 from Pin 15 of IC1 to Pin 16 of IC1

12. R2 from Pin 6 of IC2 to Pin 7 of IC2

13. R3 from Pin 7 of IC2 to +V

14. R4 from right sensor TB to ground

15. R6 from left sensor TB to ground

16. R5 from right sensor TB to +V

17. R7 from left sensor TB to +V

18. C11 from +V bus to ground bus

19. C12 from +V bus to ground bus

Building Sensitive Sam’s chassis

If you’re a sensitive guy like Sam, how your body looks is very important to you. Here are the steps to build Sam a serviceable little chassis to hold the receiver circuit:

1. Solder 12" stranded wires to the motor lugs, as shown in Figure 13-28.

Figure 13-28: Wires soldered to the motor lugs.

Figure 13-28: Wires soldered to the motor lugs.

2. Drill holes for the 6-32 screws used to mount the castor, as shown in Figure 13-29.

Tip

Use the base of the castor to guide you when marking the four holes you will drill in the chassis box to mount the castor.

Figure 13-29: The inside of the box after holes have been drilled and the motors and castor are mounted.

Figure 13-29: The inside of the box after holes have been drilled and the motors and castor are mounted.

3. Mark a location about an inch to each side of the castor and drill holes with a 1/4" bit to feed the wires to the motors and sensors, as shown in Figure 13-29.

4. Using a mending brace to mark the four holes you will drill in the box to mount the motors, drill holes for 8-32 screws, as shown in Figure 13-29.

5. Attach the castor to the box with four 6-32 screws and nuts, as shown in Figure 13-30.

6. Attach the motors to the box with two 8-32 screws and nuts and one mending brace for each motor, as shown in Figures 13-30 and 13-31.

Figure 13-30: The bottom of the cart with castors and motors mounted.

Figure 13-30: The bottom of the cart with castors and motors mounted.

Figure 13-31: A closer look at how to mount the motors.

Figure 13-31: A closer look at how to mount the motors.

7. Drill a hole for 4-40 screws in each side of the small box to mount the sensors, as shown in Figure 13-32.

Figure 13-32: Keeping the sensors just off the floor allows Sam to spot the tape.

Figure 13-32: Keeping the sensors just off the floor allows Sam to spot the tape.

8. Mount the sensors in the small box with one 4-40 screw and nut per sensor.

9. Feed the wires for the sensors and the motors through the holes you drilled to each side of the castor.

10. Glue the small box to the cart, as shown in Figures 13-32 and 13-33.

Tip

The face of the sensors should be a quarter-inch above the floor.

Figure 13-33: A look at how we attached the sensors from below.

Figure 13-33: A look at how we attached the sensors from below.

11. Drill two holes for 6-32 screws to mount the buzzer, as shown in Figure 13-34.

Figure 13-34: The buzzer and the on/off switch mounted on Sam.

Figure 13-34: The buzzer and the on/off switch mounted on Sam.

12. Mount the buzzer by using two 6-32 screws and nuts.

13. Drill a hole in the box where you will insert the on/off switch, as shown in Figure 13-34.

14. Slip the threaded shaft of the on/off switch through the hole you drilled and secure it with the nut provided.

Tip

If the wall of the box is too thick to allow the threads on the switch to reach the nut, use a small chisel to remove enough wood from the inside wall of the box so that the nut can engage the threads.

15. Solder the black wires from the three battery snaps to one lug of the on/off switch and solder three 12" black wires to the other lug of the on/off switch.

Figure 13-35 shows the switch after soldering.

Figure 13-35: Wires soldered to on/off switch.

Figure 13-35: Wires soldered to on/off switch.

16. Attach Velcro to the breadboard and the box and secure the breadboard in the box.

17. Attach Velcro to the battery packs and the box and secure the battery packs in the box.

18. Insert the wires from the sensors, motors, battery packs, buzzer, and the on/off switch to the terminal blocks on the breadboard, as shown in Figures 13-36 and 13-37.

Remember

As you insert the wires, cut each of them to the length you need for them to reach the corresponding terminal block. Also, strip the insulation from the end of the wire.

Figure 13-36: Connect the sensors, motors, battery packs, buzzer, and on/off switch to the breadboard.

Figure 13-36: Connect the sensors, motors, battery packs, buzzer, and on/off switch to the breadboard.

Figure 13-37: A closer look.

Figure 13-37: A closer look.

Use the following key for the callouts in Figure 13-37.

1. Red wire from buzzer

2. Black wire from buzzer

3. Red wire from receiver battery pack

4. Black wire from receiver battery pack

5. Red wire from main battery pack

6. Black wire from main battery pack

7. Red wire from motor battery pack

8. Black wire from motor battery pack

9. Wires from left motor

10. White wire from left sensor

11. Blue wire from left sensor

12. Green wire from left sensor

13. Orange wire from left sensor

14. White wire from right sensor

15. Blue wire from right sensor

16. Green wire from right sensor

17. Orange wire from right sensor

18. Wires from right motor

19. Secure the wires with wire clips where needed.

Sensitive Sam is shown roaring around our living room floor in all his glory in Figure 13-38.

Figure 13-38: Sam chugs around the track till you tell him to stop.

Figure 13-38: Sam chugs around the track till you tell him to stop.

Trying It Out

Now that you have a remote control unit and Sam’s body all assembled, take him out for a spin. Follow these steps to play with your new sensitive buddy:

1. Place black electrician’s tape on a reflective floor (hardwood or linoleum, for example).

Tip

You don’t have to create a straight line; you can use several pieces to design a circular or oval track.

2. Place Sam on the track with the sensors on either side of the tape.

3. Put batteries in Sam and the remote control flip the on/off switches on both to On.

4. Flip the start/stop switch to start and press the transmit button on the remote control to get Sam moving.

5. Flip either the speed or horn switch on the remote control and then press the transmit button to activate either effect.

6. To stop Sam, flip the start/stop switch to stop and press the transmit button.

If nothing happens, here are a few things to check out:

bullet All the batteries are fresh, are tight in the battery pack, and face the right direction.

bullet See whether any wires or parts have come loose.

bullet Compare your circuit with the photos in this chapter to make sure you got all the connections right.

If Sam gets going but doesn’t follow the track as you expect, you can adjust the sensors by loosening the screws and sliding the sensors up or down.

If Sam stalls, try these steps:

1. Put the start/stop switch in the start position.

2. Push the transmit button once more.

Taking It Further

We’re sure you can see why this neat little guy is Earl’s favorite project. You can create huge tracks and have him follow around the room. He confuses recalcitrant cats (refer to Figure 13-1), and you can put notes in his cart and send them to someone else on the other side of the room.

When you’re ready to take Sam further, try these suggestions:

bullet Build a Sensitive Samantha using a different radio frequency module for the remote control to give Sam a girlfriend he can race with around the track.

bullet Add lights by using the fourth pin on the encoder/decoder to control them.

bullet Read up on other radio control project ideas at sites such as www.renton.com.

bullet If you build Sam’s chassis to be strong enough, you can put him to work carrying things around your house — a can of soda, the TV remote, or whatever you want to send off to the couch potato lounging in your living room.