CHAPTER 18

image

Adding Gearhead Motors

In this chapter, we will select and install motors in the line-following robot circuit. You’ll also learn a little about diodes.

Selecting Gearhead Motors

In choosing motors for the line-following robot, consider the following criteria:

  • The motors should operate at voltage ranges provided by a 9 V battery. That’s slightly less than 10 VDC, down to 7 VDC.
  • The motors should be small enough to fit abreast within a sandwich container. That means each motor may be no more than 6 cm in length and 4 cm in diameter. Motors with smaller dimensions are even better, as you can add tubes or other ornamentations.
  • The loaded motor speed should not be so slow as to bore people, but not so fast as to drive the robot off of the course. Depending on the wheel size, this equates to rotational speeds of roughly between 50 RPM and 125 RPM. Such slow rotation at 9 V requires a gearhead motor.
  • The motor must not draw more than 500 mA of current at any time, because that’s the maximum the 2N2907A transistor can support.

There were a couple of additional criteria I considered:

  • Because the motors are integral to a project that you can build yourself, I selected motors that are available to consumers in small quantities.
  • Because the motors appear in my book, which will be available for years, I selected motors that are currently in production and are available from a major supplier. (This ruled out surplus sales.)

Obtaining the Gearhead Motors

The motors selected are 12 V, 225 RPM gearhead motors made by Hsiang Neng (see Figure 18-1). The motors are rated at voltages from 4.5 V to 12 V, which is perfect for a 9 V battery.

9781484213605_Fig18-01.jpg

Figure 18-1. A pair of Hsiang Neng gearhead motors

Since speed decreases linearly with voltage, the 9 V RPM can be estimated as:

(RPM nominal / V nominal) × V desired = RPM at desired voltage
(225 RPM / 12 V) × 9 V = 168 RPM

That’s a little faster than sought after, but it’s also the no-load speed, which is unrealistically fast. The torque required to move the load of the robot decreases the RPM. Still, a slightly slower motor would be better.

The motors are available from Jameco, part #162191, manufacturer’s part number #HNGH12-1324Y-R, for $17.95 each. These were the least expensive gearhead motors that met the criteria. Even so, at almost $36 a pair, the motors are more expensive than all the other line-following parts combined. You’ll face this reality again and again. Motors generally make up the largest portion of a robot’s cost.

If you decide to purchase different motors, or use some you already own, make sure the motors meet the first four criteria listed at the beginning of this chapter.

Solarbotics provides a wide variety of lower-cost motors. They selected their GM2 motor for their Sandwich kit. The motors are slower (which improves line following), half the weight, and cost less than 1/3 of the price (only $6.90 each when purchased in pairs).

Furthermore, Solarbotics sells matching-colored wheels (see Figure 18-2), part #GMPW, for as little as $2.68 each when purchased with the motor. This allows you to tear out Chapters 19 (selecting wheels) and 20 (attaching wheels) of this book.

9781484213605_Fig18-02.jpg

Figure 18-2. Solarbotics GM2 motor with matching wheel

The Solarbotics motors aren’t the same shape and size as the Hsiang Neng motors. Therefore, you’ll need to use your own creativity to attach them to your robot.

The downsides to the GM2 motors are that they consume slightly more power, are moderately louder, are more electrically noisy, and theoretically would have a shorter lifespan if you ran the robot continuously every day. For this application, those tradeoffs are worth it for the significant reduction in cost.

Inspecting the Gearhead Motor

Looking inside the Hsiang Neng motor, the pieces are found to be as expected for a low-price motor. Referring to Figure 18-3, the parts are (left to right): stator with permanent magnet, three-shoe iron-core rotor, cap with pleasantly thick brushes, spur gearbox, metal gearbox cover, and joining screws.

9781484213605_Fig18-03.jpg

Figure 18-3. Exploded view of a Hsiang Neng gearhead motor

It’s a shame the gearbox cover isn’t plastic. This motor doesn’t produce a lot of torque, so metal probably isn’t necessary. Plastic would save a lot of mass and quicken responsiveness. The gearbox is 73% efficient, which is reasonable.

Although you can open the gearhead portion easily, don’t try disassembling the motor portion. I had to permanently grind off several metal pieces to open the motor portion for the photograph featured in this book. Therefore, the brushes obviously aren’t meant to be user-serviceable. When the motor wears out, toss it.

The motor is 3.8 cm long with a diameter of 2.6 cm. That’s nice and small. The output shaft is offset. That means the shaft doesn’t come out of the cap’s center. An offset shaft is actually beneficial for mounting wheels closer to the ground, as you can rotate the motor into a position with the shaft nearest the bottom of the robot. The shaft is 1.5 cm is length, providing lots of room for attaching wheels.

Current Usage of the Gearhead Motor

As part of a motor’s inspection, you should measure motor current. By connecting a multimeter between a 9 V battery and the motor (see Figure 18-4), you can determine the actual current used by the motor without a load and the amount of current used when stalled. Make sure the multimeter is in the highest current mode, so that a fuse isn’t blown in the multimeter during peak current usage.

9781484213605_Fig18-04.jpg

Figure 18-4. Testing motor current with a multimeter and pliers

Determining the Least Current (Best Case)

The no-load current of the selected motor (after a breaking-in period) at 9 V measures 31 mA. Simply connect the motor to a battery to experience this test case. A 150 mAh 9 V rechargeable battery would last almost five hours powering this motor when allowed to turn freely.

150 mAh battery capacity / 31 mA no-load motor = 4.8 h (hours)

Determining the Most Current (Worst Case)

By briefly applying pliers to stop the motor shaft from turning, the stall current at 9 V measures 380 mA. A gentler approach is to measure the resistance of the motor coils and then calculate stall current.

With a stall current of 380 mA, a pair of these motors that are prevented from turning (like if the robot was stuck against a wall) would drain the battery in less than 12 minutes.

150 mAh battery capacity / (380 mA stalled motor × 2 motors) = 0.2 h
0.2 hours × 60 minutes in an hour = 12 minutes

Of course the robot also has lights and chips that consume power, so the battery would actually drain in less than 12 minutes. The 150 mAh battery-capacity rating is based on a fairly slow drain, so the battery would exhaust very quickly when drained at over 800 mA.

Image Caution  Battery manufacturers warn you to not draw so much current from a battery that it lasts significantly less than one hour. For example, a 150 mAh battery shouldn’t be drained at more than 150 mA. Greater currents may damage the battery. In practice, most radio-control models and robot designs push this guideline, draining fresh batteries in as short a time as 15 minutes.

Fortunately, these motors have enough torque (twisting force) that they don’t ever stall on Sandwich. Even if the robot is pushing against a wall, the wheels spin in place.

Determining the Actual Current (Average Case)

The average current of the motor is going to be somewhere between 31 mA (best case) and 380 mA (worst case). By connecting the multimeter to the robot and following it around, the load current turned out to fluctuate between 40 mA and 120 mA. Counting the chips and lights, and assuming only one motor turns at a time, the robot should last a little under an hour.

Adding Motors to the Brightness Comparator Circuit

The schematic illustrated in Figure 18-5 is a portion of the previously presented brightness comparator circuit with transistors, with the addition of a diode (D1) and a motor (M1). To reduce visual complexity, only one branch from the comparator’s two outputs is shown. Imagine that the branch with transistor Q8 (not shown) also has a diode and motor attached.

9781484213605_Fig18-05.jpg

Figure 18-5. Schematic of motor and Schottky diode added to brightness comparator circuit

Motor M1 has its positive terminal connected to the output of transistor Q7. The motor’s negative terminal is connected to the negative terminal of the battery. Because the transistor provides power to the motor, the motor turns on when the transistor turns on.

Introducing the Diode

A diode is very similar to an LED (Light-Emitting Diode) except an ordinary diode isn’t designed to emit light. However, like an LED, the diode only works in one direction. Also like an LED, the arrow in the diode’s schematic symbol (see D1 in Figure 18-4) points the direction current is allowed to flow.

9781484213605_Fig18-06.jpg

Figure 18-6. A 1N5817 diode, typical looking of many diodes

Most diodes physically resemble resistors, but without the multiple color bands (see Figure 18-6). There is only one band, located at the end of the diode, which indicates the cathode. The other end, the end without the band, is the anode. Current can only flow from the anode (positive) to the cathode (negative). You can think of the band as a wall that prevents current from entering from that direction.

Like LEDs, diodes consume or drop some voltage as power passes through them. The voltage drop of most diodes is between 0.4 V and 1 V, as opposed to 1.2 V or more for LEDs. In exchange for this voltage cost, a diode acts as a one-way valve (a check valve).

Protecting the Transistor with a Flyback Diode

Wait a minute! Diode D1 is facing in the wrong direction in the schematic in Figure 18-5. The arrow is going up toward positive, unlike the LEDs in that same schematic, whose arrows point toward the negative battery terminal.

Diode D1 is purposely installed in this circuit in a direction that doesn’t allow power to flow through it during normal circumstances. However, when power is disconnected from a motor, a large reverse voltage suddenly appears (see the following note). The diode allows the reverse voltage to flow around and around in the motor to be safely consumed.

If the diode wasn’t installed, the reverse voltage in the motor could damage transistor Q7. A diode utilized to reroute reverse-induced voltage is called a flyback diode. The diode intentionally provides a short circuit for the leftover motor juices.

Image Note  The reverse-voltage phenomenon is not limited only to motors. It also appears in coils, switches, and anywhere a current suddenly shuts off. If a large enough current flows through a motor, then the reverse voltage may potentially damage connected electronics.

Think of the reverse-voltage effect as a washing machine or dishwasher that rapidly shuts off its water supply and a loud jerk reverberates through the pipes. Suddenly the rushing water doesn’t have anywhere to go, so pressure builds against the closed end of the pipe and is released backwards.

Picking the Schottky Barrier Diode

There are two specific characteristics required of a flyback diode.

First, a flyback diode should act as a barrier, not as a path, when current is going in the correct direction. Some diodes are too leaky in reverse to be good-quality barriers. In this circuit, a leaky flyback diode would waste some current that otherwise would zip through the motor and provide motion.

Second, when the motor generates current in the wrong direction, the flyback diode should be the least-resistant path (lowest voltage drop). That way, the electricity will choose the path through the flyback diode rather than breaking down a path through another component. Schottky diodes have this desired characteristic.

Technically, Schottky-type diodes aren’t necessary for this circuit because the transistor’s (Q7) minimum reverse voltage is 5 V. Non-Schottky diodes have a voltage drop of around 1 V, and thus would still provide the least-resistant path for the reverse current. Using a Schottky diode (about 0.4 voltage drop) provides a safety margin in case some other transistor type is used that isn’t as robust as the 2907A transistor.

The little squiggly “S” atop the arrow in the diode schematic symbol indicates a Schottky diode. A plain bar would have indicated a standard diode. A “Z” shape would have indicated a Zener diode.

Obtaining Schottky Barrier Diodes

Depending on the targeted application, sometimes a diode is called a rectifier. Either way, 1N5817, 1N5818, and 1N5819 are popular Schottky barrier diodes. Any of them will do for flyback purposes.

The 1N5817 has the least-resistant path and can handle 20 V in reverse (see Table 18-1). The 1N5818 and 1N5819 (available from the same suppliers) have slightly more resistant paths but can handle 30 V and 40 V, respectively. Choose one of those higher-voltage diodes if you want to drive a robot with 24 V motors.

Table 18-1. Suppliers of Axial Lead Schottky Barrier Diodes

Supplier

Part Number

Price

Mouser

821-1N5817

$0.28

Mouser

621-1N5817

$0.44

Jameco

177949

$0.14 (per 10)

Electronix Express

111N5817

$0.25

All Electronics

1N5817

3 for $1.00

Digi-Key

1N5817-BDI

$0.43

Digi-Key

1N5817DICT

$0.44

Building the Motors onto the Brightness Comparator Circuit

Only four components need to be added to the brightness comparator circuit: one diode and one motor are connected to each transistor (Q7 and Q8). See Figure 18-7 for an example.

9781484213605_Fig18-07.jpg

Figure 18-7. Motor and diode added to the brightness comparator circuit on a solderless breadboard

Connecting the Diode in the Proper Orientation

You must connect the cathode end of a diode (the end with the band) to the collector (output) of the transistor. Don’t mistakenly insert the diode in a different direction, or the motor and lights won’t work. If the diode’s anode were connected to the transistor’s emitter, it would create a high-current path harmful to the diode, transistor, battery, and even the breadboard.

You must connect the anode end of the diode (the end without the band) to the negative bus. A diode connected this way won’t normally conduct current.

Connecting the Motor

Use a pair of IC hook jumpers to connect each end of the motor to each end of the diode. The motor is marked underneath with a plus (+) sign to indicate the positive terminal. Using an alligator jumper or IC hook jumper, connect the motor’s positive terminal to the cathode of the diode. Connect the other terminal of the motor to the anode of the diode.

Although there’s no harm in connecting the motor backwards, the motor would run in reverse. In the final robot, such a mix-up could cause the robot to run backwards or to spin.

Repeating the Setup for the Other Transistor

Connect the second diode and second motor to the other transistor. In this way, one motor and diode should be attached to Q7 along with the yellow LEDs. And, one motor and diode should be attached to Q8 along with the green LEDs.

Testing the Motors

Upon powering up the circuit, one motor should spin depending on which sensors see more brightness. By moving your hand across the front of the sensors, the circuit should alternate between lighting up one set of LEDs and motor, and then the other set of LEDs and motor.

Only one motor should be enabled at a time unless the brightness is extremely balanced or unless you move your hand very quickly in front of the sensors. The robot makes tight turns with only one motor enabled, with one rotating wheel pivoting around the stationary wheel.

Completing the Electronics

Congratulations, you’ve finished prototyping all of the electronics necessary for the line-following robot!

Admittedly, there is one piece missing. Currently the left motor engages when the left side is brighter and the right motor engages when the right side is brighter. When the robot’s board is finally built, a line-following switch will be added that can swap the motor connections to the opposite sides. In doing so, the robot can either pivot toward brightness or pivot away from brightness. Thus, it can follow either dark lines or light lines.

You can also toggle the line-following switch into the center position to disconnect the motors. In this state, you can place the robot on the starting line without it running away. This also keeps the robot stationary, but alive, during debugging.

Unfortunately, I could not locate an appropriately sized DPDT-center-off switch to prototype on a solderless breadboard. But, other than the switch, your breadboard now contains all of the components in the final configuration, ready to be soldered together.

Now that the motors are ready, it’s time to add some wheels.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.18.218