Dual Motor Driver Object for SN754410
Martin_H
Posts: 4,051
I was wondering if there's any popular object for driving a sn754410 or similar H-bridge? I SN754410.spin by Javier R. Movellan, but that only drivers a single motor. While I could tweak it to allow configuring the control pins and create two instances, each instance would want its own cog. Ideally what I'm looking for would implement a full control loop, so I would set a direction and speed for each motor and it would ramp them for me.
Comments
Update: I don't think that will work because I'm using three pins (ena, dir1, dir2) per channel. I want to PWM the ena channel while holding dir1 and dir2 fixed.
The way I've used Kye's object is to tie the enable pin high and use negative speed to make the motor turn backward.
I just found a modified version of Kye's code that uses the enable pins. It looks like I also made easier to modify the resolution of the driver.
I also found a simple demo for the driver.
It's been a while since I've used these so let me know if there's a problem.
http://www.handyboard.com/oldhb/schemv12/motor.gif
Robert
I thought if you tied the enable pin high you could power the motor one direction by pulsing dir1 with dir2 held low. To reverse direction pull dir1 low and pulse dir2.
I'm I missing something?
After reading Martin's last post, I wonder if pulsing the enable pin is more efficient than the method I just described?
I'm pretty sure I've use these chip with both these methods, maybe I should only use the pulsed enable method?
If you only want to use two pins you use an invertor like the Handyboard does. Then you have a direction bit and an pwm bit at the cost of dynamic braking.
Two pins work just fine. The link I posted to the schematic of the Handyboard motor control section uses it with only a two pin interface. The extra pin is only needed if you want more control over it for braking. It depends upon what motors you're using it with. If the motors have a worm gear drive then not having braking shouldn't be an issue.
Robert
On a side note, the L293D/754410 (and compatible chips) are pretty handy. In the very near future the chaser lights on the Eiffel Tower in Small World (Anaheim Disneyland) will be controlled by a Propeller driving an LED rope (matrix) that they already had. They needed the ability to chase and dim, and the matrix requires high, low, and hi-z outputs for control. I designed a circuit and code for the L293D to drive all the lines with a PWM (brightness) signal being applied the the enable pin that controls the common line to the matrix. I spoke with them yesterday; the circuit is running on the bench and they will install it shortly.