Shop OBEX P1 Docs P2 Docs Learn Events
Speed control of DC motor using propeller — Parallax Forums

Speed control of DC motor using propeller

4Alex4Alex Posts: 119
edited 2009-12-02 16:16 in Propeller 1
Good morning everybody,

I am looking at controlling the speed of a small 24VDC motor. RPM (no load) is 5'600. Under max load, the motor seems to stay between 1.2A and just shy of 2A peak. I have a question that I'd be really grateful if someone could answer:

Currently, I vary the speed of the motor using a manual rheostat. Quite inefficient but it works. I would like to replace it (and the human in the loop as well) with an electronic circuit, where the propeller would control directly the speed under a program. I intend to use Hall sensor as feedback and PID as constant speed control.

I've found the following (www.solorb.com/elect/solarcirc/pwm1/) PWM circuit that seems applicable but the PWM setting is still manual. How could a replace the manual portion generating the PWM signal in order to use PWM generated by the propeller is what I'm looking for. Could anyone suggest a proper circuit or at least point me in the general direction of an appropriate IC ?

Thank you so much for any assistance answering this question.

Cheers,

Alex

Comments

  • StefanL38StefanL38 Posts: 2,292
    edited 2009-12-01 15:19
    As you have the propeller the approriate IC is TATAAA ! the propeller himself and the "circuit" is TATAA ! any IO-Pin of the prop you like and a transistor.

    This means you can feed the PWM-signal into the base of a transistor and the transistor drives the FET Q1 in the circuit from your link.
    So all the circuitry U1a, U1b, U1c, U1d is obsolet.

    There are several pwm-objects in the propeller object-exchange that create PWM-signals on any IO-Pin you like

    Frequency is adjustable

    Do a search with keyword pwm in the obex

    best regards

    Stefan
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2009-12-01 16:02
    4Alex - I would recommend doing some research into H-bridge circuits and IC. It is a good idea to use H-bridge (describe the schematic look of transistors/mosfets) to control the DC motor. There are also ICs that have all the H-bridge built in.

    If you are not as much into circuits, you can look at some of the higher level motor drivers that Parallax or Pololu sells. The Propeller would talk serial or PWM depending on which product you buy.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • 4Alex4Alex Posts: 119
    edited 2009-12-01 16:32
    Good morning Stefan.

    Thank you for your reply. Yes the PWM portion (U1) of the circuit is replaced by the propeller. My question was more as to how interface the propeller to Q1 (I'll use N-MOSFET IRFZ34N) at 24V: do I need an opto-isolator, what voltage is required to drive Q1, etc. Following your suggestion of using a transistor, do I need to drive the base of Q1 at 24VDC ? If so, can a PNP transistor be connected to 24VDC and the base of Q1 (acting as the 'load') okay ? Or is it better to use a cascade ON-OFF switch such as propeller drives a NPN 2N2222 which drives a PNP 2N3906 connected to 24VDC and the load ? I just want to make sure I'm not destroying anything...

    Cheers,

    Alex
  • 4Alex4Alex Posts: 119
    edited 2009-12-01 16:36
    Good morning Timothy:

    Thanks for the suggestion but the motor does not need to run in reverse, so the H-bridge is unnecessary. My real concern is rather to not burn the propeller i/o...

    Cheers,

    Alex
  • Clock LoopClock Loop Posts: 2,069
    edited 2009-12-01 17:59
    4Alex said...
    Good morning Timothy:

    Thanks for the suggestion but the motor does not need to run in reverse, so the H-bridge is unnecessary. My real concern is rather to not burn the propeller i/o...

    Cheers,

    Alex

    H-bridges allow more than just forward/reverse... depending on how you pwm it, the reverse direction can be used as a brake. Much like how one pwms more to speed up, pwm in the opposite direction to do a controlled slow down(not just a coast)
    Not sure if you would need that.
    Also many h-bridge packages have all kinds of overtemp/overcurrent protection circuitry, and also diodes to prevent any inductance from doing funny things to your h-bridge(mosfets)

    h-bridges are really cheap and your need for only 2amps... you can find surface mount h-bridges.


    24bux will save you some time.

    http://www.robotshop.ca/solutions-cubed-simple-hbridge-4.html

    http://www.solutions-cubed.com/solutions cubed/MMB2003.htm <-- this one has a serial interface, no direct pwm, you just tell it basic commands.
  • kwinnkwinn Posts: 8,697
    edited 2009-12-01 18:15
    The fet you have chosen will not turn fully on with the 3.3V out from a prop pin so you will need some kind of driver. I would suggest using an optoisolator to drive the gate from the 24V supply. Depending on the PWM frequency it may need to be a high speed optoislator.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-12-01 18:20
    This is a circuit I use often. Using a single 8-pin SOIC, a resistor and a couple optional capacitors.

    I haven't tested it's limit, but I use it quite often at over 5KHz, and at all kinds of PWM ratios. There is a little bit of time required to switch states, but I would imagine for a motor it is not a big issue. I use the IRF7307PbF MOSFET, but there are plenty of other N/P-type combination out there. You could use IRF7343PbF, it could drive the motors at up to 3.4A (continuous) and 55V.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!

    Some of my objects:
    MCP3X0X ADC Driver - Programmable Schmitt inputs, frequency reading, and more!
    Simple Propeller-based Database - Making life easier and more readable for all your EEPROM storage needs.
    String Manipulation Library - Don't allow strings to be the bane of the Propeller, bend them to your will!
    Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!
    423 x 347 - 15K
  • 4Alex4Alex Posts: 119
    edited 2009-12-01 19:53
    Thank you all ! I'll go with Bobb's solution and the IRF7343.

    @Bobb: Thank you for your circuit & recommendations. Just to clarify:

    1. Power supply above C1 would be 24VDC in my case ?

    2. Which values do you use for C1 and C2 (my environment could be noisy enough to justify caps) ?

    3. I presume one terminal of the motor connects at G1 (the circle icon near C2, not MOSFET G1) and the other terminal goes
    to ground. Is this correct ?

    4. I saw the use of a snubbing diode in a lot of other circuits uusing MOSFETs. Should I consider adding one in your design ?

    Thanks for your help.

    Cheers,

    Alex
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-12-01 20:24
    4Alex said...
    1. Power supply above C1 would be 24VDC in my case ?

    2. Which values do you use for C1 and C2 (my environment could be noisy enough to justify caps) ?

    3. I presume one terminal of the motor connects at G1 (the circle icon near C2, not MOSFET G1) and the other terminal goes to ground. Is this correct ?

    4. I saw the use of a snubbing diode in a lot of other circuits uusing MOSFETs. Should I consider adding one in your design ?
    1) Correct.

    2) If you put them: the larger the better. Most likely you won't need them, though. C1 will put less spiking load on the power supply (could be important on battery supplies -- a few thousand µF wouldn't hurt). C2 will just smooth the output. With electric motors it won't make much of a difference. It could quell some flyback from the motors. For smoothing at 2A you will need a fairly large electrolytic capacitor, but for flyback noise, large ceramic capacitors are usually better (put both if you really care, the more the merrier).

    3) Correct, I forgot to change that symbol when I copied the image over.

    4) That is always a good idea. A schottky diode (a volt or so higher than the maximum input voltage) parallel to C2 or a rectifying diode between the MOSFET and C2 (after the MOSFET) should prevent any potential problems.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!

    Some of my objects:
    MCP3X0X ADC Driver - Programmable Schmitt inputs, frequency reading, and more!
    Simple Propeller-based Database - Making life easier and more readable for all your EEPROM storage needs.
    String Manipulation Library - Don't allow strings to be the bane of the Propeller, bend them to your will!
    Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!
  • 4Alex4Alex Posts: 119
    edited 2009-12-01 21:07
    @ Bobb:

    Thank you so much. I'll skip the caps then as I'm connected directly to the front end power supply (AC to 24VDC). The electronics are fed through smaller power supplies. I'll use a 25V 3A DIODE SCHOTTKY 25V 3A STmicro STPS3L25S.

    Cheers,

    Alex
  • MarcelloMarcello Posts: 29
    edited 2009-12-02 13:08
    @ Bobb:

    Very nice idea the coupling of n/P channels. I did a similar thing with a BC547 transistor and a Mosfet, but i was not happy with it.
    I tryed to find a logic level MosFet to be driven directly by the propeller, but i did not find the right component (they became all too hot)

    Bobb can you suggest me a similar component suitable for a higher voltage ?
    (65 Volts could be the minimum, maybe also·55, but 55 are too close to the limit)


    ciao
    Marcello
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-12-02 16:16
    Marcello said...
    Bobb can you suggest me a similar component suitable for a higher voltage ?
    (65 Volts could be the minimum, maybe also 55, but 55 are too close to the limit)
    IRF7350PBF is 100V, but you are limited to a continuous 1.2A or 6A pulsed (through the P-channel). The N/P MOSFETs I am looking at jump from 55V to 100V (don't see anything above that).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!

    Some of my objects:
    MCP3X0X ADC Driver - Programmable Schmitt inputs, frequency reading, and more!
    Simple Propeller-based Database - Making life easier and more readable for all your EEPROM storage needs.
    String Manipulation Library - Don't allow strings to be the bane of the Propeller, bend them to your will!
    Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!
Sign In or Register to comment.