Table 5.5 Pin Descriptions 1,15 Sense A; Sense B Between this pin and ground is the sense resistor connected to control the current of the load.. 2,3 Out 1; Out 2 Outputs of the Bridge A
Trang 1tery pack The grounds are, and must be, connected (common ground).
The circuit’s block diagram is shown in Figure 5.42.
Maximum Ratings The maximum ratings are shown in Figure 5.43.
I really like this chip because it will shut down if it is overloaded and becomes hot It is a nasty sight (and smell) seeing a smoke plume when an overloaded component like a transistor melts down The L298 can handle a respectable load for its compact size (3 amps, 25 watts) It might be overkill for the motors it drives in this project, but
it also means that you can connect much more powerful motors if you decide to change the design The enable feature and the 2-pin logic lines (with a wide voltage range of –0.3 to 7 V) per side makesa great logic interface ST microelectronics and Protel provide the footprint and profile for use in the Protel 98 and Protel DXP circuit design pro-grams allowing you to simply drop the chip into your circuit design
Figure 5.44 a picture of the package we are using in the project
show-ing the pin layout The short pins are set forward, and the longer are
to the back of the chip
Table 5.5
Pin Descriptions
1,15 Sense A; Sense B Between this pin and ground is the sense resistor
connected to control the current of the load.
2,3 Out 1; Out 2 Outputs of the Bridge A; the current that flows through
the load connected between these two pins is monitored
at pin 1.
(continued on next page)
Figure 5.43
Maximum ratings.
Trang 2Table 5.5 Pin Descriptions (continued)
4 Vs Supply Voltage for the Power Output stages A
noninductive 100nF capacitor must be connected between this pin and ground.
5,7 Input 1; Input 2 TTL Compatible Inputs of the Bridge A.
6,11 Enable A; EnableB TTL Compatible Enable Input: the L state disables the
bridge A (enable A) and/or the bridge B (enable B).
9 VSS Supply Voltage for the Logic Blocks A100nF capacitor
must be connected between this pin and ground 10,12 Input 3; Input 4 TTL Compatible Inputs of the Bridge B.
13,14 Out 3; Out 4 Outputs of the Bridge B The current that flows through
the load connected between these two pins is monitored
at pin 15.
Figure 5.45 shows how to wire one side of the chip for bidirectional
motor control This is how the chip is wired in PDA Robot Pins 10 and 12 are connected to Port B pins on the PIC16F876 that have been configured through the C code as outputs (see Chapter 7: Programming the PIC16F876 Microcontroller) In PDA Robot, the sense pins 1 and
15 are tied to the ground We can feed this into one of the analog pins
on the PIC16F876 and determine the current draw on the motors (explained below) If the motor is drawing too much current, shut it down You can experiment with this A command could be sent to the
Chapter 5 / The Electronics
99 Figure 5.44 L298 pin layout.
Trang 3Figure 5.46
Paralleled channels
for high current.
Figure 5.45
Bidirectional motor
control (C = 1 and
D = 0 ) For ward, (C
= 0 and D = 1)
Reverse, (C = D)
Fast Motor Stop.
Trang 4robot to retrieve and forward this information to the PDA (like the range-finder information), where it can be displayed and analyzed We could determine the speed of PDA Robot based on the current draw after calibrating on a hard, flat surface This is not a very accurate method of determining the speed and distance traveled, but it will give you a good estimate Things like the incline and traction will affect the accuracy
For higher currents, outputs can be paralleled Take care to parallel
channel 1 with channel 4 and channel 2 with channel 3 Figure 5.46
shows how to accomplish this
Power Output Stage. The L298 integrates two power output stages (A; B) The power output stage is a bridge configuration, and its out-puts can drive an inductive load in common or differential mode, depending on the state of the inputs The current that flows through the load comes out from the bridge at the sense output An external resistor (RSA; RSB) allows one to detect the intensity of this current
Input Stage. Each bridge is driven by means of four gates, the input
of which are In1; In2; EnA and In3; In4; EnB The In inputs set the bridge state when the En input is high; a low state of the En input inhibits the bridge All the inputs are TTL compatible
Suggestions. A noninductive capacitor, usually of 100 nF, must be foreseen between both Vs and Vss to ground as near as possible to GND pin When the large capacitor of the power supply is too far from the IC, a second smaller one must be near the L298 The sense resis-tor, not of a wire wound type, must be grounded near the negative pole
of Vs that must be near the GND pin of the IC Each input must be con-nected to the source of the driving signals by means of a very short path
Turn on and turn off: Before you can turn on the supply voltage and
to turn it off; the enable input must be driven to the low state
Applications. The external bridge of diodes D1 to D4 is made of four fast recovery elements (trr 3 200 n) that must be chosen from a VF as low as possible at the worst case of the load current The sense output voltage can be used to control the current amplitude by chopping the
Chapter 5 / The Electronics
101
Trang 5inputs, or to provide overcurrent protection by switching the enable input to low
The brake function (Fast motor stop) requires that the absolute maxi-mum rating of 2 amps must never be overcome When the repetitive peak current needed from the load is higher than 2 Amps, a paralleled configuration can be chosen
An external bridge of diodes is required when inductive loads are driven and when the inputs of the IC are chopped; Schottky diodes are preferred This solution can drive until 3 amps in DC operation and until 3.5 amps of a repetitive peak current The L298 is great for
driv-ing a stepper motor Figure 5.47 shows how this is accomplished
when the current is controlled by a L6506
The GP2D12 IR Range Finder
The GP2D12 is a low-cost, short-range IR alternative to ultrasonic range-finding systems Usable detection range is 10 cm to 80 cm (approx 4" to 31.5") The IR Object Detection System consists of the Sharp GP2D12 Distance Measuring Sensor The GP2D12 is a compact, Figure 5.47
Two phase bipolar stepper motor control circuit by using the current controller L6506.
Trang 6self-contained IR ranging system incorporating an IR transmitter, receiver, optics, filter, detection, and amplification circuitry The unit
is highly resistant to ambient light and nearly impervious to variations
in the surface reflectivity of the detected object
Unlike many IR systems, it has a fairly narrow field of view, making it easier to get the range of a specific target The field of view changes with the distance to an object, but is no wider than 5 cm (2.5 cm either side of center) when measuring at the maximum range One negative
about this range finder is its starting range of 10 cm Figure 5.48 shows
the physical dimensions of the range finder and its connector (www.hvwtech.com)
Chapter 5 / The Electronics
103 Figure 5.48
Physical dimensions of the range finder.
Trang 7The sensor unit may be mounted using the bracket provided The black foam should be applied to the bottom of the bracket using the sticky side of the foam, and then the black “snap rivet” is pushed through the large center hole on the bracket This snap rivet has been chosen to allow the bracket and foam to be mounted on a standard 0.062" PCB A 13/64" hole is required in the PCB for the snap rivet
Connecting to the Sensor
A custom cable assembly is included with the kit The miniature con-nector is keyed so that it may only be inserted one way: 1 Vcc Red ⫹
5 V DC, 2 GND Black Ground, 3 Vout Blue Input pin of microcontroller
Operation
The GP2D12 makes continuous analog measurements It does not require a trigger to initiate a measurement The distance to an object is returned as an analog voltage level After reading the voltage level pro-duced, a threshold can be set or a distance calculated By attaching the cabling to a suitable
The analog-to-digital converter or microcontroller with onboard A/D can be incorporated into many systems
Calibration
The calibration of the module is dependent on how the data are used
in your code For threshold-type applications, calibration involves determining the distance required and measuring the voltage at that distance, allowing for some variations in measurement In distance measuring applications the relation between voltage level and dis-tance is nonlinear; either a “look-up” table or a suitable calculation
ABSOLUTE MAXIMUM RATINGS (TA=25 °C, Vcc=5V)
Supply Voltage
Output Terminal Voltage
Operating Temperature
Storage Temperature
Vcc
V0
T opr
T stg
–0.3 to +7 –0.3 to Vcc +0.3 –10 to +60 –40 to +70
V V
°C
°C
Figure 5.49
Maximum ratings.
Trang 8must be determined The voltage levels representing distance will vary slightly from unit to unit A small survey of randomly selected
devices was conducted and data gathered are shown in Figure 5.50.
The columns Distance and Average Voltage in the sample data pro-vided can be used as a look-up table
Using the average of the voltage measurements for the four samples, the following graph was produced The data points indicate the aver-age values, and the line shows the best fit equation calculated The equation derived that best fits the average voltages is given as: Distance (cm) ⫽ 27 ⫻ (Voltage) ⫺1.1 This equation can be used for calculating the distance to an object by simply entering the voltage measured and calculating the distance in centimeters The preceding formula is provided for reference only; while it is shown to be quite accurate, part-to-part variation must be considered
Ambient Light
Tests have shown the GP2D12 to be highly immune to ambient light lev-els Incandescent, fluorescent, and natural light do not appear to bother
it The only instance where we were able to get it to falsely measure was when a flashlight was pointed directly into the sensor’s receiver; even a few degrees off center is enough for the sensor to ignore it
IR Light
The GP2D12 uses a modulated IR beam to guard against false trigger-ing from the IR component of incandescent, fluorescent, and natural light Tests with several kinds of IR remote controls have shown that even with two or three remotes pointed at the GP2D12, the unit still functions normally
Chapter 5 / The Electronics
105
Figure 5.50 Average distance versus voltage.
Trang 9Laser Light
Tests with a laser pointer had results similar to those with the flash-light; only a beam aimed straight into the sensor’s receiver would cause a false reading If the beam comes from even a few degrees off center, it has no effect
Operation
The GP2D12 uses an array of photo diodes (called a position sensitive detector, or PSD) and some simple optics to detect distance An IR diode emits a modulated beam; the beam hits an object and a portion of the light is reflected back through the receiver optics and strikes the PSD
CAUTION: The GP2D12 is a precision device Do not attempt to open
the unit Doing so will ruin the delicate alignment of the optics If you want to open one up, by all means do so, but realize beforehand that
it may not function properly afterward A block diagram of the
GP2D12 is shown in Figure 5.51.
Overall I found this to be an average range finder for PDA Robot I found that the 10-cm starting range and the narrow beam lead to lim-itations I will describe them in the chapters on programming the PIC16F876 and PDAs I would recommend looking into a sonar range finder
Figure 5.51
GP2D12 block diagram.
Trang 10This chapter explains step-by-step how to create the electrical and mechanical components of PDA Robot
Creating the Circuit Board
I created the circuit board using the M.G Chemicals system The M.G Chemicals system allows you to make your own circuit boards
quick-ly and easiquick-ly It is perfect for prototyping, hobbyists, and educational applications Technicians will be impressed with the high resolution, while amateurs will be impressed with the simplicity of the system
I purchased the Photofabrication Kit 416-K to create the PDA Robot circuit board It includes the following:
• One 3" ⫻ 5" cat #603 presensitized single-sided PCB
• One 4" ⫻ 6" cat #606 presensitized single-sided printed circuit board (PCB)
• One 6" ⫻ 6" cat #609 presensitized single-sided PCB
• One 475 ml bottle cat #418 developer
• One 475 ml bottle cat #415 ferric chloride
• Two cat #416-S foam brushes
Building PDA
Robot
6
Copyright 2003 by The McGraw-Hill Companies, Inc Click Here for Terms of Use.
Trang 11• Plastic development tray
• Rubber gloves
• Instruction sheet
Figure 6.1 shows everything that is included in the kit.
Positive Photofabrication Process Instructions
Setup. Protect surrounding areas from developer and etchant
splash-es Plastic is ideal for this Work under safe light conditions A 40 W incandescent bulb works well Important: Do not work under fluores-cent light If you do so, you will expose the board, making it unusable Just prior to exposure, remove white protective film from the presen-sitized board Peel it back carefully
Exposing Your Board. For best results, use M.G Chemicals cat
#416-X exposure kit; however, any inexpensive lamp fixture that will hold two or more 18" fluorescent tubes is suitable
Place the presensitized board with the copper side toward the expo-sure source Lay positive film artwork onto the presensitized copper side of the board and position as desired Place the artwork printed side down to prevent light leakage through the side of the
transparen-cy Artwork should have been produced by a 600 dpi or better printer
Figure 6.1
Contents of the
Photofabrication Kit
416-K.
Trang 12Use a glass weight to cover the artwork, ensuring that no light will pass under traces (approx 3 mm glass thickness or greater works best) Use a 10-minute exposure time at a distance of 5"
The artwork in Figure 6.3 needs to be reproduced on a transparency and placed on the presensitized “green” surface of the circuit board To do
this, either scan the artwork and print, make a high-quality photocopy,
or download the file from www.pda-robotics.com and print using a photo editor From the printer options, set the quality to its highest
pos-sible setting I recommend checking the leads on the components to ensure that the drill holes are the correct size and every hole lines up
Important: You must print the image at 100% If your printer settings
are not correct, the components will not fit Watch out for the compo-nents themselves I found that the higher-priced compocompo-nents fit
perfect-ly, but with some of the less-expensive components, the pad and hole sizes on the artwork may need to be enlarged or the leads filed or crimped This happened with the voltage regulators and L298 chips Variations from manufacturer to manufacturer will occur To increase the hole sizes, simply load the image into an image editor like Paintbrush, and draw in white space after increasing the size of the pad
Be careful when expanding the sizes You don’t want any of the traces
to touch each other, and it’s good to leave as much space as possible After printing the artwork on a good-quality transparency, cut it out using a utility knife or scissors and put it on the presensitized side
after carefully peeling the protective cover off (see Figures 6.3 and
6.4).
Note: Ensure that the printing on the board in not reversed when plac-ing on the presensitized side The letterplac-ing “PDA Robotics” should be shown as printed normally, not reversed
Chapter 6 / Building PDA Robot
109
Figure 6.2 Fluorescent exposure.