L239D DC Motor Driver & Pin Configuration
Although I’ve only used 1 motor, it is possible to use 2 motors on a single L293D chip, of course you then have to compensate on the current accordingly to ensure enough juice for both motors under peak load. Remember that if you use 2 motors, the power source will be the same voltage but the current needed will be doubled – a good start is by altering how your batteries are connected in series or parallel.
“The L293D is a monolithic integrated, high voltage, high current, 4-channel driver.” Basically this means using this chip you can use DC motors and power supplies of up to 36 Volts, thats some pretty big motors and the chip can supply a maximum current of 600mA per channel, the L293D chip is also what’s known as a type of H-Bridge. The H-Bridge is typically an electrical circuit that enables a voltage to be applied across a load in either direction to an output, e.g. motor.
This means you can essentially reverse the direction of current and thus reverse the direction of the motor. It works by having 4 elements in the circuit commonly known as corners: high side left, high side right, low side right, and low side left. By using combinations of these you are able to start, stop and reverse the current. You could make this circuit out of relays but its easier to use an IC – The L293D chip is pretty much 2 H-Bridge circuits, 1 per side of the chip or 1 per motor.
The bit we really care about in all of this is the 2 input pins per motor that do this logic and these, more importantly for our needs, can be controlled from the Arduino board.
You also don’t have to worry about voltage regulation so much because it allows for 2 power sources – 1 direct source, upto 36V for the motors and the other, 5V, to control the IC which can be supplied from the Arduino power supply or since my motor power supply is only 6V I’m going to use this (if the motor supply was higher I would consider using a transistor or voltage regulator). The only thing to remember is that the grounding connection must be shared/ common for both supplies. Below you can see the pin layout for the chip and the truth table showing the output logic.
Pin 1 | Pin 2 | Pin 7 | Function |
High | Low | High | Turn clockwise |
High | High | Low | Turn anti-clockwise |
High | Low | Low | Stop |
High | High | High | Stop |
Low | Not applicable | Not applicable | Stop |
Generally speaking most DC motors require a lot more current than the Arduino board can provide for instance the motor that I’m using needs around 5 to 6 Volts. Now I could use a 12 Volt power source for the Arduino, but then its going to drain quickly when it has to power everything,
You’ll need a few capacitors in this circuit to smooth out the power load to the motors as much as possible to help avoid any spikes and stabalise the current. using a 50 Volt 10 uF capacitor on the power supply – I suggest you do this as the bare minimum. You could also add in a capacitor for each motor that you use – something like a 220nF multilayer ceramic capacitor should be OK for the small motors.
The L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. They are designed to drive inductive loads such as relays, solenoids, dc and bipolar stepping motors, as well as other high-current/high-voltage loads in positive-supply applications.
All inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a Darlington transistor sink and a pseudo-Darlington source. Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an enable input is high, the associated drivers are enabled, and their outputs are active and in phase with their inputs. When the enable input is low, those drivers are disabled, and their outputs are off and in the high-impedance state.
With the proper data inputs, each pair of drivers forms a full-H (or bridge) reversible drive suitable for solenoid or motor applications.
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.
S1 | S2 | S3 | S4 | Result |
---|---|---|---|---|
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 |
1 | 1 | 0 | 0 | Shoot-through |
0 | 0 | 1 | 1 | Shoot-through |
1 | 1 | 1 | 1 | Shoot-through |
No comments:
Post a Comment