Controlling the speed of a DC motor - Page 1
Forum section: electronics / beginners

author: engineheat
author_rank: Frequent Contributor
timestamp: January 12, 2018, 06:07:45 pm
content: Hi,I have a low speed, low torque application that I want to use a DC motor for. Here is a motor that satisfy my size requirement:It appears to be a brushed DC motor. But the rpm at around 20,000 and that's way too high. I need about 500 to 1000 rpm. Again, the load is very light (close to nothing). To bring down the rpm, I can either use a gear train, or use PWM. I have a few questions: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?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.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?)I have been playing around with the 28byj-48 stepper motor lately. I guess I can use a stepper motor but I heard it's not as efficient.Thanks

author: phil from seattle
author_rank: Super Contributor
timestamp: January 12, 2018, 07:29:05 pm
content: I would definitely use a reduction gear. You can reduce the size of the motor if you do that. PWM does not increase torque.Yes, HBridge for reversing. gear reduction to get you close to your speed range. PWM for fine control. I'd also suggest and encoder fro feedback to control the exact speed. PID is a good way to control speed, btw.

author: Nusa
author_rank: Super Contributor
timestamp: January 12, 2018, 07:31:52 pm
content: The generic answer is change the voltage to change the speed. However, you have to have enough voltage to start the motor in question.2) Doubtful. You're clearly way outside the limits of that motors design.3) Find a motor that's intended to operate in the range you desire.

author: oldway
author_rank: Super Contributor
timestamp: January 12, 2018, 07:58:27 pm
content: What's the power supply voltage ? I guess 5V, is it right ?Choose a 24V motor instead of a 3.6V motor.What's the precision and stability of the speed you need ?For high stability, you should use a feedback.Speed information can be obtained from another dc brushed motor coupled on the same shaft or from an optical or magnetic pulse generator.

author: engineheat
author_rank: Frequent Contributor
timestamp: January 13, 2018, 04:45:28 pm
content: Quote from: phil from seattle on January 12, 2018, 07:29:05 pmBy “encoder” do you mean a rotary encoder? with the shaft of the rotary encoder coupled to the motor output shaft?thanks

author: engineheat
author_rank: Frequent Contributor
timestamp: January 13, 2018, 04:48:29 pm
content: Quote from: Nusa on January 12, 2018, 07:31:52 pmI understand voltage is roughly proportional to rpm, and current is proportional to torque. But what determines the rpm of a motor when there is no load? For example, if the same voltage is applied to 2 different motors under no load, and they have different rpm, what factors influence this? Is the no load rpm similar to terminal velocity in free fall? So theoretically a motor will keep on speeding up until it explodes if there is no friction?thanks

author: phil from seattle
author_rank: Super Contributor
timestamp: January 13, 2018, 08:42:22 pm
content: yes, rotary encoder.

author: Zero999
author_rank: Super Contributor
timestamp: January 13, 2018, 08:46:22 pm
content: Quote from: engineheat on January 13, 2018, 04:48:29 pmIt depends on the voltage generated by the motor, when its shaft is rotated at a certain speed. For example, if a motor generates 1V, when its shaft is spun at 1000rpm, then it will rotate at 12 000rpm when connected to a 12V supply.The strength of the magnets and number of turns on the armature, determine the voltage generated. More turns and weaker magnet will result in lower speeds per volt.The torque depends on the current. Stronger magnets and more turns result in greater torque, although there's a limit to the number of turns for a given armature size and thinner wire, results in greater power dissipation, thus limiting the maximum allowable current.Stronger magnets result in a higher efficiency motor, because fewer turns are required for the same speed, so the wire gauge can be thicker.Higher voltage motors, use thinner wire and more turns, given everything else remaining equal.

author: Paul Price
author_rank: Super Contributor
timestamp: January 14, 2018, 12:17:38 am
content: If the load is light enough, you can get just about any speed you want out of the motors you've bought using pwm, but some feedback from the motor will let you set and hold any speed steady. but for any speed, a certain precisely set PWM value will hold the lightly loaded motor at a fixed speed, even without feedback control. You just have to find out what that PWM value is by playing with PWM values.I've taken a round piece of stiff plastic and using a black felt pen, spaced 8 or more evenly spaced black stripes across the diameter of this disc and then placed it on the motor shaft as close to the housing as practical. No, using a LED and a photodector LED I was able to generate pulses that clearly show the speed. I salvaged the rotary encoder from a discarded printer(it had two of them).Since I know a thing or two about MCU's, I was able to create the PWM waveform to drive the motor using a MOSFET in series with the return (Neg Terminal) of the motor. The MCU was very easy to program to be able set the PWM waveform to drive the MOSFET. I was able to know the speed of the motor from the rotary encoder.The real issue is to get the motor to start from a stalled non-rotating condition. Then PWM will easily do the rest with a very light load.The idea is simple, you first determine the startup voltage of the motor and apply this voltage for the time it takes for the motor to start, then reduce or set the correct PWM to control the voltage (in series with the motor) to keep it at the desired RPM.Not so clever with MCU's? You can use a LM555 chip to easily create a PWM to control your motor. The PWM chip can then control a MOSFET or a darlington transistor to control your motor. Lots of circuits like this posted on this website.You can even just use a SPDT relay to switch betweena starting voltage and a desired speed set voltage.Stable operation at the slowest of RPM might be a problem(<5 RPS), but you won't know this for sure until you try it!

author: VanitarNordic
author_rank: Frequent Contributor
timestamp: July 17, 2019, 12:15:36 pm
content: Try this circuit. it looks like that it is completely built and tested with PCB

author: David Hess
author_rank: Super Contributor
timestamp: July 18, 2019, 01:36:19 am
content: 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.

author: pepelevamp
author_rank: Regular Contributor
timestamp: July 20, 2019, 02:40:07 am
content: 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.

author: planet12
author_rank: Regular Contributor
timestamp: July 20, 2019, 04:03:57 am
content: Quote from: David Hess on July 18, 2019, 01:36:19 amI 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).

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 20, 2019, 12:33:18 pm
content: 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 pmno 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 pmpossibly... 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 pmwhile 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:hKUAAOSw5k1cdyBymotor 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~~xalWy4before 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...

author: pepelevamp
author_rank: Regular Contributor
timestamp: July 23, 2019, 10:56:52 am
content: Quote from: planet12 on July 20, 2019, 04:03:57 amhahaaa dude thats actually pretty clever. with regards to the median - did you count each ADC value once and then look for the median value?

author: planet12
author_rank: Regular Contributor
timestamp: August 05, 2019, 05:48:06 am
content: Quote from: pepelevamp on July 23, 2019, 10:56:52 amI just looked at the code to remind myself.I disabled the motor PWM, then took 15 successive samples into a uint16_t array. Once completed, I qsort'ed them and used the middle of the array - adc_readings - and fed that into the PID, then re-enabled PWM using the new motor setting from the PID code.In retrospect, I could probably have hooked up the scope and figured out a reasonable settling time instead, but this seemed to work well. I suspect I only had my old 1960's analogue scope at the time, rather than my shiny DSO - t'was almost a decade ago now