s12 Motor Control

8

Click here to load reader

description

s12

Transcript of s12 Motor Control

Page 1: s12 Motor Control

Page 1 of 8 4/14/2008 FCH

ECE649 Laboratory Exercise Six DC Motor Interfacing and Control

Introduction:

In this laboratory exercise a small DC servo motor will be interfaced to the HCS12 microcontroller. See Figure 1. A control application will be developed to keep the speed of the motor constant when varying loads are applied. The DC motor has a built-in tachometer that can be interfaced to the HCS12 to determine its angular rotation speed. A small DC generator and power resistors will be attached to the motor to create an external load.

An H-Bridge motor driver circuit will be used to interface the DC motor to the HCS12. The H-Bridge will control the direction of the motor’s rotation and the speed of the motor. The H-bridge is built into an L293D integrated circuit, along with internal clamp diodes to protect the L293D from large voltage and current spikes. The HCS12’s pulse width modulation (PWM) port will be used to control the speed of the motor while one of the HCS12’s parallel port bits will be used to control the direction of the DC motor. The tachometer’s output will be conditioned allowing it to be interfaced to an input port of the HCS12.

HCS12 Microcontroller

With Control

Application

DC Motor &

Tachometer

DC Generator

Motor Driver Circuit:

H-Bridge

Power Resistor

Load

External Power Sources Dual Supply

Figure 1, System Block Diagram

PWM Port And Direction

Tach Input

Tachometer Interface Circuit

Page 2: s12 Motor Control

Page 2 of 8 4/14/2008 FCH

The control application should allow the motor to be operated in forward and reverse directions. The speed of motor’s forward and reverse directions should be controlled separately, i.e., the forward speed could be X1 RPMs while the reverse speed could be X2 RPMs. The forward speed should be regulated so that an external load applied will not change the speed of the motor. The reverse speed should be unregulated, i.e., the applied load should be allowed to change the motor’s speed. A key on the keypad should be used to change the direction of rotation. This will allow the user to observe the difference between the regulated and unregulated control. System Devices and Parameters: External Power Supply Dual Voltage – Adjustable H-Bridge Circuit L293D Op Amp LM324 Wire Wrap Sockets & Headers TBD Motor Startup Current Approximately 1.2 amps Motor Steady State Current with No Load Approximately 212 ma Motor Steady State Current with 20 ohm Load Approximately 261 ma Motor Steady State Current with 10 ohm Load Approximately 279 ma Motor No Load RPMs Approximately 3825 Tachometer Output vs. RPM 8 Pulses per Revolution Tachometer Output Voltage Sine Waveform Centered at 0.0 v Tachometer Frequency Resistor Load 510 0 466 20 ohms 454 10 ohms Procedure: I. H-Bridge Design The H-Bridge circuit controls the speed and direction of the motor. See Figure 2. If Q3 and Q1 are on (Q4 and Q2 are off) then the motor will rotate in one direction while if Q4 and Q2 are on (Q1 and Q3 are off) the motor will rotate in the opposite direction. If transistors (Q3 and Q2) and/or (Q4 and Q1) are on the power supply becomes shorted to ground – a BAD condition. Resistors R1-R4 limit the currents into the bases of the Darlington configurations. Diodes D1-D4 protect the transistors from large reverse voltages and currents. This H-Bridge circuit, clamp diodes, and digital logic interface circuitry are all built into the L293D (see Figures 2 through 7). A sample tachometer interface is show in Figure 8. Notice there are two power supplies required. Both voltages are going to be supplied by separate bench-top DC power sources. Using bench-top power supplies will help insure we do not damage the HCS12.

Page 3: s12 Motor Control

Page 3 of 8 4/14/2008 FCH

Page 4: s12 Motor Control

Page 4 of 8 4/14/2008 FCH

Figure 3, Top Level Schematic of the L293D

Page 5: s12 Motor Control

Page 5 of 8 4/14/2008 FCH

Figure 4, Motor Connections to L293D

Figure 5, Bi-directional Motor Control

Page 6: s12 Motor Control

Page 6 of 8 4/14/2008 FCH

Figure 6, Internal Schematic of the L293D

Figure 7, Electrical Characteristics of the L293D

Page 7: s12 Motor Control

Page 7 of 8 4/14/2008 FCH

V15 V

U1A

LM324AN3

2

11

4

1V2

1 V 1kHz 0Deg 3

0

R1

1kΩ

R2

1000kΩ

4 U2A

74ALS04BN

2 51

Figure 8, Sample Signal Conditioning Circuit for Tachometer

Page 8: s12 Motor Control

Page 8 of 8 4/14/2008 FCH

Phase Ia:

• Construct a schematic of the L293D H-Bridge, motor, HCS12, tachometer, and circuit to condition the tachometer’s output to input levels compatible with the HCS12 ports. Annotate the schematic with device names and pin numbers. Include the connections to the HCS12 I/O ports.

• Construct a wire wrap list and parts list Report:

• Abstract • Detailed Schematic

Phase Ib:

• Wire wrap the circuit on the supplied proto board • Use the parallel ports of the HCS12 to control the direction of the motor. No

speed control is required in phase I. • Debug the circuit if it is not functioning properly • Demonstrate your properly working motor control circuit to the course

instructor Phase II In phase two you will develop a software based motor controller as described in a separate handout.