Setting both inputs high
Setting both inputs high should not be dangerous.
If you set both inputs high while the motor is turning, it should act as a sort of electronic ‘brake’ for the motor. If you apply both inputs high while the motor is not turning, it won’t do anything.
This sort of electic braking is not usually required for small robots, as the weight of the robot stops the motors pretty quickly when they are not being driven.
Integrating two h-bridges into a circuit to control two motors is very common.
Other considerations: Make sure the transistors you are using are rated for enough current for your motors. If you pull too much current, you will fry your transistors. Small transistors like the 3904 and 3906 don’t handle much current. Larger transistors and heat sinks are needed for driving bigger motors.
thank you, that’s good to
thank you, that’s good to know, I thought that it would create a short for sure, I tried to figure it out by looking at the diagram but transistors are still a bit confusing to me. need to research some more
I will be making small robots with small? motors for now… like two 5.9v DC motors and a 9V or similar battery. will those transistors handle that load? I’ll try to find a way to measure current consumption in google, as the motors only say the voltage.
Well, since you have already
Well, since you have already tried your circuit out on a motor, you can just feel the transistors while they are running the motor. Are they getting hot? If so, you are overloading them. If not, they are probably fine.
Keep in mind your motor will work harder, and draw more current, when it is under load. However, if the transistors stay completely cool during testing, you will probably be OK.
Also, a 9V battery does not supply much current. You might be better off with 3 or 4 AA batteries.
I think they are cold, so I
I think they are cold, so I guess I’m OK… yeah, I have to get a better battery. probably four rechargeable AA.
I strongly recommend you
I strongly recommend you avoid turning both inputs on at the same time - doing so will switch on the middle 2 NPNs, which in turn will switch on the other 4 transistors, creating a short between the upper and lower transistors on the left and right sides. Since there are no resistors or anything to limit the current, the short created will drain your batteries and/or destroy your transistors due to overcurrent.
If you’re concerned you might accidentally set both inputs high through a glitch or coding error, you can add a basic diode to one/both side of the H-bridge that will ‘lock out’ one half of the bridge when the other half is activated, thus ensuring you can’t get a short circuit condition.
thanks telefox, that’s what
thanks telefox, that’s what I was afraid would happen, through a coding error or glitch. let me see if I can figure out the diode problem without calling Huston
couple of questions
can somebody check to see if the diodes I added here will prevent a possible short circuit?
Also, what diodes should I get?
do I have to add something else to the circuit? like a voltage regulator or more resistors somewhere? I am really new to all this so any help would be greatly appreciated.
The added diodes won’t stop
The added diodes won’t stop a short from occuring when both inputs are high; here’s a diagram showing the short circuit paths in red:
Try the following circuit instead - when one of the inputs goes high it effectively disables the other input by forcing it to be low. I've also added 2 more resistors between the middle NPN collectors and the PNP bases. These resistors will reduce the excess power wasted by the circuit, and help protect the transistors. If your supply voltage is around 3-6V I suggest using 200Ω for the new resistors. You don't strictly need a regulator for this circuit, it's pretty resilient, but in the end it depends on your power supply.
Thanks a lot man, I
Thanks a lot man, I integrated them to the shield I’m planing to make, though I am not sure how the diodes are going to force the other line to shut down, is it because the input creates a flow or something?. t. I will try not to screw up with the code anyway.
you can also
can make the code like
if(input1 && input 2, HIGH)
input1(or 2), LOW
^^ its not excatly like that i think i’m missing some punctuation…
The way it works is like
The way it works is like this: if the left input is set high, then the left-middle NPN is turned on. This also turns on the top-left PNP and the lower-right NPN. The collector of the bottom right NPN is pulled down to almost ground when it is on, which also pulls the cathode of the right diode towards ground.
If the right input is now set high, the diode will pull the voltage at the base of the right-middle NPN down towards ground, preventing it from activating.
makes a lot of sense now, I
makes a lot of sense now, I had the impression it was something like what you explained, but I couldn’t really see it.
thanks once more! lets see how this goes.