H-Bridge & prop questions
Trezitorul
Posts: 68
I am currently working on my first robot. It is simply a hacked toy car with differential drive and am in the process of building an H-Bridge. The problem is that the motors stall even with no load? A turn of the motor by hand gets it started but even then it is really slow. I am using radio shack transistors to build the H-Bridge(serial number 2N4401052) and the propeller chip for control any suggestions would be appreciated.
Comments
1) Increase your supply voltage (more batteries)
2) Change to low-loss MOSFETs or equivalent
3) Use two SPDT relays like Radio Shack 275-240
I prefer to use relays in my Basic Stamp projects. They're bulletproof, zero loss, and you can switch them perfectly with the 2N4401 transistor you're using (or the Shack's bulk pack of NPN transistors). Additionally, you'll get dynamic braking for free when you switch your relays off, so your drive wheels will STOP instead of spooling down slowly. Keep the relays on the opposite side of the circuit board·from your Prop chip, use filter caps, and put a spike diode across each relay coil, and you can run everything (motors, too) from a single supply.
Post Edited (erco) : 3/19/2008 6:16:45 AM GMT
Thank you for the information on the transistors erco.
Post Edited (Trezitorul) : 3/19/2008 4:16:09 AM GMT
Sorry the transistor part number I gave you was only partially correct for some reason radio shack included 2N3904 transistors and 2N2220 transistors in the pack I got.
Post Edited (Trezitorul) : 3/19/2008 7:07:08 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
Post Edited (Trezitorul) : 3/20/2008 4:16:19 AM GMT
Another good reference is the Wikipedia. Google search for "wiki h-bridge".
There are several things that you need to take into consideration to get the results that you are looking for. From my own experience, "trial by fire" is not always the best approach. First thing I would do, is determine how much current the motor requires. Does the motor have any kind of markings or anything that indicates at least an operating voltage of the motor? How many volts are you trying to drive the motor with? <-- Does it seem comfortable at that voltage when directly driven from your power supply? If so measure the resistance across the motor terminals with a meter without anything else connected to the motor. If you don't have a meter, I would suggest getting one. Meters are relatively cheap these days... nothing fancy, just voltage, resistance, etc. (a diode check would be a bonus in this case).
To get a good Ball-park figure as to what kind of current your motor is demanding....
Current = {Supply Voltage} / {Motor resistance}
Do this and check back with us.
I'm guessing that since the motors are from a "hacked toy car" they will be rated for 3V, 4.5V, 7.2V or 9V ...·· How many batteries (and what kind) did the toy car require?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 3/20/2008 4:27:30 AM GMT
With 6V (assuming 4 cells) are you sure that the toy car did not use a center tap on the power supply to drive a HALF-BRIDGE instead of a full H-Bridge ? ...Actually 3V to the motor?
Even so, 1Amp is too much for the 2n3906 (or 2n3904 counter part) to properly handle. You need to increase your transistor drive strength with a larger transistor. (...or smaller motor)
As a rule of thumb, I usually double the current requirement when selecting the transistor. So I would be looking for something that can at least handle 2 Amps at my 6V supply.
Also, you need to consider how much Gain (Hfe) the transistor has.· Typically for the 2n3906 and 2n3904 this is 200, but I have measured it as low as 20, and as high as 400. The Gain can be a bit
tricky, but you need to be aware of it so that you can properly select the proper value for the current limiting resistor on the transistor Base connection. Always error on the lowest Hfe value.
Suppose that the Hfe was 20 and you need to drive 2 Amps. The "Base" current drive would be the 2 Amps divided by the Hfe, SO the Base current drive would be 100mA. If you are using
the Propeller or any of the Stamps, there is a problem.... The Propeller is only rated at a maximum of 50mA per pin.· The Stamps even less.
Hmmm... what to do? You can find a transistor with a higher gain, or you can configure two transistors in a Darlington arrangement to "multiply" the gain of the two transistors. More on that later.
There is also a potential problem of powering the H-Bridge with a different voltage level from the micro. In this case 3.3V for the Propeller vs. 6V for the motor. More on that later as well.
Right now you need a transistor capable of delivering 2 Amps or more at 6V.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 3/20/2008 5:36:25 AM GMT
So when I read the specs I want to look at the Hfe or the current gain so I can select a good resistor. Also I want to make sure that the transistor is rated about double the current coming int to the collector so I can avoid burned fingers, melted plastic, and horrible smells. Now I just have to get the new transistors when I do get them I will post right away.
If I am understanding correctly the transistors worked but I tried to force too much power through them and so they heated up and melted. Why does it matter which way you install the transistor since it simply turns on and off.
I also do not believe it used Half bridges because the previous circuit had 8 transistors larger square transistors(2SD2166) along with two transistors for control also this toy car was an RC car capable of forwards and backwards motion. As for the center tap I have never encountered one and do not know what to look for.
Post Edited (Trezitorul) : 3/20/2008 6:09:13 AM GMT
If you look at the datasheet for the 2SD2166, it is rated at 4A with a minimum Hfe of 120
http://www.tranzistoare.ro/datasheets/166/240614_DS.pdf
"the specs I want to look at the Hfe or the current gain so I can select a good resistor" sort of... You may not find it directly on the package, but if you Google the transistor number with the keyword "Datasheet" included, you can find the information easily.
"Also I want to make sure that the transistor is rated about double the current" This is just a good rule of thumb.
"also this toy car was an RC car capable of forwards and backwards motion." You can get forwards and backwards motion with a HALF-BRIDGE if the power supply is split.
"If I am understanding correctly the transistors worked but I tried to force too much power through them and so they heated up and melted" -·Yes and No ... The motors required more power than·the transistors could deliver, and with an input to the Base of 3.3V (from Propeller) through a 220 Ohm resistor, you were only providing 15mA of Base current. (3.3V / 220Ohm = 15mA)· If the Hfe is only 20, then the transistor was only capable of providing 300mA to the motor. (15mA X 20 = 300mA)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 3/20/2008 6:46:49 AM GMT
If you read a theoretical description of the way a transistor works, the emitter and collector of a transistor should be interchangable. In practice, a transistor is not built symmetrically. The specs for the transistor are based on the device being connected a particular way, so you have no idea (without testing it yourself) of the gain or other factors when it's connected in reverse.
Some MOSFETs are built symmetrically and will actually function identically with the source and drain interchanged, but not all MOSFETS. Junction transistors are not built symmetrically.
I performed the calculation for minimum base current using the formula of load/hfe = min base current and with an hfe of 20 I got 50mA as the minimum base current. 300 mA would be more than enough to drive the transistors.
Post Edited (Trezitorul) : 3/20/2008 4:39:07 PM GMT
That's the great advantage of modifying an existing toy, much of the driver circuitry is already there.
But if you still want to build your own H-bridge, use power transistors with heat sinks: TIP31 or TIP120 for NPN, TIP42 PNP, all at the Shack. See http://www.blogcadre.com/blog/jason_striegel/howto_make_a_robot_car_-_part_2_h-bridge_details_2005_11_10_23_18_10 for specifics.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
"I performed the calculation for minimum base current using the formula of load/hfe = min base current and with an hfe of 20 I got 50mA as the minimum base current. 300 mA would be more than enough to drive the transistors."
Don't worry about the required base current right now, find a transistor capable of driving the right amount of current to your motor first.
Erco·is correct, if you can, use the transistors already selected for the motor.· Depending on how comfortable you are with a soldering iron, you could even desolder the transistors from the toy and re-use them else ware.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Trezitorul) : 3/20/2008 6:43:33 PM GMT
H-Bridge Primer
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 3/21/2008 6:00:15 AM GMT
If my tests were correct then the transistors Q5 & Q6 would have to be rated to handle the same number of amps as is needed to saturate transistors Q1 & Q2. So my 3904's should do the job well enough
Thank you so much for the primer. It all makes sense now. Your schematic with its arrangement of pnp transistors made me look them up further. I had always though that they were the same thing as npn transistors and had the same mode of operation. That you apply voltage and they allow current to pass thru them well I was wrong.
So on the pnp transistors when they are on they ground thru the base providing they have resistance well more resistance than the emitter
Below are some simple circuits that I have built for testing these are my versions of how the two different types of transistors work.
Post Edited (Trezitorul) : 3/21/2008 7:53:08 AM GMT
"If my tests were correct then the transistors Q5 & Q6 would have to be rated to handle the same number of amps as is needed to saturate transistors Q1 & Q2. So my 3904's should do the job well enough"
That is correct... also keep in mind that Q5 and Q6 also need to saturate Q4 and Q3.
"So on the pnp transistors when they are on they ground thru the base providing they have resistance well more resistance than the emitter"
Transistors are current devices, within the operating range of the transistor, the voltage·remains fairly constant (about 0.6V).· This voltage exists across the B-E (Base-Emitter) junction and is the main reason you need a current limiting resistor in series with this location as to not exceed this voltage.· The current is then amplified across the C-E (Collector-Emitter) junction by a ratio of the·Hfe·value.
In general the Emitter is·tied to the Source.· With NPN's the Source is the Ground connection, with PNP's the Source is the Voltage Supply connection.· The Collector is usually considered the drive and what connects to one side of the device you want to control.· The other side of the device you want to control·goes to the Voltage Supply connection·(with a NPN) or to the Ground connection (with a PNP).· The Base voltage potential of the transistor needs to be less than the Emitter potential·if it is a PNP by about 0.6V, and greater than the Emitter potential if it is a NPN by about 0.6V·to turn "ON" the transistor,·otherwise the transistor is considered "OFF".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 3/21/2008 6:08:43 PM GMT
From my calculations I am planning to get.
a pack of 84 ohm resistors for R1&R2 or close to this value
a pack of 840 ohm resistors for R3&R4 or close to this value
Some more TIP3055 and TIP42 transistors.
Attached is the schematic with all of the parts labeled verification would be greatly appreciated.
One question about the whole drive set up; will the two H-Bridges I will eventually have simply be connected in parallel to one power supply or will I have to split my battery pack in two or get another battery pack with each one going to a separate motor. I would prefer having 6V to each motor and having only one battery pack.
Then with the propeller what is the best way to have it connected to a mobile power supply.
Post Edited (Trezitorul) : 3/21/2008 6:08:36 PM GMT
You’re not figuring in any current overhead or buffering for R1 and R2.··Even though your transistors might be able to handle the current, if you don't supply an adequate drive, the transistors are at risk for operating in the linear region.· In some applications this is ok, in fact you design specifically around this operating range, but for a motor driver it is not where you want to be.
Take your 1A stall current and double it at least... use 2A in the equation instead of 1A.· R1 and R2 become 42 Ohms· (A standard 47 Ohm resistor would be fine)
For Q5 and Q6, since the hfe is 200 and the current needed to pass through Q5 and Q6 is 100mA (2A / 20 Hfe = 100mA) you need a Base drive current of only 0.5mA ... (100ma / 200 Hfe = 0.5mA)
To deliver 0.5mA from a 3.3V I/O, R3 and R4 would need to be 4200 Ohms ... (3.3V - 1.2V)/0.5mA = 4200 Ohms ( A standard 3.9K or 4.7K resistor would be fine)
Also.... to save a trip to Radio Shack... pick up two bridge rectifiers (Model: 276-1152· Catalog #: 276-1152 ) ... These will add protection to your transistors by reducing back-EMF spikes generated from your motor.·· Easy hookup... the "~" or AC inputs go to your motor, the "+" goes to the Supply Voltage positive (6V), and the "-" goes to GND or Vss.· This will direct any spike generated by the motor greater than 0.6V back into the power supply.
BTW) in answer to your post.... you can use the same supply for more than one H-Bridge, as long as your supply can provide adequate power to both motors.
i.e. a 4AH (Amp Hour) battery will provide 2 Hours of continuous use....· 4AH / (2Amps <- total motor current) = 2 Hours
"Then with the propeller what is the best way to have it connected to a mobile power supply."
You can use a·voltage regulator like that used in the Propeller Demo board (LM2937ET-3.3) to bring the 6V down·to 3.3V for the Propeller.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 3/21/2008 8:18:44 PM GMT
The words "old transformer" would definitely persuade me to find a "new" one with the correct voltage ratings... Power Supply
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Trezitorul) : 3/23/2008 1:59:53 AM GMT
If you observe the proper polarity on the plug, then that solution should be fine.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
I missed the part about the 9V battery in your last post... up until this point we had been taking 6V.· Using a 9V battery would not be an optimal power supply considering that a 9V battery only has about 450mAH of storage to begin with and your wasting a lot of that though the process of regulating the 9V down to 3.3V for the Propeller. Even a 4 pack (or 5 pack if using rechargeable batteries) of AA batteries would provide 2500mAH of storage capacity, and you would be closer to your target voltage of 3.3V which would end up wasting less energy in the long run.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.