Naša naloga v projektu je izdelava vezja in programa za krmiljenje servo, enosmernega (DC) in koračnega motorja. Osrednji del vezja bo integrirano vezje L293H. Več o lastnostih vezja in naših predlogih je zapisano v sami predstavitvi naših nalog za drugo izmenjavo dijakov in učiteljev na Siciliji.
Drive to DC, servo and stepper motor
Our suggestion is that we should use one half-H driver L293D which is designed to provide bidirectional drive currents of up to 600-mA at each output at voltages from 4.5 V to 36 V.
An H bridge enables a voltage to be applied across a load in either direction. These circuits are often used in motor applications to allow DC motors to run forwards and backwards and also to run stepper motors.
The L293D device needs a few external components. With this half bridge we can drive one bipolar stepper motor or DC or also a servo motor. All inputs are TTL-compatible and the L293D can be directly linked to the microcontroller output. An on chip thermal protection circuit disables the buffer if an overload condition arises.
If we look at the function table, then we see that when the enabled inputs are low, those drivers are disabled, and their outputs are off and in a high-impedance state. In this state the current consumption is minimized. When an enabled input is high, the associated drivers are enabled, and their outputs are active and in phase with their inputs.
Each output has an integrated high speed diode. These flyback diodes protect the IC outputs against voltage surges caused by the switching of inductive loads. But we suggest that we should use external Schokley output diodes for inductive transient suppression.
L293D has two separate supply terminals. These are VCC1 and VCC2. VCC2 is provided to supply output load and VCC1 is provided for the logic inputs to minimize device power dissipation.
Our PCB board also needs an external supply for motors. We sugest 12 V for DC and stepper motors and 5 V for servo motors. The power supply of L293D has been kept as simple as possible, with all parts capable of working at 12 V. The VCC1 supples of L293D receive supply voltage from regulator.
The motor is totaly controlled by just four processor control lines. We suggest that we should connect enable input of the L293D directly the supply Vcc1 (5V). In our project we plan to drive motors via buttons. We need button 1 to turn the motor left, button 2 to turn it right, button 3 to speed up and last for speed down. For changing speed, we can also use analog input, for example (AD0). We can add two buttons on input ports more. One input port which decides whether the motor moves whole or half steps for each pulse and another input port which wether L293D enabled or disabled.
But on other side we can use a keybord to change speed and rotation direction.
Input AD
|
Input - Buttons
|
Stepper mot or
|
DC motor
|
Servo motor
|
/
|
Bt 1
|
Left
|
left
|
Left
|
/
|
Bt 2
|
Right
|
right
|
Right
|
AD0
|
Bt 3
|
Speed Up
|
Speed Up
|
/
|
AD0
|
Bt 4
|
Speed Down
|
Speed Down
|
/
|
We suggest that we should use three output connectors, one connector for applying a stepper motor, one for DC and one for the servo motor. We should use one connector for applying a stepper or DC motor but separete connectors on PCB board are more didactic and students do not get confused by connection of diferent types of motors.
Particularity (speciality) of driving a stepper motor
Full step
M1
|
M2
|
M3
|
M4
|
0
|
1
|
1
|
0
|
0
|
1
|
0
|
1
|
1
|
0
|
0
|
1
|
1
|
0
|
1
|
0
|
If we want change to direction od rotation of a motor then we have to invert M1 and M2 or M3 and M4
Half step
M1
|
M2
|
M3
|
M4
|
1
|
0
|
0
|
1
|
1
|
0
|
0
|
0
|
1
|
0
|
1
|
0
|
0
|
0
|
1
|
0
|
0
|
1
|
1
|
0
|
0
|
1
|
0
|
0
|
0
|
1
|
0
|
1
|
0
|
0
|
0
|
1
|
The same is true for half step. But in this case the motor moment decreases by 30 %.
The H-bridge arrangement is generally used to reverse the polarity of the motor, but can also be used to 'brake' the motor, where the motor comes to a sudden stop, as the motor's terminals are shorted, or to let the motor 'free run' to a stop, as the motor is effectively disconnected from the circuit. The following table summarises operation, with S1-S4 corresponding to the diagram above.
M1
|
M2
|
M3
|
M4
|
|
1
|
0
|
0
|
1
|
Motor moves right
|
0
|
1
|
1
|
0
|
Motor moves left
|
0
|
0
|
0
|
0
|
Motor free runs
|
0
|
1
|
0
|
1
|
Motor brakes
|
1
|
0
|
1
|
0
|
Motor brakes
|
Particularity (speciality) of drivening a SERVO motor
The speed or position is controlled in relation to a positional input signal or reference signal applied to the device.
We know that most servo motors are being able to rotate up to about 180 degrees in both directions which makes them ideal for accurate angular positioning. The angle of rotation of therotor shaft is determineted by duty cycle of PWM signal.
Programming microcontrollers
What have we done so far? We have tested the C compiler and we have a very good opinion about it. We have made some programs to test the LCD display, PWM which is driven with buttons or an AD convertor. We do not drive any motors with PIC F18 for now but only drive an LED diode. But you know, we can also see how the PWM works. We do not expect any problems with driving the motors.