Electronics > Electronics

inverter IC for input into motor circuit?


I have built a low-current motor controller for my Atmega8 controller based on the L293D chip (I also built a high-current controller based on the L298N chip).  It works fine except that it needs three pins per channel to control bi-directional motors using PWM (total of 6 pins for 2 motors).  The logic of the L293/L298 is such that:

input1 =H
input2 =L               
enable=H (PWM)

enable-H (PWM)



I don't need active brake and wanted to reduce the number of pins required to control the motor so I ordered a SN74HC14N inverter chip to add an inverter circuit before the motor controller.  I plan to input the the output of one of the ATmega digital pins so that it is inverted (input=H(5V)=0, inputL(0)=~5V).  By feeding the output of the digital pin to input1 of the motor controller, and feeding the output of the converter to iinput2 (digital pin output inverted), I should be able to control the direction of the motor with 1 pin from the ATmega.  I think this is how the motor control is implemented on the Aduino motor shield V3 which uses the same L293 controller chip and only requires 1 input for motor direction per channel (DIRA or DIRB) along with the PWM signal.

Any thoughts on how well this will work or any gotchas I need to be aware of?

The circuit I built for the L293D is straight out of the Spec sheet for bi-directional motor control.  Same with the L298N circuit, adding 1AMP fast recovery diodes as recommend.

Here are the links for the spec sheets of the ICs I am using:

Inverter chip:  http://www.ti.com/lit/ds/symlink/sn74hc14.pdf
L293D:  http://www.st.com/web/en/resource/technical/document/datasheet/CD00000059.pdf
L298N:  http://www.st.com/web/en/resource/technical/document/datasheet/CD00000240.pdf

As a side note, I have used the output of a single PWM pin as input to the enable pin of both channels on the motor controller.  This gives me synchronized speed control of both motors and only uses 1 PWM pin on the ATmega.  I know this works as I have successfully tested it.  Is there any reason why I shouldn't do this other than the limitations on available rotational speeds on the different motors? 

Using these methods, I hope to gain bi-directional PWM control of 2 motors using only 3 pins on the ATmega.  I have done this successfully using the Arduino Motor Shield and my ATmega controller.  This will give me syncronized forward, reverse, and rotation in both directions, which is all I need for this portion of the project.

When doing industrial designs, you will need to worry about propagation times.
I think it will work well enough for a hobby robot. Especially if you don't change direction often.

Seems like each wheel has fwd, rev, and coast (like disconnecting the motor in webbotlib). So everything will be fine so long as you don't need to come to a stop quickly ('panic button' mode or 'am about to hit a wall' mode).
Only other thing to think about is whether the robot will be on a slope. If so then your missing 'brake' mode would keep it stationary (weight permitting) whereas 'coast' mode may allow the robot to free-wheel back down the slope.

These are great points, I had not considered them.  I don't think I will need brake for this particular build but now I am thinking I will add some jumpers to disable the inverter and enable the second digital pin to the second input in case I need brake for a future project.


The brake is not an active brake, it just bleeds off the magnetic energy of the motor.
Panic brake mode should reverse the current and drive the motor backwards; that will actually stop the robot.
Braking for going down hill can also do the same thing.
The best way to get a constant and well controlled wheel speed is to use encoders to measure the actual speed, and a PID controller to drive the current output and direction to keep it at a desired rate.


[0] Message Index

Go to full version