H-bridge speed issues

Hi

I made a h-bridge from two pnp and two npn resistors. I have programmed them via arduino uno, and for a test run i connected two generic six volt motors, and and they are both turning in the same direction.

The 4 enables (two for each hbridge) are connected to four pins. The supply of the h-bridges are connected to two different power supplies and are being provided 5V. Grounds of the power supplies and arduino are common.

Now here is the issue, the motors work really slowly. but as soon as i touch one of the METALLIC terminal of the arduino or the mosfet, the motor speeds up to its normal speed. I have tried changing the breadboards but its of no use.

What could be the problem?

Comments

  • 25 Comments sorted by Date Added Votes
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    Without a schematic and an understanding of what your code is doing there wouldn't even be a way to formulate a guess. The accurate schematic or wiring diagram is very important. But you also don't say if you're just setting pins high/low or using PWM to vary speed. Also, you mentioned NPN/PNP resistors, but I am thinking you meant transistors. Are the BJT or MOSFET?
    Chris Savage | Engineering Tech | Main Office: (916) 624-8333 | Direct to Tech Support: (888) 997-8267 | Website | Twitter | Google+
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited August 2015 Vote Up0Vote Down
    Likely that you copied a poor design. Buy a good H-BRIDGE from Pololu.
    Hwang Xian Shen, Puddleby-on-the-Marsh.
    All things considered, I can live and thrive without Microsoft products. LINUX is just fine.
  • It's pretty easy to make your own h-bridge driven by uC outputs. No need to spend more money. You probably have made a small wiring or coding error (such as using an open-drain pin to drive the gate of a MOSFET). But like Chris says, w/o a schematic one could only make wild speculations.
    Platåberget
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited August 2015 Vote Up0Vote Down
    For the longest time, I was determined to take a few PNP and NPN transistors and construct my own H-bridge. I searched the internet far and wide for schematics, and pushed wiser souls on the Parallax Forums to mentor me into constructing a good design.

    What I learned was simple.

    A. Using BJT for H-Bridges introduces roughly 2.0 volts of voltage drop in the switching, and lots of heat comes with that voltage drop. So if you desire to power a 5volt DC motor with an H-Bridge, the motor may be getting only 3 volts while the H-bridge burns brightly.

    The simple fact is you should use 12, 18, or 24 volt motors with H-bridges to optimize power that is controlled. A 2 volt drop in a 24 volt supply is much less significant. And you don't require as many amps to get a lot of power

    Watts = Volts x Amps. So go high in volts, low in amps or waste a lot.

    B. A lot of wonderful MOSfet H-Bridge chips has been produced that don't have that nasty voltage drop and it seems Pololu has made it their mission in life to dominate the market with good product at the lowest cost.

    C. The LM293D H-bridge in a chip has the voltage drop problem. And the LM298 H-bridge has the same voltage drop problem. They may work, but run very hot, too hot for most sane users or young children.

    And a word to the wise.......
    10 or 20 watts of H-bridge is not a lot in the real world. About 745 watts is equal to one HorsePower. There will come a day when you will desire 1/10th HP, 1/4 HP, or more. Parallax makes a nice H-bridge that will handle those big boys.

    Sure, you can DIY an H-bridge. I have a pile of the Beam H-bridges here that I wired up and explored. They work with toy motors. 800ma at 5 Volts (4 watts!!!!! Wow.... (actually they are great fun for pennies))

    http://library.solarbotics.net/circuits/driver_tilden.html

    You can try those. They are cheap and good fun. But I can assure you they won't last and you will want more durable designs... small, clean, and tough.

    https://www.pololu.com/category/11/brushed-dc-motor-drivers


    By the way, I do sympathize with just wanting to build something from scratch in order to learn. It is just that everything in electronics has gone into packages that are designed by teams of well-educated people. The world has changed. Transistors are nearly obsolete and circuits are being wired up in 8 nanometer wide conductors inside silicon. Power switch has gone over to power MOSfets with built-in protection against various hazards - automatic thermal shut-down, transient protection, etc. You will like them once you try them.
    Hwang Xian Shen, Puddleby-on-the-Marsh.
    All things considered, I can live and thrive without Microsoft products. LINUX is just fine.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited August 2015 Vote Up0Vote Down
    The BEAM Tilden H-Bridge is famous for its construction technique, called 'freeforming'.

    I simply used epoxy and glued six transistors together (in the right order) and then followed the provided diagrams for construction. No circuit board required and it is definitely easier to do that it how it looks.

    http://www.beam-online.com/Robots/Tutorials/Freeform/H-bridge/hbridge.html

    You should be able to have some fun with this and end up with a useful h-bridge.
    Hwang Xian Shen, Puddleby-on-the-Marsh.
    All things considered, I can live and thrive without Microsoft products. LINUX is just fine.
  • Darlingtons have a 1 to 1.5V drop, BJTs should be 0.1 to 0.25V drop only if
    driven to saturation. Saturation takes lots of base current though, 5 to 10% of
    the load current. Saturation is subject to the small signal gain, since the base
    collector junction is forward biased
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited August 2015 Vote Up0Vote Down
    Anything over roughly 25ma current provided by the microcontroller becomes high risk of damaging the i/o on the microcontroller. That will limit the amount of power one can get directly attaching an H-bridge to a microcontroller.

    So, it certainly easier to saturate a Darlington pair than an average BJT... the gain is much more.

    But Darlington pairs have always run hotter than simple BJTs. And then there is the doubling of the voltage drop by using them.

    Bob Blick created a wonderful TIP120/TIP125 h-bridge example that will indeed get some serious motors attached to a microcontroller. I am pretty sure 1/10th of a horsepower is easily doable. But don't forget the heat sinks. And be careful about burning your fingers.

    Note that Bob Blick not only used power Darlingtons, he has a stage of transistors between the Darlingtons and the microcontroller just to provide adequate current to the bases of the Darlingtons.

    http://www.bobblick.com/techref/projects/hbridge/hbridge.html

    Between the Tilden H-Bridge and the Bob Blick H-Bridge, I have run out of ideas for PNP/NPN devices.

    I will repeat, the L293 and L298 devices are not really any better -- they just happen to come in IC packaging. They will run very hot and will not work well if one desires to power motors off the same 5VDC that is powering everything else.

    Hwang Xian Shen, Puddleby-on-the-Marsh.
    All things considered, I can live and thrive without Microsoft products. LINUX is just fine.
  • Darlingtons
    Anything over roughly 25ma current provided by the microcontroller becomes high risk of damaging the i/o on the microcontroller. That will limit the amount of power one can get directly attaching an H-bridge to a microcontroller.
    Actually CMOS outputs tend to be self-limiting anyway because the voltage drops as you draw more current due to the limited channel resistance etc. But multiple outputs together can cause a real problem with combined substrate currents and hot-spots of course. One or two outputs shorted, the chip survives.
    So, it certainly easier to saturate a Darlington pair than an average BJT... the gain is much more.

    But Darlington pairs have always run hotter than simple BJTs. And then there is the doubling of the voltage drop by using them.
    No and No. You may "saturate" a Darlington with much less base current but that voltage from collector to emitter or Vce(sat) will be 0.8V even at very low collector currents. As it drives a heavier load the Vce(sat) goes up to around 1.5V. That's a lot of heat even at 1A. Bad bad bad.
    Secondly the only "doubling" of voltage is the base emitter drop being double in a Darlington at around 1.2V but although the standard BJT may require more base current for the same collector current, it also runs a lot cooler as its Vce(sat) can be a tenth of a Darlington's, so that's a tenth of the heat dissipated too.
    Bob Blick created a wonderful TIP120/TIP125 h-bridge example that will indeed get some serious motors attached to a microcontroller. I am pretty sure 1/10th of a horsepower is easily doable. But don't forget the heat sinks. And be careful about burning your fingers.

    Note that Bob Blick not only used power Darlingtons, he has a stage of transistors between the Darlingtons and the microcontroller just to provide adequate current to the bases of the Darlingtons.

    http://www.bobblick.com/techref/projects/hbridge/hbridge.html
    So in view of the woefulness of the Darlington for motor drives you might think about replacing that "wonderful" word with "woeful". Darlingtons are indeed used to switch several amps quickly with very little base current, but because of the huge Vce(sat) they do so in low duty cycle applications such as solenoids etc, but motors require continuous running and anyone attempting to use them for this displays their ignorance in this regard.
    Between the Tilden H-Bridge and the Bob Blick H-Bridge, I have run out of ideas for PNP/NPN devices.

    I will repeat, the L293 and L298 devices are not really any better -- they just happen to come in IC packaging. They will run very hot and will not work well if one desires to power motors off the same 5VDC that is powering everything else.

    Arduino blogging Fritzers if I may use such a term to conjure up an image of the crowd I am referring to have a lot to answer for not because of their lack of understanding of fundamental electronics but because they promote their solution as "wonderful" much to the disadvantage of the believing masses.

    Although plain BJTs can be used in the output stage of a H-bridge this is something much better suited to MOSFETs driven properly, sometimes even by discrete BJTs. Now lastly the use of 5V "logic" power for motors is insane, need I say more.


    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    --->CLICK THE LOGO for more links<---
    Latest binary V5.4 includes EASYFILE +++++ Tachyon Forth News Blog
    P2 SHORTFORM DATASHEET +++++ TAQOZ documentation
    Brisbane, Australia
  • MJBMJB Posts: 1,025
    edited August 2015 Vote Up0Vote Down
    Now lastly the use of 5V "logic" power for motors is insane, need I say more.
    Unfortunalely the original question provides NO hint about the power / currents needs of his motors.
    I am using those very cheap (much cheaper at AliExpress !!)
    http://www.dx.com/de/p/l9110-dual-channel-h-bridge-motor-driver-module-for-arduino-black-157149?tc=EUR&gclid=Cj0KEQjw0tCuBRDIjJ_Mlb6zzpQBEiQAyjCoBofKrp8_R1CBpcL6PeBCXNpJbz_d9iEX0VsjXj3YAOEaAvkp8P8HAQ
    to drive 3V mini motors for 0.4 seconds a time to open/close some air vents.
    Complete vent/flap module for around $3 incl. timer from China of course.
    so 'motor' does not really tell us a lot ;-)
    and 5V might be enough.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited August 2015 Vote Up0Vote Down
    Yes, the original poster just says 'two generic six volt motors'.

    From the mention of Arduino, I presumed he means hobby motors and that he was getting 5VDC from his Arduino. The reality is anything like a Pittman DC motor, which is industrial quality, wouldn't bother with specifications as low as 6VDC. You simply should be using 12, 18, 24, 30, or 36 volts to get good performance out of a motor that is going to be electronically controlled. It is easier to make wiring inside for higher voltages that is more durable, but not so easy for higher amps.

    So 6V motors to me are toy motors unless you pull something from a CD player. And the L293 and L298 h-bridges were produced for exactly that market -- battery operated toys. But it seems that there never was concern for how long the batteries lasted, or for how long the product itself might last. So the L293 and L293 are toy h-bridges to me.

    BEAM is a more interesting exploration of using toy motors for robotics as it actually tries to not waste power. The goal of solar power robots demands good power management.

    ++++++++
    While the internet provides tons of beginner tutorials on h-bridge design, they really tend to not get very far. Any h-bridge that you desire to last should be able to handle the current generated by jamming the motor into a full stall. It either needs fuses or the ability to handle far more current than it takes to get started or rotate unloaded.

    So while one gets some interesting introduction to h-bridges, I can't really find anything on the web for free that will help one design and build a robust industrial strength h-bridge. Companies that do make these, generally don't explain how to design one from scratch. They want sales, not more competition.
    Hwang Xian Shen, Puddleby-on-the-Marsh.
    All things considered, I can live and thrive without Microsoft products. LINUX is just fine.
  • Peter JakackiPeter Jakacki Posts: 7,835
    edited August 2015 Vote Up0Vote Down
    I accept that there are low voltage motors but to run them from the same actual supply as the logic is insane to me. Motors can generate all kinds of noise and overload the supply on faults etc. For that kind of thing I would use a seperate 5V supply, so it's not about 5V but about "logic" supply. When your main CPU hiccups, the motor may never get to turn off etc.

    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    --->CLICK THE LOGO for more links<---
    Latest binary V5.4 includes EASYFILE +++++ Tachyon Forth News Blog
    P2 SHORTFORM DATASHEET +++++ TAQOZ documentation
    Brisbane, Australia
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited August 2015 Vote Up0Vote Down
    I accept that there are low voltage motors but to run them from the same actual supply as the logic is insane to me. Motors can generate all kinds of noise and overload the supply on faults etc. For that kind of thing I would use a separate 5V supply, so it's not about 5V but about "logic" supply. When your main CPU hiccups, the motor may never get to turn off etc.

    Yes indeed, simply running motors from the same supply as the logic is a recipe for failure.

    As long as one must go to a separate supply, it seems obvious to me that a higher voltage to the motor also makes better sense. Even 9VDC can greatly improve the motor's performance.

    Pololu did manage to make a tiny robot powered by four AAA cells that isolates the motors provided with higher voltage and sharing the AAA cells with the logic. They used a step-up regulator to power the motors, and a step-down regulator to power the logic.

    But we are plagued by tutorials for beginners that revive the same sins again and again. It seems that those that are into 'cut-and-paste' plagiarism, plagiarize poorly and frequently.

    It is hard to an excellent tutorial.

    Hwang Xian Shen, Puddleby-on-the-Marsh.
    All things considered, I can live and thrive without Microsoft products. LINUX is just fine.
  • Beau SchwabeBeau Schwabe Posts: 6,378
    edited August 2015 Vote Up0Vote Down
    One of these days I will put together a tutorial that reflects what I learned in prosthetics with emphasis on robotics.

    Often we used the same power source for the micro as the motors, because in a prosthesis you have limited options. A method Loopy describes works, but there are a few other approaches. What you have on your side is that most micros will operate at a relatively low voltage compared to the motor voltage. This is good because you have plenty of overhead to work with to regulate the voltage down to the micro. Voltages to the motor are often left open-ended, meaning a direct connection to the motor controlling H-Bridge. It is important to also monitor voltage and current during stall, startup, and low battery conditions and prevent any race conditions that could happen.

    The original question about it running slow indicates to me that the transistors are not saturated. This is usually more of a problem with MOSFETs, while BJTs can get away with it, unless they are not turned OFF properly.

    One of the most common problems with MOSFETs is not driving the gate and source adequately and forgetting that upon startup,stall, or low battery conditions a MOSFET might go into its linear operation mode causing excessive heat. In this mode you essentially create a voltage divider with your MOSFETs. It sounds counter intuitive, but improperly driven, even under a low battery situation, you are more likely to destroy a MOSFET than with a fully charged battery. Even if you are using a LOGIC level MOSFET, you still need to establish that logic level voltage on the high side of your H-Bridge in order for the MOSFET to turn ON properly.

    Additionally, using MOSFETs or BJTs ... if they are PWM driven, you must allow for proper shoot-through prevention. MOSFETs if designed properly should run cool and not require a fan or any heat sinking. BJTs on the other hand will require cooling when larger currents are applied.


    Beau Schwabe -- Submicron Forensic Engineer
    www.Kit-Start.com - bschwabe@Kit-Start.com ෴෴ www.BScircuitDesigns.com - icbeau@bscircuitdesigns.com ෴෴

  • For $2, nab one of these L298N modules. Heats up, voltage drop, it's got it all the drawbacks without compromising any of the shortcomings. But it's a cheap learning experience. http://m.ebay.com/itm/Dual-H-Bridge-Stepper-Motor-Drive-Controller-Board-Module-For-Arduino-L298N-FE-/231435918397
    "When you make a thing, a thing that is new, it is so complicated making it that it is bound to be ugly. But those that make it after you, they don’t have to worry about making it. And they can make it pretty, and so everybody can like it when others make it after you."

    - Pablo Picasso
  • ercoerco Posts: 19,298
    edited August 2015 Vote Up0Vote Down
    @OP: Did you say breadboard? Are you trying to use solderless breadboards for this high current motor application? Bad form, too many marginal high resistance connections. Give me leaded solder or give me death.
    "When you make a thing, a thing that is new, it is so complicated making it that it is bound to be ugly. But those that make it after you, they don’t have to worry about making it. And they can make it pretty, and so everybody can like it when others make it after you."

    - Pablo Picasso
  • Ha! Classic!
    OP gives just enough information to stir a hornets' nest, then disappears. When will we learn?

    Bless your hearts for attempting to solve every manner of semiconductor physics, circuit construction, and third party offerings.
  • With 259 views so far, the discussion is still worthwhile. Sometimes, the OP just feels they got in to deep.

    Good H-bridges are all about getting proper saturation on the final power stage. That's why I feel it is much easier to buy a pre-packaged solution than figure out all the details required to get it right.
    Hwang Xian Shen, Puddleby-on-the-Marsh.
    All things considered, I can live and thrive without Microsoft products. LINUX is just fine.
  • ROFL!

    This thread is very much a condensed history of my attempts to get from a logic signal to driving a 12V solenoid.

    As Loopy said the solution in both cases is to keep looking and eventually someone will build exactly what you need and all you have to do is solder it in.

    My bit of input is to go back and check previous sources now and then to see what has become available since you last looked. Had I done that with Parallax I would have saved much time and a similar thread in BS2 forum.

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited August 2015 Vote Up0Vote Down
    Sorry to hear your pain.
    A solenoid is actually much easier to DIY than a whole H-bridge and can likely be done with one transistor, a few resistors, and a fly-back diode.

    If I were to teach the design of a complete H-bridge, i would start out with a first lesson on controlling a solenoid.

    ++++++
    The real problem is that there are a lot of copy-cats on the internet that provide a solution without the basis behind the solution. They claim to have written a tutorial, but it is not any nuts-and-bolt design and engineering... mostly grab this, use this, and good-bye.

    The in-depth and informative presentation needs to be longer than what people on the internet write. You can't explain all and everything in a few html pages that are sharing ad space.
    Hwang Xian Shen, Puddleby-on-the-Marsh.
    All things considered, I can live and thrive without Microsoft products. LINUX is just fine.
  • A latching solenoid/actuator may still require an H-bridge.

    Is discussion worthwhile? Sure. Without a defined problem, though, everyone has parallel (and confusing) conversations. There needs to be a common understanding of "what are you seeking to accomplish?", "what are you doing now?", and "why are you doing it that way?".

    The OP may be mistaken about what function an H-bridge provides, and actually required a very different solution. He may have been satisfied with a simple DPDT relay for directional control. An off-the-shelf H-bridge solution may be sufficient. He may have been doing a homework assignment that needed to be built with specific components.

    So, one person writes "do this" and another writes "buy that", and they may both be right for the problem that they perceive, yet irrelevant for the actual problem. The greatest myth about communication, is that it has been accomplished.
  • hatallica,

    You are right about the confusion in communication here.

    However mmaslam94 asked this question two weeks ago and has not had the courtesy to return and clarify the problem as people initially asked.

    As such, who cares about the opening poster anymore? We will just chew on ideas here.

    Another case of a student with a homework problem, opening an account, making one post with a question, and never returning.

    There is another similar case going on just now with a very vague question about water flow measurement and an Arduino.

    P.S. Not that I mind pointing students with homework problems in the right direction. But they have to show willing.



  • Heater. wrote: »
    hatallica,


    However mmaslam94 asked this question two weeks ago and has not had the courtesy to return and clarify the problem as people initially asked.

    Because the OP has not responded, this thread will be sunk.

    Infernal Machine
  • Heater. wrote: »

    There is another similar case going on just now with a very vague question about water flow measurement and an Arduino.

    That one is taking on water also. :)
    Infernal Machine
  • It's kind of sad.

    It happens here and many other places on the net. Questions come up from people who give all the indication that they are on some course or other in some college or uni somewhere and have an assignment to do.

    They don't say exactly what the problem is. They formulate very vague questions. Often confusing perhaps because English is not their native language. They then show no enthusiasm for finding a solution to whatever the problem is. Then no doubt the assignment dead line goes by and nobody cares about finding the answer anymore.

    We, silly as we are, try to answer. Or tease out more details. Waste our time.

    There are shining counter examples of course. Where a dialog is established, hints tips and directions are offered and a good outcome happens. Like the guy who was tuning kalimbas with a Propeller or the other guy building a power factor meter, as study projects. Sorry I forget their names. See YouTube.

    So we continue to be silly....


  • You know it's interesting this is happening. I run a site that deals with race car technology and I don't have the same problem there.

    Most of the time they are passionate about what they're doing. Often they ask their professor if they can do a bigger project than was assigned. Then they ask my help with very specific questions. I almost want to paste some of their responses in here. Night and day difference.

    A bit strange to see so much passion for the intricacies of multiple element airfoils from students, yet so little for things such as this.

    You think it has to do with the degrees? People may choose to be an Engineer for the money. Engineering is broad. However those taking race car design probably want to design race cars.

    Also yes, the majority of people asking my help with race car design aren't native English speakers. In my case most seem to be from India.

    You're dead on though Heater.
    Founder of Kinvert
    https://www.kinvert.com/
Sign In or Register to comment.