1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Electronics Variable-voltage motor-controller

Discussion in 'Modding' started by LuitvD, 14 Dec 2006.

  1. LuitvD

    LuitvD What's a Dremel?

    Joined:
    13 Aug 2006
    Posts:
    263
    Likes Received:
    0
    I'm going to build a robot, but I'm still not sure what motor-controller I should use... I want to control two reversable motors, and I want to be able to measure the voltage and current to find out the stall of motors. The problem is, I have no idea of how to get a nice and steady variable voltage source from 1V (or zero) up to 5V that can source spikes up to 3A of current.

    And bonus question: Is there a better way of measuring current? I'm planning to measure the voltage drop over a 0,1 Ohm (10Watt) resistor using an A/D Converters, but I was wondering, is there a better alternative? (I have some 13 A/D Converters, so that's not the problem... ;) )
     
  2. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    Personally I'd use one of Microchip's PICs with a built in motor controller. They have PWM H-bridge with variable dead-time and 10 bit resolution for speed control. Rather than current measurement, I'd go for motor speed detection. The most unobtrusive way that I've done this in the past on a standard motor is to sample the back emf at regular intervals (50Hz?). The back emf voltage is proportional to motor speed, so you can feed this back into a free ADC pin on the PIC, determine the error, correct in a PID loop and maintain a constant motor speed/detect for stall and stop.
     
  3. LuitvD

    LuitvD What's a Dremel?

    Joined:
    13 Aug 2006
    Posts:
    263
    Likes Received:
    0
    so... a PIC chip with built-in motor-controller PWM... I can get that... next thing... what kind of MOSFET should I use to build me a H-bridge? And how do I get the PWM signal to the motors? (they are 140:1 gear motors) Do I nead to stabalize the voltage with a capacitor?
     
  4. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    You should use four MOSFETs that have a suitable rating for your motor. The motor controller has four PWM outputs which drive the FETs. Select 19.53kHz or greater for the PWM frequency to keep it out of audible range- but make sure your FETs have suitable characteristics for this frequency.
     
  5. OtakuHawk

    OtakuHawk What's a Dremel?

    Joined:
    30 Apr 2003
    Posts:
    666
    Likes Received:
    0
    remember: Power dissapation is no big deal with PWM, because your fets/pwr devices are only in two states:

    On

    Off


    they dissapate very little power this way.

    so all you have to worry about is the breakdown voltage, and the current capability.
     
  6. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    Not quite. You're right if your PWM frequency is low, but PWM frequencies of 20kHz+ cause the FETs to operate more in their linear region because of the capacitance of the gate (unless you have some good drivers feeding the gate). You end up causing the FETs to dissipate a fair bit of power.
     
  7. LuitvD

    LuitvD What's a Dremel?

    Joined:
    13 Aug 2006
    Posts:
    263
    Likes Received:
    0
    the switching capability of the mosfets i'm not concerned about (special high-current PWM (fast switching) MOSFETs) but the motors... aren't high frequency pulses bad for a motor? Killing the brushes or something? ...
     
  8. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    Not as far as I know, otherwise people wouldn't use PWM speed control.
     
  9. agent420

    agent420 What's a Dremel?

    Joined:
    18 Apr 2006
    Posts:
    227
    Likes Received:
    0
    ePanorama has a good overview of motor control. It is also worth reviewing Microchips Brushed DC Motor Fundamentals.

    Pwm is probably the most efficient method of motor control, and is especially good for providing torque at very low speed - something pure voltage control methods lack. Actually, voltage control may be a misnomer; electromagnetic properties are the result of current flow. It's just that providing more voltage also increases current because the resistance in the motor is (relatively) fixed [ohms law].

    The concern with pwm I believe is generally one of heat dissaption in the motor windings, although this is typically more than balanced out by the advantages that pwm control offers.

    I think you will find pwm is the way to go.
     
    Last edited: 20 Dec 2006
  10. agent420

    agent420 What's a Dremel?

    Joined:
    18 Apr 2006
    Posts:
    227
    Likes Received:
    0
    Just curious what your original control plan was? Certainly you can use a pic, but you aren't limited to that foundation...

    Also, although building an H-bridge controller is not necessarily the most complicated project in the world, there are prebuilt options you can consider that are easy to interface with and will save you the trouble of determing parts and design. Take a look at this DC Motor Control Board from Futurlec, it's pretty rugged (up to 24V 5A) and pretty cheap to boot (but you'll need 1 per motor). I've ordered a lot of stuff from them without any problems, though sometimes shipping can be a week or two if the product comes from overseas. (btw, they've got great prices on all kinds of good stuff)

    EDIT -

    Actually this Dual H Bridge Kit might be an even better solution as it provides control for two motors (4A total). Although it is not opto-isolated like the Futurlec board, you could easily add that. Motor drivers can create a large amount of electrical noise and/or spikes, potentially disrrupting your logic controller. The optical isolation seperates the logic and motor power sources.

    Agreed. Speed is probably more useful than current, unless you are explicitly looking to measure torque or force. I guess it depends on what the motor is doing; transport or finger closing for instance.

    There is positional (count) feedback as well. You can get direction, speed and position through an optical slot sensor. Many a ball mouse has volunteered for experimental duty here at 420 Labs :dremel: (sadly, they were never the same :worried: )
     
    Last edited: 20 Dec 2006
  11. LuitvD

    LuitvD What's a Dremel?

    Joined:
    13 Aug 2006
    Posts:
    263
    Likes Received:
    0
    hmm, I was just thinking, couldn't I just make a switching power supply with a simple PIC chip that has an A/D Converter? Like measuring the voltage of the circuit (which has the 5V rail connected to the ground with a capacitor) and switching of at a specific voltage, and switching on about 0,1V below that? And accepting the wanted voltage from another PIC by I2C or SPI... (ofcourse, both chips on a normal 5V voltage regulator)

    I think that'd regulate the power a little nicer (for the motors that is) then PWM. And that way I can monitor the in-circuit current.

    And: Do I need both P-channel and N-channel mosfets to make the H-bridge for my motors, or is all-N-channel possible? (I don't want to have to buy another set of P-channel mosfets, I already have these (datasheet))

    And a last one: Would it be possible to get an ADC to readout voltages above 5V? Because my batterypack will deliver 7,4V (at full charge), could I use that as the reference voltage, and read out how much 5V is compared to the battery voltage, and in that way get the battery status?
     
  12. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    PWM almost always much better than DC control of motors. But the major advantage to using PWM over DC is the improved torque at low voltages.
     
  13. agent420

    agent420 What's a Dremel?

    Joined:
    18 Apr 2006
    Posts:
    227
    Likes Received:
    0
    You basically just described PWM :duh: (switching is pwm to begin with. And if you are on the fence about pwm control, just wait until you try to design a good reliable switching circuit capable of decent current). Personally, I'd go with the simple tried & true rather than attempt to reinvent the wheel.

    Don't take our word for it; Google how many non-pwm dc motor control circuits are used in robotics. Not many, unless there is some esoteric need.

    The motor coils tend to average the pulses, so you end up measuring the voltage pretty much the same.

    I am wondering what your need is for this power monitoring... Most projects I do that have moving motors, I'm much more interested in where the position is than anything else. If my program applies power and there is no associated movement detected, I know the motor has stalled or there is another type of fault that requires attention.

    I suggest you do some Googling or look at the schematics of the boards I referred to above. There's a million and one H bridge circuits on the web. P channel fets are better suited to high-side switching; N for low-side. Might as well get the right parts for the job, they're not that expensive.

    You can do anything you like with the approriate resistor ladder voltage divider. ADC inputs are generally high impedance, so you can consider them not to present a load.
     
    Last edited: 26 Dec 2006

Share This Page