H Bridges
H-Bridges allow forward and reverse motor control. To get a motor to turn in one direction, simply close an opposing pair of switches. For instance, in the diagram if you close the A and D switches, the motor should turn in one direction, perhaps clockwise. If the B and C switches are to be closed with A and D open, then the motor turns the opposite direction, in this case counter clockwise. Now to actually use this, you need some way to control the switches. In some cases 4 relays will work as the switches or 4 transistors or even all of the circuit packaged in a chip. Chips usually include an enable line (turns it all on or off), power lines (for the chip and the motor), switching inputs, and the outputs to drive the motor.
I've used the Texas Instruments 754410, an advanced version of the L293D dual h bridge. In my use the enables are tied high and each input pin is directly connected to an output line of the controller. To make a motor turn, a high (+5 volts or logic 1) is sent to the 1A line while a low (0 volts or logic 0) is delivered to the 2A line, causing the motor to turn. To reverse the motor, just output a high on 2A and a low on 1A. The other motor runs based on the 3A and 4A inputs. Better circuits might connect an inverter (74xx04) between a single controller output pin and the 2A input of the h-bridge, with that same controller line being directly connected to the 1A input. That way you use one controller line to completely control motor direction but the motor is constantly driven, unless you then control the enables. Even better circuits exist that implement speed and position control. To do this an postion device of some sort has to be connected to the motor shaft, to show how fast or where the motor is in it's rotation. This can be a slotted wheel similar to those found in computer mice, or a continuous potentiometer, or a hall effect (magnetic) sensor. To control the motor speed, most use a technique called pulse width modulation or PWM. PWM pulses the voltage to the motor in such a way that an average voltage is achieved. Say that full voltage is 12 volts, a PWM duty cycle (ratio of on time to off time) of 50% is used, then an average voltage of 6 volts is delivered. By defining how fast you want the motor to turn and counting pulses from the encoder over a time period to tell how fast it actually is turning, you can adjust the PWM duty cycle to get the motor speed you want. Position control would involve taking close account of the pulses or perhaps a resistance level in a potentiometer. If you only want the motor to make 1/2 turn, then you might count the number of pulses it takes to make that turn, then brake the motor once it arrives there or quickly switch it between clockwise and counterclockwise signals for a net braking effect. There are various discussions as to what a good frequency for PWM which discuss mechanical time constants, electrical time constants and efficiency, but in general, it seems best to experiment with the value. Some have good success with 1-3 kHz, others find values of 20 kHz and higher better, depending on the motor and probably the method of applying PWM. Many commercial controllers use the higher 20kHz plus frequencies, but are meant for higher power commercial motors. Methods of implementing PWM include sign magnitude and locked antiphase. Sign Magnitude requires a direction input and the PWM input. The direction is set either forward or reverse (sign) and the PWM controls how much power (magnitude) is output to the motor. One form of sign magnitude PWM applies the signal to an enable line to cycle the power to the motor. On the 754410, a direction input can set 1A high and through an inverter or another controller line set 2A low while the PWM switches the 1,2 enable input. The motor simply goes from driven to free coast in this case. Another form of sign magnitude involves PWM applied to one input of the driver, where the direction controls the other side. For example, on the 754410, input 2A is set low by the direction signal, while the PWM signal switches input 1A. The output in this case goes from clockwise (1A high, 2A low) to brake (1A and 2A low). If you want to reverse direction, input 2A can be set high while 1A still recieves the PWM signal. In this case the motor goes from counterclockwise (1A low, 2A high) to brake (1A high and 2A high). In other h-bridge designs, especially discrete components, driving both sides high can be a problem in that it creates a short through the chip from the supply to ground and can cook the circuit. Locked antiphase uses only the PWM signal to determine both delivered power and direction. An inverter is hooked between the one side and the other to reverse the PWM for one side. In the high part of the PWM cycle, the motor is driven clockwise, in the low part, counterclockwise. At a 50% duty cycle, the motor is stopped. Higher duty cycles drive the motor one direction, lower drives it the other. An example using the 754410 would use the PWM signal going into the 1A input and also into an inverter (74xx04) that then connects to the 2A input with the enable tied high. At 50%, the motor shouldn't move or might vibrate if the freqency isn't high enough. At 75% the motor should get a net turn clockwise, while at 25% it should turn counterclockwise Other methods of motor control do exist, but are not widely used. Other h-bridge chips include Nationals LM18200, Allegros 3952, the L298, and the L293D. What you use will generally depend on what kind of motors you want to drive, specifically how much voltage and current they require. Please know how your chip works and don't try any of this at home since I still haven't, only read and tried to understand what the data sheets told me, and other peoples web pages explaining how they got it to work.
|