3
\$\begingroup\$

I have a motor driver interfaced to an arduino using AnalogWrite() for PWM, for some strange reason it only spins the motor from values 210 to 255(full on) with analogwrite, anything lower will make the motor hum very aduible PWM and not spin...any ideas on how to correct this? Do I need Fast PWM?a

\$\endgroup\$
  • \$\begingroup\$ How loaded is the motor? It sounds like it's stalling. Is it just a conventional brushed DC motor? \$\endgroup\$ – pjc50 Mar 5 '12 at 10:15
  • \$\begingroup\$ Assuming it is a DC motor and not a BLDCM or stepper motor: Run at PWM = 255 & measure voltage on motor with a meter. You MAY need to smooth feed to meter but probably not. eg connect 100 uF across meter probes and feed through 1K resistor on one lead. | Now run motor from a variable bench power supply. Turn supply on and off at various voltages and see what lowest start voltage is. If Vstart_minimum is around V255 x 210/255 ~~= 0.8 x V255 then the motor is behaving as expected. eg if V255 = 5V and if motor starts from about 4V and above then operation is as expected. \$\endgroup\$ – Russell McMahon Mar 5 '12 at 14:14
  • \$\begingroup\$ This is a high level arduino user question, not about electrical engineering. \$\endgroup\$ – Olin Lathrop Jun 2 '13 at 22:53
  • 1
    \$\begingroup\$ @Anindo: But it's not about that. It's about "AnalogWrite()" and how to use it for PWM. If this question were just about PWM and motor driving it would be fine, but it's about how to do something within the arduino bubble, which is deliberately separated from real electronics. This is not a arduino site. \$\endgroup\$ – Olin Lathrop Jun 3 '13 at 13:39
  • 2
    \$\begingroup\$ @OlinLathrop Two facts: First, it's a question pretty much like someone might want to know how to do PWM on a PIC - just a different platform, even if it's one you don't approve of. Second, I believe the site owners have an opinion at variance on whether this site should also support Arduino - that's why the Arduino proposal on A51 was shut down. I ignore semiconductor fabrication questions, you can ignore the Arduino ones. \$\endgroup\$ – Anindo Ghosh Jun 3 '13 at 13:56
5
\$\begingroup\$

According to the reference for AnalogWrite(), this will generate PWM at a frequency of about 490 Hz. This pretty inefficient. It means that you deliver a parcel of energy every \$1/490Hz \approx 2ms\$. Normally the inductance of the motor smooths out these parcels such that you get a mostly constant current, but at this low speed, the inductance of your motor probably isn't sufficient to do that.

It's as if you are turning a shaft with pulses of torque and hoping it will turn at a constant speed, but you have a tiny flywheel on it. Torque is proportional to current, and an inductor is like a flywheel for current in that it resists abrupt changes in current. Bigger inductors resist more, like a heavier flywheel resists changes in speed more.

If you are supplying the motor with 5V, and the motor inductance is 1.5mH, then the current will change at a rate of:

$$ \frac{di}{dt} = \frac{v}{L} = \frac{5V}{1.5mH} \approx 300 A/s $$

Over the course of the \$2ms\$ between pulses, that equates to a change on the order of:

$$ 300A/s \cdot 2ms \approx 600mA $$

These are just very rough estimates, because the analysis of what the current will actually do over the PWM period is more complicated, but the point is this: the current in the motor windings is changing a lot with the PWM waveform.

The torque the motor produces is proportional to the winding current. So what happens is probably this: the PWM switches high, and the current gets pretty big. This would turn the motor, except that before long, the PWM switches low, and the current goes back down to about nothing. So you aren't applying a constant torque; you are just applying spurts of torque. These short spurts of torque aren't enough to get the motor going unless you turn the duty cycle way up, so you motor just hums at about 490 Hz.

I bet if you attach some mass to the motor (like a flywheel), and give it a little shove, it will get going. In this case, you are augmenting your lack of "electrical flywheel" (inductance) with a real mechanical flywheel. A higher PWM frequency would be more efficient, but isn't necessary to have a working system.

\$\endgroup\$
0
\$\begingroup\$

You will probably need to have a motor level shifter IC something like a SN754410. These are good because they are stackable and also protected.

Also be careful of the frequency the PWM runs at.

Just some thoughts, as I have run some motors using PWM and if the frequency is too high there is little speed control and or squealing and if too low no low speed and or humming.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.