DC Motor Stall Current and Power Supply Questions - Page 1
Forum section: electronics / beginners

author: rbevis333
author_rank: Newbie
timestamp: April 02, 2013, 08:42:19 pm
content: I’m new, forgive my excessive questions.I’m trying to build a coil winder and I need to power a Pololu 37D 19:1 gear motor that draws 300 mA free running and has a stall current of 5 A.I tested on Arduino, but now I am protyping on a breadboard using a PIC18 microcontroller. Using a 12v Edit: (bench) power supply right now, but planning on setting up as laid out below when I’m done prototyping.I plan to use a 15v wall wart, with an LDO to step down the motor voltage to 12v, a switch mode regulator to step down to 5v for the PIC, and a STMicroelectronics L298N dual H-Bridge to control the motor with the PIC.I figured I could get all this done with just a few programming hiccups, but I greatly underestimated power supply design.My problem is that my wall wart has an output current of 1 A, and my H-Bridge has an output current of 2 A, 3.5 A if I tie both sides of the H-bridge together, and my stall current for the motor is 5 A.My question is how do I make this work? What would I need to do to protect my circuit? Neither my power supply, nor my H-bridge output enough current.I don’t expect the motor to stall considering its torque (84 oz-in) and its application winding 42-43 AWG magnetic wire, but I want to be safe.From my research, these are the only things I could think of.1) Put a current sensor and a shunt resistor in series with the motor. Not exactly sure how this works, couldn’t find a schematic or detailed explanation. What does this do? Would it reset everything, including my PIC and LCD which are tracking and outputting rotation count?2) Use a beefier power supply with a higher output current. I would prefer not to do considering the ones I found that output 5 A look more like my laptop power supply and cost a good deal more. Would this even be enough considering I heard that reversing the motor can draw twice the stall current? I plan on have a reverse feature, but I wouldn’t make it where you could go directly CCW from CW without some sort of long pause. Also, would a power supply with this much output current available mess with my PIC considering it and all of the components powered by it will draw nowhere near 5 A?3) Use an H-Bridge with a higher output current. I couldn’t really find any with any kind of output current for my needs at a reasonable price, but I can keep researching.4) Just make an AC current rectifier and an H-Bridge to my specs. More work and research, but maybe cheaper than buying beefier parts.Am I over thinking this? I just need to know what a simple solution would be, or a point in the right direction.Any help would be greatly appreciated, and again, sorry for the excessive questions.

author: G7PSK
author_rank: Super Contributor
timestamp: April 02, 2013, 09:05:04 pm
content: You could power it from a battery either a car or a sla would do as the starting current of your motor is equal to the stall current putting a resistor in circuit might work but you would slow the start rate and might reduce the torque to a point where it wont run anyway.

author: hammil
author_rank: Regular Contributor
timestamp: April 02, 2013, 09:14:24 pm
content: Since it's just a motor, to get your 12V at 5A, you could just use any cheap switch-mode supply you can get from ebay (example:http://www.ebay.co.uk/itm/12V-5A-4A-3A-FOR-TFT-LCD-Monitor-Adapter-Charger-Power-Supply-UK-SHIPPING-NEW-/251172641936)For the microcontroller, since it draws very low currents, all you'd need is a regulator - a 7805 will do just fine.For your H-bridge, you'll need a maximum pulse current of 5A, but a maximum continuous current of only 300mA. If only one rating is specified, you'll need it to be 5A.This one should do nicely:http://www.ebay.co.uk/itm/DC-12-30V-5A-H-bridge-Brush-Motor-Driver-PWM-Brake-For-Smart-Car-Arduino-/121061024615Have fun

author: Kremmen
author_rank: Super Contributor
timestamp: April 02, 2013, 09:20:22 pm
content: The motor power supply does not have to be regulated so a cheap(ish) solution would be to slap together a transformer, rectifier bridge and a smoothing cap. Add a fuse for safety and some necessary hardware and you are done. Most of the stuff is available/scavengeable from old surplus gadgets.For the control part, you don't need fancy H bridges or anything. Just a DPDT relay for direction and a single pwm controlled FET for speed. Both easily controllable by an Arduino, or nearly anything else for that matter. Actually you don't even need a microcontroller, just a simple switch to control the relay (or actually a DPDT switch instead of the relay), and a 555 timer in a pwm configuration (google for it).If you actually want to limit the current, you need a sense circuit of some sort. There are numerous alternatives for that part so you might want to fix the basic solution first to pick the easiest/proper limiter circuit.

author: kxenos
author_rank: Frequent Contributor
timestamp: April 02, 2013, 09:25:14 pm
content: If the H-bridge is difficult you can use to DPDT relays to do the same. But why would you need to turn the motor in both directions? For current control you can use a circuit based for example in Dave's simple DC load to control current and just add a comparator to detect the stall and cut the motor power.

author: rbevis333
author_rank: Newbie
timestamp: April 02, 2013, 11:32:20 pm
content: Thanks for the advice.Does anyone have a good link(s) for more info on current control/limit/sense circuits? What do they do exactly?Do you just set a max current limit and it completely cuts power to the motor if that limit is reached, or does it just step the voltage down for a brief moment? Do you wire it just to the motor or is it wired to the entire voltage supply, i.e. shutting off the power to the microcontroller as well?If it is just isolated to cutting/stepping down the motor voltage that wouldn't be a problem (temporarily, then automatically resets to 12v would be ideal), but if it cuts the entire power (to the microcontroller as well), that wouldn't work.The coil winder is for guitar pickups, specifically humbuckers for my Les Paul (which is why I need to be able to wind in both directions), and I will have my encoder and LCD display connected to the PIC to count and display the number of coil turns and if the voltage is completely cut from the circuit everything would be reset and I would loose my coil turn count. So if there is a way to isolate a current control/limiting/sensing circuit to only function in regards to the DC motor that would be what I'm looking for.If anyone has a link to where I could get more info on the circuits it would be greatly appreciated. I don't want to buy a prepackaged solution/circuit off ebay, I want to build it myself so I will better understand it.I will look into relays and FET switches for control, but I definitely need to keep the PIC for my project considering it's just easier with the encoder and LCD display.Thanks again.

author: kxenos
author_rank: Frequent Contributor
timestamp: April 03, 2013, 12:12:25 am
content: OK. For your application you need a stepper motor. This is not a stepper motor and the only way you can measure it's turns is with a (quite expensive) add-on encoder. I suggest to look for NEMA 23 bipolar stepper motors up to 2A and use an L297 - L298 pair to drive it. There are also other ICs like SLA7026 etc. that can drive bipolar or unipolar stepper motors and there also are ready (and cheap) stepper motor controllers that can drive 1, 2, 3 or more motors and be controlled by a uC.

author: rbevis333
author_rank: Newbie
timestamp: April 03, 2013, 12:42:46 am
content: The Pololu motor I have already has an encoder built onto to it, so I'm good on that end. I tried a stepper when I first started planning things out/prototyping but it caused delays so that idea got scrapped.Thanks though.

author: hammil
author_rank: Regular Contributor
timestamp: April 03, 2013, 02:13:00 am
content: In which case it's a question of connecting the encoder to your microcontroller to see if you can read from it, then pulsing your H-bridge, timing it according to feedback from the encoder.We'd probably need the pinout and datasheet of the motor to go much further than that... Like your question about current sensing - the easiest way is to put a low value resistor ('shunt') between the path to ground, and measuring the voltage across that. But your motor most likely won't need any sort of current limiting or sensing - it'll consume what it needs to consume based on the supplied voltage.

author: rbevis333
author_rank: Newbie
timestamp: April 03, 2013, 05:42:21 am
content: OK, after more research I'm finally getting my head wrapped around this a little and I see that I am going to have to go with a switching/switch-mode power supply for higher Amps.I literally had no idea what I was being directed to earlier. I thought you were just talking about a switch-mode IC/circuit by itself, or something like that with no regard to how I would get DC power in the first place. I didn't put two and two together, but now I see that switch-mode power supplies are just AC to DC rectifiers integrated with a switch-mode circuit, or a least I think that's right. Please correct me if I am wrong.I still would like to buy the parts myself and build one on my own to teach myself a lesson (and to get over my fear of AC power), but I have no idea how I would get a specific current from a DIY switch-mode power supply. I understand how to convert from AC to DC, but how would I get say 6 Amps out of the power supply? Is there a good resource on switch-mode power supply building that can be used, or do you use a data sheet, or are there some kind of standard calculations to get to 6 Amps, 8 Amps, or whatever is needed?Mouser has AC/DC Switching Converters under their Power Management IC's section, but the highest supply current I could find was 3 A, so how do you get to 6 Amps?Also, switching power supplies like the Mean Well products that are just a semi open enclosure with screw terminals, are those the same thing as regular switching power supplies, just minus the full enclosure and plug? I guess you would just mount the female receptor to your projects enclosure and wire it to the screw terminals?Thanks for the help.

author: Kremmen
author_rank: Super Contributor
timestamp: April 03, 2013, 06:54:01 am
content: Ok, continuing from the point where you say you want to do DIY it as far as possible:1. You _can_ buy a switchmode PSU but where is the fun in that? As i said earlier, you do not need a regulated supply for the motor power. The small torque ripple induced by the unregulated supply is insignificant. An iron transformer with a 60 VA (12V * 5A) secondary is going to be a smallish fist sized lump but that is the biggest component you need. On the primary side, add a power cord, mains rated switch and a fuse, on the secondary side a rectifier bridge and smoothing caps and you are done there. No power factor correction or EMI shielding needed for this kind of small power, inherently harmless circuit.2. Current sensing can be done at least i 2 different ways, a) using the microcontroller and including current limit in the control loop or b) by adding one more pwm stage between the MCU and the power switch element. Both alternatives will measure the voltage loss over a low ohm sense resistor and amplify the resulting signal if necessary. Let's go throught these in a bit more detail next.2a. Current control using the MCU- convert the instantaneous current sense voltage to digital using the MCU built-in A/D-converter. You need to scale the sense voltage to the A/D converter range by suitable amplification of the signal and selection of A/D converter reference voltage or both.-Once digital, you include the current actual value in the control loop somehow. The canonical solution is to implement a "full" control loop which consists of an outer speed control loop and an inner torque control loop. Both loops should implement the PI control algorithm. You enter the speed setpoint to the speed control loop by converting a potentiometer voltage or entering the speed ref from a keypad or whatever. The speed actual value you get from the encoder you mentioned the motor having. These values are fed to the speed PI controller that then outputs the torque reference for the subsequent torque PI controller. This functions similarly to the speed controller but in this case it measures and controls the motor current. The limitation comes from setting a maximum setpoint value, i.e. the signal output from the speed controller will be limited to a value representing the maximum motor current. The torque controller will then target at most that maximum.Alternatives to the above are some kinds of limiter algorithm where you just pull back the pwm duty cycle to the motor, but they end up having many of the features of the torque controller, so that may be the most straightforward approach in the end.This is the way control was achieved for large industrial DC motors in their heyday. Been there, done it.2b. Current limiting doing it stand-aloneOnce you have output the pwm signal from the MCU, you intercept it with a circuit consisting of an AND gate, oscillator, an RS flip-flop and a comparator. The system works like this:- The pwm signal from the MCU is input to the AND gate. The output of the AND gate goes to the power switch (e.g. FET gate).- The other input to the AND gate comes from the RS flip flop. This means whenever the flip-flop is SET, the pwm signal goes through to the power element.- The RS flip-flop is SET by the oscillator that should have a frequency comfortably above the pwm frequency of the MCU, say 10 times or so.- The RS flip-flop is RESET by the comparator circuit. The comparator compares the current sense value to a setpoint and whenever the actual current is above the setpoint, the comparator RESETS the flip-flop. This in turn inhibits the pwm signal, closing the power switch and motor current starts to ramp down. The current sense signal goes down, the comparator changes state and the RESET signal is removed.- When next the oscillator SETs the flip-flop, current again starts to ramp up provided the pwm signal is still on, and the cycle repeats.You can create a dynamic current limit by connecting the comparator setpoint input to a D/A converter and setting the limit value from the MCU, if you want to.This scheme also works although the control dynamics will not be comparable to the above solution when it is done right.I can go into more details if you want to consider either of the above.Edit: typos.

author: Kremmen
author_rank: Super Contributor
timestamp: April 03, 2013, 07:43:09 am
content: Covering a couple of points still...Quote from: rbevis333 on April 03, 2013, 05:42:21 amNot necessarily. You can if you want to.QuoteI hope there is not a misunderstanding here? A normal PSU that we are talking here produces a constant voltage. The magnitude of the output current however is determined by the load you connect to the PSU, according to Ohm's law. So the only calculations you do are to make sure the PSU is _capable_ of providing the required current. You don't "push" the current into the load. Earlier you stated that your motor will draw 300 mA when idling and 5 A when stalled. That is a typical example. The motor draws the current instead of the PSU pushing it.As to why the variation in this case - it is simple:1: A (DC) motor is a generator as well. Turn the shaft and you can measure a voltage from the motor terminals. When the motor is turned at the nominal speed, it will in principle produce the nominal voltage. If you now connect said nominal voltage to the motor terminals, _no_ current will flow because there is no voltage difference.2: Clamp down the motor shaft to prevent it from turning. This means the motor can generate no voltage because the shaft cannot turn. Now feed the nominal voltage to the terminals. As there is no voltage present (it is called back EMF by the way) the only thing limiting the current now is the resistance of the motor armature winding. That is usually quite low so a considerably larger current will flow. In this case 5 amps from which we can immediately calculate the armature winding resistance Ra = 12V/5A = 2.4 ohms. A typical figure for a small DC motor.What happens when your motor is idling and you introduce a load? The motor speed changes in accordance to the formulaU = v/Kv * RaIa, whereU = motor terminal voltagev = motor speed (typically in units rpm)Kv = motor velocity constant (typically in units rpm/V)Ra = motor armature resistanceIa = motor armature currentThe equation has 2 terms reflecting cases 1 and 2 above. Firstly the term v/Kv describes the generation of back EMF as a result of the motor rotation. An ideal motor idling will draw no current because the back EMF exactly matches the terminal voltage due to this term. In practice when the motor is loaded it slows down and the back EMF no longer matches the terminal voltage exactly. Enter the second term RaIa. Now the armature current increases thus producing more torque to match the load but also to induce a voltage loss due to ohmic resistance in the armature circuit. The sum of these two term always exactly matches the supplied terminal voltage.So in the end your power supply must be able to provide the Ia in the equation above, in the case when v = 0 i.e. the motor is standing still. This is the 5 amp stall current. It is the maximum the motor will draw in any situation unless you change the supply voltage.QuoteYou can use a Mean Well PSU, no problem. Only it is unnecessarily sophisticated for this kind of use but if you don't mind then no problem.What you should not do is don't attempt to build a mains powered switchmode PSU yourself. It is not something you start with, it is something you graduate into. There are numerous safety aspects involved, not to mention EMI issues and definitely a lot of non-elementary circuit design and layout experience required.

author: rbevis333
author_rank: Newbie
timestamp: April 04, 2013, 01:08:36 am
content: Wow, thanks for all the great information from everybody!The more answers I get, the more questions I have, so I'm definitely going to have to do some more research to determine which way I'm going to go.I need to get everything breadboarded/programmed with power coming from my bench supply, then go from there and try some different things out.Thanks again!