Shop OBEX P1 Docs P2 Docs Learn Events
Controlling an H-bridge — Parallax Forums

Controlling an H-bridge

D FaustD Faust Posts: 608
edited 2007-07-01 16:19 in General Discussion
Can I use the Pololu motor contoller (http://www.parallax.com/detail.asp?product_id=30052) to control two H-bridges.· I ask this because·1) It seems more·economical (less expensive) than buying a more robust motor contoller to handle higher current/voltages··2) the motor controller is less expensive than the PWMPAL to generate analog voltages with reverse polarity (I think I wrote that right).· 3)· I plan to start small and expand.
Thanks in advance.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust

Comments

  • JonnyMacJonnyMac Posts: 8,948
    edited 2007-06-29 14:34
    Not likely -- the Pololu has an h-bridge on it. My July N&V article shows how to create your own serial motor controller using the SX28 proto board; of course, you'll need and SX-Blitz or SX-Key to load the program into the board.
  • Steve JoblinSteve Joblin Posts: 784
    edited 2007-06-29 21:29
    I'm not quite sure why you would want Pololu unit to control H-bridges... Doesn't the Pololu include H-bridges? I have used their product on several of my robots to control two motors. I can control speed and direction of each one with a simple serial command. The motors that I used were basic servos where I ripped out the electronic guts... what I was left with was a small motor, a gear drive train, and a case that was easy to mount. The Pololu Dual Serial Motor Controller also comes as a though-hole kit version for only $20! Check it out here... http://www.pololu.com/products/pololu/0101/
  • D FaustD Faust Posts: 608
    edited 2007-06-30 01:33
    The reason I ask such a question is because the pololu motor controller can only handle 1 amp (is that peak?) per motor, so if I wanted more amperage I would need a new motor controller.· With the setup that I am talking about I could use the variable voltage output as a logic/pwm signal for another H-bridge that will tolerate higher voltages/amperages.

    Yes, the motor controller does include H-bridges but I am looking to expand the limits.· About the through hole kit version.· That is for higher voltages and wouldn't work well below 5V, right?

    That is why I would want to contol an H-bridge with an H-bridge.· I don't mean to be picky, but what I really would like to know is IF it would work and why (it wouldn't).· Thanks

    If this makes more sense, could I use the other chip (the one that handles the serial interface) to control and H-bridge with higher tolerances.· I found it and it is the PIC12C508A.· Would I have to program it if I bought it to control an H-bridge? (does it come programmed with the motor contoller?)
    Does that chip do the same thing as the one for the PWMPAL (could I find that chip anywhere)

    Any other cheap solutions to handling a variety of voltages are welcome. (I am looking for expandability)

    Steve, I do like your idea for the servo cases and motors, thanks for the advice.

    Thank You in advance for any comments/suggestions, I know I posted a lot of questions.blush.gifconfused.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    D Faust

    Post Edited (D Faust) : 6/30/2007 2:11:39 AM GMT
  • JonnyMacJonnyMac Posts: 8,948
    edited 2007-06-30 01:41
    Call me cranky, but I think it's just rude to ask for PIC chip (or other vendor) guidance on Parallax's forum....

    If you're going to program a chip, why not use the SX that -- drum roll, please -- is sold by Parallax? I did a simple serial controlled motor controller with the SX for Nuts & Volts (perhaps I was too subtle in my first post). Connect your choice of H-Bridge (I used an L293D) and go to town; the source code is in BASIC (SX/B) so it's very easy to modify as you desire.

    www.parallax.com/dl/docs/cols/nv/vol8/col/nv144.pdf
  • D FaustD Faust Posts: 608
    edited 2007-06-30 01:54
    Jonny, I know what you mean, I just read the manual for the controller and posted what I found. I did notice that it appears to have no eeprom (unless I missed it) so would I need one for the SX. I currently have a stamp and BOE and am not familiar with BASIC. Is it similar to PBASIC (would I be able to pick it up easily)? Should I just run the navigation program on the SX and use the stamp for PWM (because it's slower, I think)?

    Jonny, I am still trying to find out why H-bridge to H-bridge won't work.

    Sorry, if I offended anyone at Parallax, I love these forums, you get exactly the answers you need!
    Thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    D Faust
  • JonnyMacJonnyMac Posts: 8,948
    edited 2007-06-30 02:23
    If you can program in PBASIC you can learn to program in SX/B -- they're very close. SX/B imposes a little more responsibility on the programmer than PBASIC, but the payoff is in performance. If you actually need an EEPROM, then you can easily add it with SX/B's I2C instructions.
  • D FaustD Faust Posts: 608
    edited 2007-06-30 11:08
    I thought that an EEPROM was required to store the program because the RAM looses its contents with a loss of power.· I looked at the commands and they look extremely similar,·it shouldn't be too much of·a switch.·· The Blitz is a lot more expensise than the SX, strange.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    D Faust
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-30 15:08
    Make sure you understand what a motor controller does and what an H-Bridge does. You can use the Wikipedia for information (search the Internet for "wiki h-bridge"). The H-bridge simply provides a way to: 1) Reverse the polarity of the power to the motor, 2) Allow a logic level controller to switch on and off the power to the motor rapidly to provide high-torque variable speed (PWM), 3) In some cases, provide for shorting the motor winding to cause dynamic braking. If you want, you can use a DPDT relay to reverse the polarity to the motor. It's certainly easier and maybe cheaper as long as you're not in a hurry. You normally would have to slow down and stop the motor before reversing the polarity and starting up again so the relatively slow speed of the relay is not usually a problem. If you use a relay, then the PWM can be done with a single MOSFET power transistor (preferably one that's made for logic level switching, with a low gate threshold). There are all kinds of power transistors out there to switch any sort of load. The main issue is that normally, when a Stamp is producing a pulse train (like for PWM), it can't do anything else. That's why there are things like the PWMPAL and other 3rd party peripheral processors. The SX and Propeller can produce a PWM pulse train while doing other things. You can also make a cheap pulser using a 555 timer and a digitally settable pot from Dallas that the Stamp can control (set and forget).
  • D FaustD Faust Posts: 608
    edited 2007-06-30 15:56
    Does the SX have multiple cogs like the propeller?· Also can H-bridges handle just an anolog signal? (as if from a motor controller)· Basically are they on/off or are they like MOSFETs where the voltages are somewhat proportional?· I was originally thinking about using a relay and MOSFET, but I was stumped by the fact that a stamp can only do one thing at a time.· Thanks a lot, I will have to look into the 555 timer idea.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    D Faust
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-30 16:34
    The SX has a single processor. It has interrupts though and there's some special hardware to help keep them reasonably well behaved. As a result, it can do PWM output while doing something else.

    Look at the H-bridge writeup. They're really intended for a strict on/off (logic level) control. Even though they use MOSFETs, they're intended to be driven completely into conduction or completely off (and quickly). The whole idea of using PWM is to provide maximum power when on, but adjusting the average power (to provide maximum torque, but adjustable speed).
  • D FaustD Faust Posts: 608
    edited 2007-06-30 16:52
    Thanks for clearing that up. Is two PWM signals, to mosfets, about the max an SX can output? I am leaning towards the relay-mosfet-SX combination. (in case anybody wanted to know)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    D Faust
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-30 17:28
    An SX can do a bunch of PWM signals and a serial port as well. I believe that the PWMPAL is built with an SX processor.
  • JonnyMacJonnyMac Posts: 8,948
    edited 2007-06-30 17:44
    D Faust said...
    I thought that an EEPROM was required to store the program because the RAM looses its contents with a loss of power. I looked at the commands and they look extremely similar, it shouldn't be too much of a switch. The Blitz is a lot more expensive than the SX, strange.

    No, the SX's program stored onboard; only the RAM contents are lost at power down. Tthe BASIC Stamp uses an EEPROM because what's running in the PIC/SX is the PBASIC interpreter.

    The Blitz is a programming tool; it accepts data from the IDE and generates the proper programming voltages and signals for the SX chip -- you only need one. That said, if you're serious about microcontrollers and using the SX you should get the SX-Key. Yes, it's more expensive, but it gives the ability to program, run, and provide debugging data to the IDE -- the Blitz is just a programmer and cannot run the chip (you'll need an external source if above 4 MHz and/or need stable timing for things like SERIN/SEROUT) or provide debugging information to the IDE.

    Post Edited (JonnyMac) : 6/30/2007 5:49:03 PM GMT
  • D FaustD Faust Posts: 608
    edited 2007-06-30 19:40
    Could I have the SX send serial data to my stamp and then to my computer for debugging of the SX? Thanks for the info about the PWMPAL, I was woundering what ran that a few posts back.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    D Faust
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-30 20:02
    You could, but I don't recommend it. It's more work and the Stamp is likely to miss some important debugging information while it's busy sending data to the PC since it can only send or receive at the same time.
  • D FaustD Faust Posts: 608
    edited 2007-06-30 22:44
    Do I have to program the SX in assembler to let it do two PWMs at a time or can I use the SX/B?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    D Faust
  • bennettdanbennettdan Posts: 614
    edited 2007-06-30 23:33
    You can use SX/B to program two PWM signals and if you use the SX48 their are two hardware timers that can output two different PWM signals and you wont affect speed of the processing of your main loop at all.
    Check out this forum discussion on using the hardware timers and also being able to use INterupts to output multiple PWM signals.
    http://forums.parallax.com/showthread.php?p=651741
    But if you use the Interupt you can not use Serin and Serout commands.
    Also one more thing the SX48 is the only one with the hardware timers the Other Sx chips do not have them.
  • D FaustD Faust Posts: 608
    edited 2007-07-01 00:47
    I was going to go with the SX28 because it is DIP and would fit better in my applications, would it not work because it doesn't have a timer? So... IS there a way to generate 2 pwm signals while reading serial info, using the SX? (I understand that interupts won't work.)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    D Faust
  • JonnyMacJonnyMac Posts: 8,948
    edited 2007-07-01 16:19
    Yes -- the motor controller project I keep pointing to (July N&V) does exactly that: it accepts serial data and then PWMs to motor control outputs. It uses the interrupt to synthesize a receive UART, a transmit UART, and handle the motor PWM.

    Post Edited (JonnyMac) : 7/1/2007 4:25:49 PM GMT
Sign In or Register to comment.