DC Motor speed control help

Interested in Robotics? Here's the place to be.
Post Reply
suniljha
Posts: 28
Joined: Fri Jan 02, 2004 1:01 am
Location: India
Contact:

DC Motor speed control help

Post by suniljha » Fri Jan 02, 2004 7:40 pm

Hi!
First of all a very Happy New Year to all developers and researchers. I am interested in speed control of 12V DC motor using PWM. Anyone having experience in doing it. I am trying it but getting low torque at low duty cycle. What should be the frequency range for PWM signal? I want to control speed without much affecting Torque. <p>Need help!
regards
Sunil

Isenbergdoug
Posts: 31
Joined: Sat Dec 15, 2001 1:01 am
Location: N.C.
Contact:

Re: DC Motor speed control help

Post by Isenbergdoug » Sat Jan 03, 2004 8:07 pm

Do you want to use feedback control (closed loop system) or keep it as an open-loop system (no sensor feedback)?
Assuming a closed loop system, there are two ways to go about this problem, the hard way and the "hard" way. The hard way would be to derive transfer functions for the dynamics and the electronics of the motor, sensor, powersource, etc. This is tedious so the "hard" way is preferable.
The first thing to do is to create a variable duty cycle pulse source. Some function generators may be able to do this if you have access to them, I believe a 555 timer can be made to have a variable duty cycle up to less than 50% by using a variable resistor for control, or the neatist way would be to program a PIC or some other chip to provide variable duty cycle perhaps with referance to a binary input. Try to keep the frequency high, I believe around 30 kHz.
PWM works for this because a PW modulator at a high frequency looks like a amplifier whose output is proportional to frequency. The output is just the time-average of the signal, which can be worked out if your pulse is not a square wave, otherwise I believe that it is just the %duty cycle times supply voltage, i.e. a 5 Vpeak digital wave at a duty cycle of 50% would average to 2.5 V.
Having a circuit to provide the variable duty cycle, figure out a sensor scheme that will allow you to measure the velocity. The cheapest way would be to constuct an encoder disk and use an photoreflective sensor produce pulses that correspond to rotation. Define a set sampling time, and count the number of pulse in this time. You should them be able to relate RPM, rad/s, or however you choose to measure speed to the number of pulses counted in a sampling time.
With this you now have all you need to preform a simple experiment. Connect your variable duty cycle circuit to the component that is driving your motor (mosfet, high power amp, BJT, motor control IC, etc.). Keep track of your data while collecting the duty cycle and the resulting speed at that duty cycle. If your system is stable, which it should be, this will work out fine and speed should increase with duty cycle. With enough points you should be able to make a plot which relates duty cycle to speed.
I hope this answers you question.

User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: DC Motor speed control help

Post by MrAl » Sun Jan 04, 2004 1:29 am

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by Sunil Jha:
Hi!
First of all a very Happy New Year to all developers and researchers. I am interested in speed control of 12V DC motor using PWM. Anyone having experience in doing it. I am trying it but getting low torque at low duty cycle. What should be the frequency range for PWM signal? I want to control speed without much affecting Torque. <p>Need help!
regards
Sunil
<hr></blockquote><p>Hello there,<p>With low duty cycle you get low speed and low
torque; that's the way motors work.
Once you get the feedback in place, when the
motor is loaded the speed cuts back slightly
and is detected by your speed sensor. This
triggers an increase in the drives duty cycle
which raises the torque but may only slightly
raise the speed.<p>If you intend to regulate speed under varying
conditions of load you certainly need feedback.
As 'doug' was saying you can use an analog
system that is developed from knowing the
dynamics of the motor, or you can use a simple
form of tachometer, analog or digital.<p>No matter what form you choose, it's the feedback
that gives the motor it's muscle.
Try and stop it with your fingers when there
is feedback and you burn your hand :-)<p>How critical does the speed setting have to be?<p>Take care,
Al
LEDs vs Bulbs, LEDs are winning.

hlreed
Posts: 349
Joined: Wed Jan 09, 2002 1:01 am
Location: Richmond, TX
Contact:

Re: DC Motor speed control help

Post by hlreed » Mon Jan 05, 2004 1:04 pm

Feed the motor with an integer. Then sign controls direction of run and magnitude is speed to run. Say you have an 8 bit integer. The pulse width is time on and time off. Call them TON and TOFF. TOFF is always off, so it can be replaced with DIR.
Call the integer magnitude I.
If I is 127 TON is on 100% and DIR is +. If I is 0 TON is off. DIR is sign of I. (0,1) = (+,-).
If I is 64, TON is 50%. You may have to start at 50% since you may not be able to control all the time in the loop. You keep halving the integer until you have a table of I, TON and DIR.
TON and DIR are then sent to an H-BRidge to run the motor.
I DIR TON
-1 L 100%
0 0 0 ;Put 127 values between 100%.
1 R 100%
I can send you the PIC code for this if you like.
Harold L. Reed
Microbes got brains

Isenbergdoug
Posts: 31
Joined: Sat Dec 15, 2001 1:01 am
Location: N.C.
Contact:

Re: DC Motor speed control help

Post by Isenbergdoug » Mon Jan 05, 2004 8:46 pm

'Al' is correct, if your motor is going to be driving a load, then the feedback can (should) be fed into a controller which then varies the duty cycle in order to maintain a constant speed. However, if you are just concerned with driving a motor at a constant speed with no load or a very light load (such as a small mirror) then you probably won't need feeback to control the system and simply knowning the speed due that occurs with a given duty cycle (found experimentally or mathematically) will probably suffice.

suniljha
Posts: 28
Joined: Fri Jan 02, 2004 1:01 am
Location: India
Contact:

Re: DC Motor speed control help

Post by suniljha » Tue Jan 06, 2004 8:10 pm

Thanks a lot for great help!
Can you please further let me know PWM frequency range suitable for DC motor control. I know this varies from Motor to motor but need some range I should try.<p>Bye!
Sunil

hlreed
Posts: 349
Joined: Wed Jan 09, 2002 1:01 am
Location: Richmond, TX
Contact:

Re: DC Motor speed control help

Post by hlreed » Wed Jan 07, 2004 10:12 am

Don't worry about frequency. Think of motor on time percentage. At full speed, motor time on is 100%. At half speed, motor on time is 50% on and so on. At 0 speed motor time on is 0%. Any DC motor is mathematically the same here.<p>The actual time depends on the size of the number you are using for reference. An integer is the result of comparing two values, so it is already your feedback number.<p>You will still need an H-Bridge to run the motor. Its inputs are time on and direction, both of which are provided by the integer. Let II be the integer, O be on time and D be direction. Here is the model.<p>II O D ;for 8 bit integer
-1 1 - ;-128 100% counterclockwise
00 0 0 ;0 off
01 1 + ;127 100% clockwise
Harold L. Reed
Microbes got brains

L. Daniel Rosa
Posts: 400
Joined: Tue Dec 25, 2001 1:01 am
Location: Bellingham, WA
Contact:

Re: DC Motor speed control help

Post by L. Daniel Rosa » Wed Jan 07, 2004 7:18 pm

There are some appliances that have universal motors (read DC motors that can run on AC too), a few of which have speed control that consists of not much more than a lamp dimmer. For practical purposes this resembles PWM on an AC carrier.<p>That much said, devices with universal motors often specify a frequency range that they function well over. One example is my circular saw which recommends 47-90Hz. Too low a frequency and the tool gets jerky- too high and the inductance gets too reactive.<p>So much confusion in the air, I think I'd suggest a few hundred Hz. My Makita sounds like it's in the 100 to 200 range, and Chicago Powertools sounds like about 1kHz. This allows for quite a bit of resolution without using a lot of clock cycles on the PWM subroutine.

hlreed
Posts: 349
Joined: Wed Jan 09, 2002 1:01 am
Location: Richmond, TX
Contact:

Re: DC Motor speed control help

Post by hlreed » Thu Jan 08, 2004 9:40 am

The frequency is derived from the duty cycle. It is from the cycling of the program that feeds the H-Bridge. The on-off time produces the frequency. It will select itself from the cycle of on- off times.
100% is DC.
You cannot do that since there is off time in your program, so 100% may be actually 75% which is not DC. However, 50% is doable with equal on-off times. This creates a frequency which depends on the speed of the microprocessor and the program.
If you specify and try to make a frequency, you are just asking for trouble. Let it fall out of the code.
Harold L. Reed
Microbes got brains

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest