Help with H-bridge circuit not working
I'm attempting to have a 9-18v DC motor turn one direction for 5 sec., stop for 5 sec., then turn the reverse direction for 5 sec. and then start over.
I'm using the L293D Quad Half-H Drivers with a BS1 Module and the Carrier Board for BS1-IC.
I've attached both my code and the schematics of how I've hooked it up.
When I get everything plugged in and going, the motor never turns. The best I get is I can hear a faint clicking from the DC motor at the times when it should be turning. When I power the DC motor straight from a 9v battery it spins like a champ.
I just really don't know where I've gone wrong. Here's a link to the L293D datasheet www.parallax.com/Portals/0/Downloads/docs/prod/compshop/603-00019-L293D-Datasheet.pdf
Any help would be appreciated. Thanks!
I'm using the L293D Quad Half-H Drivers with a BS1 Module and the Carrier Board for BS1-IC.
I've attached both my code and the schematics of how I've hooked it up.
When I get everything plugged in and going, the motor never turns. The best I get is I can hear a faint clicking from the DC motor at the times when it should be turning. When I power the DC motor straight from a 9v battery it spins like a champ.
I just really don't know where I've gone wrong. Here's a link to the L293D datasheet www.parallax.com/Portals/0/Downloads/docs/prod/compshop/603-00019-L293D-Datasheet.pdf
Any help would be appreciated. Thanks!
Comments
Looks to me that your H-Bridge circuit is incorrect, missing a couple diodes.
Brad
Brad
My working theory right now is that I possibly don't have the grounding's correct.
Am I correct in thinking that when the BS1 sends on output (aka 1) through a pin that it's sending out an electrical current that has to been grounded somewhere else for the circuit to complete?
Am I also correct in thinking that on the carrier board the Vss is the ground?
Additionally, from the data sheet Fig. 5, where are those grounds supposed to connect to? The Vss on the card or the negative on the auxillary 9v that goes into PIN 8 on the L293D? Do some ground go one place and the other grounds go to another?
Where does the Vcc2 power going into Pin 8 ground?
I'm just having the toughest time figuring this out.
Attached is an image of how I've constructed the breadboard.
Additionally, attached is a text file. You can copy the contents and go here: www.musicfromouterspace.com/ElectronicTools/virtualbreadboard/index.html
In the bottom left is a button called "Save/Load". Click that and paste the contents from the text file and click "Load Circuit". It will bring up my breadboard.
Thanks!
Your code seems odd, though I would expect the motor to turn. Personally I would just tie the EN pin on the L293D high (to 5v) and just control the two h-bridge pins for start/stop/direction.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
In your SBB diagram, the diode at J2-J5 is reversed, as well as the diode at J18-J21
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
I've rearranged the breadboard to exclude the external diodes and also omit PIN3 and just run the Vdd from the BS1 card to the L293D PIN1 (EN) and PIN 16 (Vcc1).
I've also take the PIN commands out of the code.
I've eliminated the diodes (since with this model they're internal) and I've run a jumper from Vdd to 1,2 EN (Pin 1 on the L293D) instead of from PIN3 like I had.
I've connected a PIR to trigger the motor.
In the code I've put in a Pause of 10 seconds to delay the PIR from activating.
After 10 seconds have elapsed the PIR is live. When it senses motion it activates the motor just great.
Here's where the bump is. The motor spins one way for 1/2 second like it's supposed to but instead of coming to a fast stop for 5 seconds before reversing direction, it goes straight to reversing direction and keeps going until I either push the reset and remove the battery.
According to the data sheet www.parallax.com/Portals/0/Downloads/docs/prod/compshop/603-00019-L293D-Datasheet.pdf on Page 9, there are 3 ways to do a fast stop: a) Leave EN High and make the two inputs low b) leave EN High and make the two inputs High, and c) make EN low.
I tried make PIN1 & PIN2 High and that didn't work. I tried make them both Low and that didn't work. Instead of running a jumper from Vdd to EN, I ran PIN3 to EN and set it to High in the program when the motor should turn and made it Low when it should stop. Doing this the motor never worked at all. It only seems to work when EN is connected straight to Vdd.
I'm kinda at a loss now since it's not like I can program Vdd to turn off. I don't know why the motor will work when EN is connected to Vdd but not when it's connected to a PIN.
Attached is the new code.
I'm sorry I'm bothering you guys so much. All your help had been wonderful!
I'm not sure if this is the problem or not. Every thing else looks OK.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
See PDF for examples.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
It still looks to Me that the L293/L293D need the diodes even after looking at Your spec. sheet. It calls out the external diodes as part#s SES5001 on pg. 9 and 10. Now I'm confused. I've used the L293D in the past and don't recall needing the diodes.But I was driving steppers.
This isn't the first time that I've ran across some confusing data sheets!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
But the very first column of info in the datasheet:
Then, if you look at the equivalent schematic for L293 on page 3 and L293D on page 4, you will see that schematic for L293D shows output diodes on each channel, just as if you had wired 'em up yourself, while the straight L293 on page 3 does not.
The "D", I'll presume, stands for "diodes included"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Your code seems OK, presuming the chip is wired properly.
Can you take a photo of your current wiring and post it? Something seems dang odd here.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php