Electronics > Beginners
Controlling the speed of a DC motor
<< < (3/4) > >>
David Hess:
PWM will not allow trading speed for torque any more than lowering the voltage will.

The motor accelerates to the point where the back EMF plus the voltage drop through the windings is equal to the input voltage.  Since the current is proportional to the torque, so is the voltage drop across the windings.

There are a couple of other ways to regulate the speed:

1. Periodically disconnect the motor and measure the back EMF to get the speed.  This can be done as part of the PWM cycle.  A completely analog design can do this using a sample-and-hold circuit.

2. Since the motor's winding resistance is effectively in series, give the driver a negative resistance characteristic.  The voltage drop across the winding resistance is proportional to current so increase the drive voltage as the current goes up to cancel it out.
pepelevamp:
they say 20,000rpm at 3 volts, but you want 500rpm.
20,000/500 = 40. you need 1/40th duty cycle, or 6.4/256. maybe round it up to 7 out of 256 to get 540rpm.

seems well within reason to use a PWM.
do you have more than one motor? do they have to go at different speeds or can they all roll the same speed?

theres probably some cool motor-controller IC chips around with lots of options. i'd be keen on that.


planet12:

--- Quote from: David Hess on July 18, 2019, 01:36:19 am ---1. Periodically disconnect the motor and measure the back EMF to get the speed.  This can be done as part of the PWM cycle.  A completely analog design can do this using a sample-and-hold circuit.

--- End quote ---

I can confirm this method works quite well. I used it with FreeRTOS on an ATMega328P, pausing PWM 50 times a second and taking several samples with the ADC, and using that to control a PID loop. This makes for a very simple hardware setup; a MOSFET for the motor, some fast diodes to clamp back-EMF spikes, and an RC filter on the ADC input to keep as much noise out as I could.

The ADC measurements will still be very noisy - depending what the brushes/back-EMF are doing, you could be reading zero, the back-EMF, or VCC+diode drop - or something in-between.

What I found to work well in the end was to take a number of samples, sort them, then take the median (NOT the mean/average). This removes the outliers from the mix, and gave me a stable speed with quick response to changing load. I'm taking 15 ADC samples - this was empirically determined with the speed range and motor I was using once everything was put together - you want to sample enough over a long enough period so that your median value is useful).
Mechatrommer:
i know this is nearly a 2 years old thread, some member already got banned in the process, and the OP probably already found a solution to his problem, but fwiw and to be concise to what he was asking...


--- Quote from: engineheat on January 12, 2018, 06:07:45 pm ---1. A gear train trades rpm for torque, so if I get 1000 rpm at the output, I get a corresponding multiplier for torque. Is this also true for PWM speed control approach?
--- End quote ---
no you wont get torque multiplier with PWM.. gear train will convert power received from battery between torque and speed, but with PWM, you are reducing battery power in the first place, so no torque nor speed increase achieved by reducing battery (input) power.


--- Quote from: engineheat on January 12, 2018, 06:07:45 pm ---2. Is it even possible to bring down the rpm from 20,000 to something like 500 using PWM? That's a super small duty cycle.

--- End quote ---
possibly... with tuning a trimpot with the right tongue angle, beside changing PWM % duty cycle, changing PWM frequency or increasing period is another way to further reduce power to motor hence slower RPM is achievable. but once load is changed, RPM will change dramatically and you'll need to adjust again with tongue at different angle. load is not necessary what you have put to the motor, but things like bearing friction, contact resistance etc or even diminishing battery power (voltage) will change the motor operation in load vs power chart.


--- Quote from: engineheat on January 12, 2018, 06:07:45 pm ---3. Can you recommend a general approach for my problem? FYI, I also want to reverse the spin periodically (I guess a H bridge is for this?)

--- End quote ---
while others have suggested other method such as EMF monitoring, those open loop control like the above manual trimpot control will still subject to RPM changes, another problem is if you want for accurate positional control which open loop control methods are poor in achieving. one proven method is using encoders for closed loop control, coupled with control algorithm SW to achieve desired speed, acceleration and position.

and yes, if you want reverse direction, H-bridge is common and the better known way after manual mechanical switches..

btw, its going to be fun playing with this built-in encoder motor.. china provided us with cheap solution such as ...
https://www.ebay.com/itm/130-Motor-DC6V-12V-7800RPM-Metal-Speed-Encoder-Tachometer-Motor-AB-Phase/192486576192?epid=18003843567&hash=item2cd1181040:g:hKUAAOSw5k1cdyBy

motor with built in gear train also available at cheap, bless to them for providing to hobby engineering community... may they find the true path...
https://www.ebay.com/itm/Silver-40RPM-DC-1-5V-6V-Small-Micro-Metal-Geared-Box-Electric-High-Torque-Motor/222858882418?hash=item33e36cad72:g:HxkAAOSw~~xalWy4

before this, there was/is brand name system that cant be afforded from west or germany iirc... i bought several version of these china motors incl the bigger one and had a little moment playing with them before going into another directive... until i come back to this again. cheers...
pepelevamp:

--- Quote from: planet12 on July 20, 2019, 04:03:57 am ---What I found to work well in the end was to take a number of samples, sort them, then take the median (NOT the mean/average). This removes the outliers from the mix, and gave me a stable speed with quick response to changing load. I'm taking 15 ADC samples - this was empirically determined with the speed range and motor I was using once everything was put together - you want to sample enough over a long enough period so that your median value is useful).

--- End quote ---
hahaaa dude thats actually pretty clever. with regards to the median - did you count each ADC value once and then look for the median value?
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod