McGraw-Hill - The Robot Builder''''s Bonanza Part 9 ppt

35 260 0
McGraw-Hill - The Robot Builder''''s Bonanza Part 9 ppt

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

NOT THE WAY TO DO IT Before exploring the right ways to control the speed of motors, let’s examine how not to do it. Many robot experimenters first attempt to vary the speed of a motor by using a potentiometer. While this scheme certainly works, it wastes a lot of energy. Turning up the resistance of the pot decreases the speed of the motor, but it also causes excess current to flow through the pot. That current creates heat and draws off precious battery power. Another similar approach is shown in Fig. 18.11. Here, a transistor is added to the basic circuit, but again, excess current flows through the transistor, and the energy is dissipated as lost heat. There are, fortunately, far better ways of doing it. Read on. BASIC SPEED CONTROL Figure 18.12 shows a schematic that is a variation of the MOSFET circuit shown in Fig. 18.8, above. This circuit provides rudimentary speed control. The 4011 NAND gate acts as an astable multivibrator, a pulse generator. By varying the value of R3, you increase or decrease the duration of the pulses emitted by the gates of the 4011. The longer the dura- tion of the pulses, the faster the motor because it is getting full power for a longer period of time. The shorter the duration of the pulses, the slower the motor. Notice that the power or voltage delivered to the motor does not change, as it does with the pot-only or pot-transistor scheme described earlier. The only thing that changes is the amount of time the motor is provided with full power. Incidentally, this technique is called duty cycle or pulse width modulation (PWM), and is the basis of most popular motor speed control circuits. There are a number of ways of providing PWM; this is just one of dozens. Fig. 18.13 shows a timing diagram of the PWM technique, from 100 percent duty cycle (100 percent on) to 0 percent duty cycle (0 percent on). It is important to note that the frequency of the pulses does not change, just the relative on/off times. PWM frequencies of 2 kHz to over 25 kHz are commonly employed, depend- ing on the motor. Unless you have a specification sheet from the manufacturer of the motor, you may have to do some experimentation to arrive at the “ideal” pulse frequency to use. You want to select the frequency that offers maximum power with minimum current draw. 266 WORKING WITH DC MOTORS V GND Q1 R1 R2 M Heat FIGURE 18.11 How not to vary the speed of a motor. This approach is very inefficient. Ch18_McComb 8/18/00 2:11 PM Page 266 Excessively high PWM frequencies may negate the speed control aspect, whereas exces- sively low frequencies may cause significant current draw and motor heating. In the circuit shown in Fig. 18.12, R3 is shown surrounded by a dotted box. You can substitute R3 with a fixed resistor if you want to always use a certain speed, or you can use the circuit shown in Fig. 18.14. This circuit employs a 4066 CMOS analog switch IC. The 4066 allows you to select any of up to four speeds by computer or electronic control. You connect resistors of various values to one side of the switches; the other side of the switches are collectively connected to the 4011. To modify the speed of the motor, activate one of the switches by bringing its control input to HIGH. The resistor connected to that switch is then brought into the circuit. You can omit the 3.3K pull-down resistors on the control inputs if your control circuitry is always activated and connected. The 4066 is just one of several CMOS analog switches. There are other versions of this IC with different features and capabilities. We chose the 4066 here because it adds very MOTOR SPEED CONTROL 267 +12V Q1 Q2 Q3 Q4 4011 (1/4) +12V 1 23 4 5 6 g g d d g d s s s Q5 g d s Motor control LED1 R2 1M 8 910 12 13 11 Speed control 7 14 0.1 C1 0 1Forward Reverse Direction control g d s M1 0 1On Off 4011 (1/4) 4011 (1/4) 4011 (1/4) B A 0.033 C1 Q1-Q5 N-channel power MOSFET (IRF-630 or equiv.) R1 330Ω R3 100K D1 D3 D2 D4 C2 0.1 FIGURE 18.12 A rudimentary speed and direction control circuit using power MOSFETs. Resistor R1 and the LED serve to indi- cate that the motor is on. Ch18_McComb 8/18/00 2:11 PM Page 267 little resistance of its own when the switches are on. Note that the 4066 specifications sheet says that only one switch should be closed at a time. PROCESSOR-BASED SPEED CONTROL Using 4066 analog switches and individual resistors limits the number of speed choices you have. You may want to go from 90 percent to 88 percent duty cycle to control your motor, but the selection of resistors that you’ve used only provide for 90 percent and 80 percent, with no other values between. If you plan on controlling your robot via a computer or microcontroller (see Part 5 for more information on these topics), you can use software to provide any duty cycle you darn well please. The computer or microcontroller cannot directly control a motor because the motor draws too much current. Instead, you connect the output of the computer or microcontroller to the control pin of an H-bridge or motor bridge IC, as shown in Fig. 18.15. Later chapters in Part 5 will detail the specific software you can use to vary the speed of a DC motor. 268 WORKING WITH DC MOTORS Ground V 100 % 80% 65% 50% 35% 20% 0 FIGURE 18.13 Pulse width modulation waveform. Note that the frequency of the pulses do not change, just the on and off times (duty cycle). Ch18_McComb 8/18/00 2:11 PM Page 268 MOTOR SPEED CONTROL 269 123 4 5 6 7 8910 11 121314 +12V R1* R2* To point "B" For additional speeds To point "A" Speed A Speed B 0 1On Off 0 1On Off *Set Value of R1 and R2 for Desired Speed IC1 4066 R4 3.3K R3 3.3K FIGURE 18.14 Using a 4066 CMOS analog switch to remotely control the speed of the motor. Use a device such as the 4051 for even more speed choices. Microcontroller/ computer port Buffer (optional) H-Bridge M Dropping resistor (optional) On-off and/or speed Direction FIGURE 18.15 The basic connection between a computer or microcontroller and a DC motor. The computer or microcontroller operates the on/off control and the speed of the motor. Ch18_McComb 8/18/00 2:11 PM Page 269 Odometry: Measuring Distance of Travel Shaft encoders allow you to measure not only the distance of travel of the motors, but their velocity. By counting the number of transitions provided by the shaft encoder, the robot’s control circuits can keep track of the revolutions of the drive wheels. ANATOMY OF A SHAFT ENCODER The typical shaft encoder is a disc that has numerous holes or slots along its outside edge. An infrared LED is placed on one side of the disc, so that its light shines through the holes. The number of holes or slots is not a consideration here, but for increased speed resolu- tion, there should be as many holes around the outer edge of the disc as possible. An infrared-sensitive phototransistor is positioned directly opposite the LED (see Fig. 18.16) so that when the motor and disc turn, the holes pass the light intermittently. The result, as seen by the phototransistor, is a series of flashing light. Instead of mounting the shaft encoders on the motor shafts, mount them on the wheel shafts (if they are different). The number of slots in the disk determines the maximum accuracy of the travel circuit. The more slots, the better the accuracy. Let’s say the encoder disc has 50 slots around its circumference. That represents a min- imum sensing angle of 7.2°. As the wheel rotates, it provides a signal to the counting cir- 270 WORKING WITH DC MOTORS LED Phototransistor Shaft encoder Motor Output of phototransistor FIGURE 18.16 An optical shaft encoder attached to a motor. Alternatively, you can place a series of reflective strips on a black disc and bounce the LED light into the phototransistor. Ch18_McComb 8/18/00 2:11 PM Page 270 cuit every 7.2°. Stated another way, if the robot is outfitted with a 7-inch wheel (circum- ference ϭ 21.98 inches), the maximum travel resolution is approximately 0.44 linear inch- es. Not bad at all! This figure was calculated by taking the circumference of the wheel and dividing it by the number of slots in the shaft encoder. The outputs of the phototransistor are conditioned by Schmitt triggers. This smooths out the wave shape of the light pulses so only voltage inputs above or below a specific thresh- old are accepted (this helps prevent spurious triggers). The output of the triggers is applied to the control circuitry of the robot. THE DISTANCE COUNTER The pulses from a shaft encoder do not in themselves carry distance measurement. The pulses must be counted and the count converted to distance. Counting and conversion are ideal tasks for a computer. Most single-chip computers and microprocessors, or their inter- face adapters, are equipped with counters. If your robot lacks a computer or microproces- sor with a timer, you can add one using a 4040 12-stage binary ripple counter (see Fig. 18.17). This CMOS chip has 12 binary weighted outputs and can count to 4096. You’d probably use just the first eight outputs to count to 256. Any counter with a binary or BCD output can be used with a 7485 magnitude com- parator. A pinout of this versatile chip is shown in Fig. 18.18 and a basic hookup diagram in Fig. 18.19. In operation, the chip will compare the binary weighted number at its “A” and “B” inputs. One of the three LEDs will then light up, depending on the result of the difference between the two numbers. In a practical circuit, you’d replace the DIP switches (in the dotted box) with a computer port. You can cascade comparators to count to just about any number. If counting in BCD, three packages can be used to count to 999, which should be enough for most distance ODOMETRY: MEASURING DISTANCE OF TRAVEL 271 16 VCC 8 GND RESET 11 CLOCK 10 9 LSB MSB 7 6 5 3 2 4 13 +5VDC From encoding/ conditioning circuitry IC1 4040 Binary weighted output (first eight bits) FIGURE 18.17 The basic wiring diagram of the 4040 CMOS 12-stage ripple counter IC. Ch18_McComb 8/18/00 2:11 PM Page 271 272 WORKING WITH DC MOTORS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 7485 VCC A<B B3 Date input A=B A>B Cascade inputs A>B A=B A<B GND B0 A0 B1 A1 A2 B2 A3 Outputs Data outputs A B C D Set switch A>B A=B A<B 5 6 7 VCC 16 +5vdc 15 13 12 10 A B C D 1 14 11 9 8 GND A B From decoder R1-R3 330Ω To control circuit FIGURE 18.18 Pinout diagram of the 7485 magnitude comparator IC. FIGURE 18.19 The basic wiring diagram of a single-state magnitude comparator circuit. Ch18_McComb 8/18/00 2:11 PM Page 272 recording purposes. Using a disc with 25 slots in it and a 7-inch drive wheel, the travel resolution is 0.84 linear inches. Therefore, the counter system will stop the robot within 0.84 inches of the desired distance (allowing for coasting and slip between the wheels and ground) up to a maximum working range of 69.93 feet. You can increase the distance by building a counter with more BCD stages or decreasing the number of slots in the encoder disc. MAKING THE SHAFT ENCODER By far, the hardest part about odometry is making or adapting the shaft encoders. (You can also buy shaft encoders ready-made.) The shaft encoder you make may not have the fine resolution of a commercially made disc, which often have 256 or 360 slots in them, but the home-made versions will be more than adequate. You may even be able to find already machined parts that closely fit the bill, such as the encoder wheels in a discard- ed mouse (the computer kind, not the live rodent kind). Fig. 18.20 shows the encoder wheels from a surplus $5 mouse. The mouse contains two encoders, one for each wheel of the robot. You can also make your own shaft encoder by taking a 1- to 2-inch disc of plastic or metal and drilling holes in it. Remember that the disc material must be opaque to infrared light. Some things that may look opaque to you may actually pass infrared light. ODOMETRY: MEASURING DISTANCE OF TRAVEL 273 FIGURE 18.20 The typical PC mouse contains two shaft encoder discs. They are about perfect for the average small-or-medium-size robot. Ch18_McComb 8/18/00 2:11 PM Page 273 When in doubt, add a coat or two of flat black or dark blue paint. That should block stray infrared light from reaching the phototransistor. Mark the disc for at least 20 holes, with a minimum size of about 1/16 inch. The more holes the better. Use a compass to scribe an exact circle for drilling. The infrared light will only pass through holes that are on this scribe line. MOUNTING THE HARDWARE Secure the shaft encoder to the shaft of the drive motor or wheel. Using brackets, attach the LED so that it fits snugly on the back side of the disc. You can bend the lead of the LED a bit to line it up with the holes. Do the same for the phototransistor. You must mask the pho- totransistor so it doesn’t pick up stray light or reflected light from the LED, as shown in Fig. 18.21. You can increase the effectiveness of the phototransistor placing an infrared filter (a dark red filter will do in a pinch) between the lens of the phototransistor and the disc. You can also use the type of phototransistor that has its own built-in infrared filter. If you find that the circuit isn’t sensitive enough, check whether stray light is hitting the phototransistor. Baffle it with a piece of black construction paper if necessary. Or, if you prefer, you can use a “striped” disc of alternating white and black spokes as well as a reflectance IR emitter and detector. Reflectance discs are best used when you can control or limit the amount of ambient light that falls on the detector. QUADRATURE ENCODING So far we’ve investigated shaft encoders that have just one output. This output pulses as the shaft encoder turns. By using two LEDs and phototransistors, positioned 90° out of phase (see Fig. 18.22), you can construct a system that not only tells you the amount of travel, but the direction as well. This can be useful if the wheels of your robot may 274 WORKING WITH DC MOTORS LED Disc Mounting bracket Phototransistor and baffle Circuit board with LED and phototransistor soldered to it FIGURE 18.21 How to mount an infrared LED and phototransis- tor on a circuit board for use with an optical shaft encoder disc. Ch18_McComb 8/18/00 2:11 PM Page 274 slip. You can determine if the wheels are moving when they aren’t supposed to be, and you can determine the direction of travel. This so-called two-channel system uses quad- rature encoding—the channels are out of phase by 90° (one quarter of a circle). Use the flip-flop circuit in Fig. 18.23 to “separate” the distance pulses from the direc- tion pulses. Note that this circuit will only work when you are using quadrature encoding, where the pulses are in the following format: off/off on/off ODOMETRY: MEASURING DISTANCE OF TRAVEL 275 Phototransistor LED 2 Phototransistor LED 1 Shaft LEDs 90 degrees out of phase A B FIGURE 18.22 LEDs and phototransistors mounted on a two-channel optical disc. a. The LEDs and phototransistors can be placed anywhere about the circum- ference of the disc; b. The two LEDs and phototransistors must be 90° out of phase. Ch18_McComb 8/18/00 2:11 PM Page 275 [...]... 299 ROTATIONAL LIMITS 299 The Role of the Potentiometer The potentiometer of the servo plays a key role in allowing the motor to set the position of its output shaft The potentiometer is physically attached to the output shaft (and in some servo models, the potentiometer is the output shaft) In this way, the position of the potentiometer very accurately reflects the position of the output shaft of the. .. on the phasing sequence Today, the more common method for operating a bipolar stepper motor is to use a specialty stepper motor translator, such as the SGS-Thompson L 297 D (the L 297 D can also be used to drive unipolar stepper motors) To add more current driving capacity to the L 297 D you can add a dual H-bridge driver, such as the L 298 N, which is available from Ch 19_ McComb 8/ 29/ 00 8:36 AM Page 290 290 ... well as other options you can add to this circuit The CMOS version, shown in Fig 19. 9 (refer to the parts list in Table 19. 3), is identical to the TTL version, except that a 4070 chip is used for the Exclusive OR gates and a 4027 is used for the flip-flops The pinouts are slightly different, so follow the correct schematic for the type of chips you use Note that another CMOS Exclusive OR package, the 4030,... representation of the stepping sequence Adding an LED and current-limiting resistor in parallel with the outputs provides just such a visual indication See Fig 19. 11 for a wiring diagram (refer to the parts list in Table 19. 5) Note the special wiring to the flip-flop outputs This provides a better visual indication of the stepping action than hooking up the LEDs in the same order as the motor phases Figure 19. 12... As the wiper inside the potentiometer moves, the voltage changes The control circuit in the servo correlates this voltage with the timing of the incoming digital pulses and generates an “error signal” if the voltage is wrong This error signal is proportional to the difference between the position of the potentiometer and the timing of the incoming signal To compensate, the control board applies the. .. controls the servo, but the duration of the pulses that matters The servo requires about 30 to 60 of these pulses per second This is referred to as the refresh rate; if the refresh rate is too low, the accuracy and holding power of the servo is reduced Ch20_McComb 8/18/00 2:22 PM Page 297 SERVOS AND PULSE WIDTH MODULATION 297 FIGURE 20.1 The typical radio-controlled (R/C) servo motor FIGURE 20.2 The internals... earlier, the angular position of the servo is determined by the width (more precisely, the duration) of the pulse This technique has gone by many names over the years One you may have heard is digital proportional the movement of the servo is proportional to the digital signal being fed into it The power delivered to the motor inside the servo is also proportional to the difference between where the output... until you find the value that works without causing the flip-flop chips to overheat You can also apply Ohm’s law, figuring in the current draw of the motor and the gain of the transistor, to accurately find the correct value of the resistor If this is new to you, see Appendix A, “Further Reading,” for a list of books on electronic design and theory 286 1-2 K, 2-5 W All diodes: 1N4002 11 10 9 7 8 12 6 5... If the motor has six wires, then four of the leads go to one side of the windings The other two are commons and connect to the other side of the windings (see Fig 19. 16) Decoding this wiring scheme takes some patience, but it can be done First, separate all those wires where you get an open reading At the end of your test, there should be two three-wire sets that provide some reading among each of the. .. pulling pin 12 HIGH or LOW The stepping actuation is controlled by a 7476, which contains two JK flip-flops The Q and ‘Q outputs of the flip-flops control the phasing of the motor Stepping is accomplished by triggering the clock inputs of both flip-flops The 7476 can’t directly power a stepper motor You must use power transistors or MOSFETs to drive the windings of the motor See the section titled “Translator . or decrease the duration of the pulses emitted by the gates of the 4011. The longer the dura- tion of the pulses, the faster the motor because it is getting full power for a longer period of time. The. time. The shorter the duration of the pulses, the slower the motor. Notice that the power or voltage delivered to the motor does not change, as it does with the pot-only or pot-transistor scheme. line. MOUNTING THE HARDWARE Secure the shaft encoder to the shaft of the drive motor or wheel. Using brackets, attach the LED so that it fits snugly on the back side of the disc. You can bend the lead of the

Ngày đăng: 10/08/2014, 04:22

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan