1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

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

35 272 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 35
Dung lượng 488,14 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

As the wheel rotates, it provides a signal to the counting cir- min-270 WORKING WITH DC MOTORS LED Phototransistor Shaft encoder Motor Output of phototransistor FIGURE 18.16 An optical s

Trang 1

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 apotentiometer While this scheme certainly works, it wastes a lot of energy Turning up theresistance of the pot decreases the speed of the motor, but it also causes excess current toflow 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 basiccircuit, 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 ordecrease 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 withthe pot-only or pot-transistor scheme described earlier The only thing that changes is theamount 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 relativeon/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

FIGURE 18.11 How not to vary the speed of a motor.

This approach is very inefficient.

Trang 2

Excessively high PWM frequencies may negate the speed control aspect, whereas sively low frequencies may cause significant current draw and motor heating.

exces-In the circuit shown in Fig 18.12, R3 is shown surrounded by a dotted box You cansubstitute R3 with a fixed resistor if you want to always use a certain speed, or you can usethe 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 theswitches are collectively connected to the 4011 To modify the speed of the motor, activateone of the switches by bringing its control input to HIGH The resistor connected to thatswitch is then brought into the circuit You can omit the 3.3K pull-down resistors on thecontrol 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

1

4 5

s s

Q5 g d

s

Motor control

LED1

R2 1M

7

14

0.1 C1

0 1 Forward Reverse

Direction control

g d

s

M1

0 1 On Off

4011 (1/4) 4011(1/4)

4011 (1/4)

FIGURE 18.12 A rudimentary speed and direction control circuit using

power MOSFETs Resistor R1 and the LED serve to cate that the motor is on.

Trang 3

indi-little resistance of its own when the switches are on Note that the 4066 specifications sheetsays 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 choicesyou have You may want to go from 90 percent to 88 percent duty cycle to control yourmotor, but the selection of resistors that you’ve used only provide for 90 percent and 80percent, 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 drawstoo much current Instead, you connect the output of the computer or microcontroller to thecontrol 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

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).

Trang 4

MOTOR SPEED CONTROL 269

1 2 3 4 5 6

7

8 9 10 11 12 13 14 +12V

R1* R2*

To point "B"

For additional speeds

To point "A" Speed A

Speed B

0 1 On Off

0 1 On Off

*Set Value of R1 and R2 for Desired Speed

IC14066

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 MDropping resistor

(optional)

On-off and/orspeed

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.

Trang 5

Odometry: Measuring Distance

of TravelShaft encoders allow you to measure not only the distance of travel of the motors, but theirvelocity By counting the number of transitions provided by the shaft encoder, the robot’scontrol 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 Aninfrared-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, asseen by the phototransistor, is a series of flashing light

Instead of mounting the shaft encoders on the motor shafts, mount them on the wheelshafts (if they are different) The number of slots in the disk determines the maximumaccuracy 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 imum sensing angle of 7.2° As the wheel rotates, it provides a signal to the counting cir-

min-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.

Trang 6

cuit every 7.2° Stated another way, if the robot is outfitted with a 7-inch wheel ference  21.98 inches), the maximum travel resolution is approximately 0.44 linear inch-

(circum-es Not bad at all! This figure was calculated by taking the circumference of the wheel anddividing it by the number of slots in the shaft encoder

The outputs of the phototransistor are conditioned by Schmitt triggers This smooths outthe 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 Thepulses must be counted and the count converted to distance Counting and conversion areideal 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’dprobably 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 parator A pinout of this versatile chip is shown in Fig 18.18 and a basic hookup diagram

com-in Fig 18.19 In operation, the chip will compare the bcom-inary weighted number at its “A”and “B” inputs One of the three LEDs will then light up, depending on the result of thedifference 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

Trang 7

272 WORKING WITH DC MOTORS

1 2 3 4 5 6 7

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

A0 B1 A1 A2 B2 A3

Outputs

Data outputs

A B C D

15 13 12 10

A B C

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.

Trang 8

recording purposes Using a disc with 25 slots in it and a 7-inch drive wheel, the travelresolution is 0.84 linear inches Therefore, the counter system will stop the robot within0.84 inches of the desired distance (allowing for coasting and slip between the wheels andground) 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 theencoder disc

MAKING THE SHAFT ENCODER

By far, the hardest part about odometry is making or adapting the shaft encoders (Youcan also buy shaft encoders ready-made.) The shaft encoder you make may not have thefine 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 findalready 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 encoderwheels 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 ormetal and drilling holes in it Remember that the disc material must be opaque toinfrared 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.

Trang 9

When in doubt, add a coat or two of flat black or dark blue paint That should block strayinfrared 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 thisscribe line

MOUNTING THE HARDWARE

Secure the shaft encoder to the shaft of the drive motor or wheel Using brackets, attach theLED so that it fits snugly on the back side of the disc You can bend the lead of the LED abit 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 (adark red filter will do in a pinch) between the lens of the phototransistor and the disc Youcan 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 thephototransistor Baffle it with a piece of black construction paper if necessary Or, if youprefer, you can use a “striped” disc of alternating white and black spokes as well as areflectance 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

DiscMounting bracket

Phototransistorand baffle

Circuit boardwith LED and phototransistorsoldered 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.

Trang 10

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 rature encoding—the channels are out of phase by 90° (one quarter of a circle).

quad-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/offon/off

ODOMETRY: MEASURING DISTANCE OF TRAVEL 275

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.

Trang 12

on/onoff/on(… and repeat.)

From Here

Selecting the right motors for your robot Chapter 17, “Choosing the Right Motor for the Job”Using stepper motors Chapter 19, “Working with Stepper Motors”Interfacing motors to computers and Chapter 29, “Interfacing with Computers and microcontrollers Microcontrollers”

More on odometry and measuring the Chapter 38, “Navigating through Space”

distance of travel of a robot

FROM HERE 277

Trang 13

This page intentionally left blank.

Trang 14

In past chapters we’ve looked at powering robots using everyday continuous DC motors.

DC motors are cheap, deliver a lot of torque for their size, and are easily adaptable to avariety of robot designs By their nature, however, the common DC motor is rather impre-cise Without a servo feedback mechanism or tachometer, there’s no telling how fast a DCmotor is turning Furthermore, it’s difficult to command the motor to turn a specific num-ber of revolutions, let alone a fraction of a revolution Yet this is exactly the kind of preci-sion robotics work, particularly arm designs, often requires

Enter the stepper motor Stepper motors are, in effect, DC motors with a twist Instead

of being powered by a continuous flow of current, as with regular DC motors, they are ven by pulses of electricity Each pulse drives the shaft of the motor a little bit The morepulses that are fed to the motor, the more the shaft turns As such, stepper motors are inher-ently “digital” devices, a fact that will come in handy when you want to control your robot

dri-by computer By the way, there are AC stepper motors as well, but they aren’t really able for robotics work and so won’t be discussed here

suit-Stepper motors aren’t as easy to use as standard DC motors, however, and they’re bothharder to get and more expensive But for the applications that require them, steppermotors can solve a lot of problems with a minimum of fuss Let’s take a closer look at step-pers and learn how to apply them to your robot designs

Trang 15

Inside a Stepper MotorThere are several designs of stepper motors For the time being, we’ll concentrate onthe most popular variety, the four-phase unipolar stepper, like the one in Fig 19.1 Aunipolar stepper motor is really two motors sandwiched together, as shown in Fig 19.2.Each motor is composed of two windings Wires connect to each of the four windings

of the motor pair, so there are eight wires coming from the motor The commons fromthe windings are often ganged together, which reduces the wire count to five or sixinstead of eight (see Fig 19.3)

WAVE STEP SEQUENCE

In operation, the common wires of a unipolar stepper are attached to the positive times the negative) side of the power supply Each winding is then energized in turn bygrounding it to the power supply for a short time The motor shaft turns a fraction of a rev-olution each time a winding is energized For the shaft to turn properly, the windings must

(some-be energized in sequence For example, energize wires 1, 2, 3, and 4 in sequence and themotor turns clockwise Reverse the sequence, and the motor turns the other way

FOUR-STEP SEQUENCE

The wave step sequence is the basic actuation technique of unipolar stepper motors.Another, and far better, approach actuates two windings at once in an on-on/off-off four-step sequence, as shown in Fig 19.4 This enhanced actuation sequence increases the dri-ving power of the motor and provides greater shaft rotation precision

There are other varieties of stepper motors, and they are actuated in different ways Oneyou may encounter is bipolar It has four wires and is pulsed by reversing the polarity ofthe power supply for each of the four steps We will discuss the actuation technique forthese motors later in this chapter

Design Considerations of Stepper Motors

Stepping motors differ in their design characteristics over continuous DC motors Thefollowing section discusses the most important design specifications for steppermotors

STEPPER PHASING

A unipolar stepper requires that a sequence of four pulses be applied to its various ings for it to rotate properly By their nature, all stepper motors are at least two-phase.Many are four-phase; some are six-phase Usually, but not always, the more phases in amotor, the more accurate it is

wind-280 WORKING WITH STEPPER MOTORS

Trang 16

STEP ANGLE

Stepper motors vary in the amount of rotation of the shaft each time a winding is energized

The amount or rotation is called the step angle and can vary from as small as 0.9° (1.8° is more

common) to 90° The step angle determines the number of steps per revolution A stepper with

a 1.8° step angle, for example, must be pulsed 200 times for the shaft to turn one complete olution A stepper with a 7.5° step angle must be pulsed 48 times for one revolution, and so on

rev-DESIGN CONSIDERATIONS OF STEPPER MOTORS 281

FIGURE 19.1 A typical unipolar stepper motor.

Rotor (shaft)

Stator cup

Stator cup 2Coil

Coil

FIGURE 19.2 Inside a unipolar stepper motor Note the two sets

of coils and stators The unipolar stepper is really two motors sandwiched together.

Trang 17

PULSE RATE

Obviously, the smaller the step angle is, the more accurate the motor But the number ofpulses stepper motors can accept per second has an upper limit Heavy-duty steppers usu-ally have a maximum pulse rate (or step rate) of 200 or 300 steps per second, so they have

an effective top speed of one to three revolutions per second (60 to 180 rpm) Some

small-er steppsmall-ers can accept a thousand or more pulses psmall-er second, but they don’t usually vide very much torque and aren’t suitable as driving or steering motors

pro-Note that stepper motors can’t be motivated to run at their top speeds immediately from

a dead stop Applying too many pulses right off the bat simply causes the motor to freeze

up To achieve top speeds, you must gradually accelerate the motor The acceleration can

282 WORKING WITH STEPPER MOTORS

Phase 1

Phase 2

Phase 3

Phase 4 Ground Ground

STEP PHASE 1 PHASE 2 PHASE 3 PHASE 4 1

2 3 4

ON OFF

Counterclockwise Clockwise

FIGURE 19.3 The wiring diagram of the unipolar stepper.

The common connections can be separate or combined.

FIGURE 19.4 The enhanced on-on/off-off four-step sequence

of a unipolar stepper motor.

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

TỪ KHÓA LIÊN QUAN