Help with PWM frequencies and motor driver responses

Thread Starter

chi.sp

Joined May 19, 2015
11
Hello all! Sorry, my electronics skills are very limited so I need a help or directions to research.
I'm building a basic locomotive controller (for railway modelling) using an Arduino Uno card to control a L298N H bridge through PWM outputs. It works fine except for an annoying buzz sound on the dc motor due to the default Arduino's PWM frequency of 498Hz. So I changed the frequency to a value beyond the audible spectrum and set it to 20KHz. The annoying buzz sound was eliminated but the response of the dc motor is quite different. With the default frequency of 498Hz the locomotive starts to moving when I input a value of ~ 16, in a range of 0 to 255 to define the duty cycle variable. But at 20KHz, the locomotive only starts to moving with a value of ~ 128 and with 32KHz the value raises to ~200.
I would like to know if there is a way to have the same smooth response of the motor at those higher frequencies as when using 498Hz. Increasing frequencies, the controller range becomes narrower causing a more "nervous" reaction of the motor. Do I need another type of transistor that support high frequency switching? I am using a L298N H Bridge and have also used TIP120 with same results.
Thanks in advance for any direction.

chi.sp
(Brazil)
 

blocco a spirale

Joined Jun 18, 2008
1,546
The problem is that the motor has considerable inductance which means that as the PWM frequency increases so does the impedance and, therefore, current and power fall. I don't think it is possible to move the switching frequency out of the audible range and still drive the motor efficiently.
 

crutschow

Joined Mar 14, 2008
34,201
The problem at the higher frequencies may be due to the circuit delays of the L298. The TIP120 could experience similar delays, depending upon how you drive it.

Either go to a lower frequency or get a faster bridge circuit.
Lower the frequency to just above the point where it is audible.

Edit: The motor inductance should not be a factor since that just filters the ripple from the PWM waveform to give an average DC current through the motor.
It acts the same as the inductor in a SMPS.
 

blocco a spirale

Joined Jun 18, 2008
1,546
I'm not sure that the motor inductance can be ignored; one of the advantages of PWM motor speed control is that it makes it possible to maintain high torque at low speeds and for this to be the case the frequency must be low enough for peak current to be achieved, so, the requirement is rather different to that of a SMPS. All battery operated power tools I have ever owned or used have very audible PWM motor speed control and I assume for this reason.
 
Last edited:

Thread Starter

chi.sp

Joined May 19, 2015
11
I'm not sure that the motor inductance can be ignored; one of the advantages of PWM motor speed control is that it is possible to maintain high torque at low speeds and for this to be the case the frequency must be low enough for peak current to be achieved, so, the requirement is rather different to that of a SMPS. All battery operated power tools I have ever owned or used have very audible PWM motor speed control and I assume for this reason.
Thanks blocco a spirale for your input!
I'm a hobbist only and, unfortunatelly , my electronic knowledge is very very basic so when terms like "inductance", "SMPS", ..., comes to the scene, I'm just a passenger watching for the best direction. What you said about high torque at low speeds I could see that it is true. With low frequencies on PWM, the locomotive can start moving with very low values for the duty cycle variable. We can hear the "hammer" beating sound of PWM acting to pull the locomotive. I could input so low values that pull the locomotive on an almost imperceptible movement such as moving across 8 milimeters in 30 seconds.
I don't know yet if it is on lower or higher band beyond of the audible spectrum, but I've heard of commercial decoders for locomotives (DCC system with PWM) with "silent driver" feature on its marketing. I'll try to get some info about them.
 

Sensacell

Joined Jun 19, 2012
3,420
If your switching elements are fast enough, the higher PWM frequency should work great.
The motor inductance just averages current, A higher PWM frequency should be smooth and quiet.

If you see non-linearity in your PWM response, it's usually because the switches are too slow.
This is most evident at low duty cycle, as you point out.
 

Thread Starter

chi.sp

Joined May 19, 2015
11
The problem at the higher frequencies may be due to the circuit delays of the L298. The TIP120 could experience similar delays, depending upon how you drive it.

Either go to a lower frequency or get a faster bridge circuit.
Lower the frequency to just above the point where it is audible.

Edit: The motor inductance should not be a factor since that just filters the ripple from the PWM waveform to give an average DC current through the motor.
It acts the same as the inductor in a SMPS.
Thanks crutschow for your input!
Yes, I have tried a lower frequency. I've set a 20Hz for PWM frequency and the buzz sound is also inaudible, as in 20KHz. The motor response is efficient and smooth but the led lightnings of the loco becomes flickering at this very low frequencies. Currently, I'm using 40Hz for PWM. The leds has no flickering and the buzz sound is much more bearable than at the default 498Hz.
I have to go with your second advice and get a faster bridge circuit so that's I'm looking for.
If you have some info, it would be very appreciated ;-)
 

Thread Starter

chi.sp

Joined May 19, 2015
11
If your switching elements are fast enough, the higher PWM frequency should work great.
The motor inductance just averages current, A higher PWM frequency should be smooth and quiet.

If you see non-linearity in your PWM response, it's usually because the switches are too slow.
This is most evident at low duty cycle, as you point out.
Yes, I suspect that the components of my H bridge (transistors and anything else) can't handle high frequency switchings so this is the matter I need to research. Thanks for your input!
 

blocco a spirale

Joined Jun 18, 2008
1,546
I would imagine that the "silent drive" controllers use a softer pulse shape which would reduce the more noticeable high frequency content of the sound and provide a smoother drive at the expense of increased dissipation in the output transistors.
 
Last edited:

ebeowulf17

Joined Aug 12, 2014
3,307
Can you share your locomotive motor specs (voltage, amperage, wattage, etc.) and your wiring setup when using the TIP120?

I've been playing with PWM control of a solenoid lately with a TIP120 at 1000Hz with great results so far. Curious to see if the difference in our results is how we're driving the TIP120 or the differences between my solenoid and your motor, or both.

I'm still kind of a beginner with all this, so no promises on being able to help - I'm asking for the sake of my own learning just as much as anything.
 

MaxHeadRoom

Joined Jul 18, 2013
28,576
It should be noted that most commercial PWM servo drives and VFD's run at or above 20kHz PWM frequency.
Picmicro recommend 4Khz minimum.
The current wave form is a mean level with slight sawtooth, very different from the voltage waveform.
Max.
 

Thread Starter

chi.sp

Joined May 19, 2015
11
Thank you very much for sharing this link. It's very useful for understanding the operation of a dc motor under dc regulated source and PWM source.
From what I could understand, the limiting factor is the time-constant, the time the voltage reaches its full value after crossing the circuits of the device and, in PWM, this is repeated on every pulse of PWM. So the kind of device and its particularities directly affects this time-constant and there is a limit frequency that if overpassed causes the loss of energy efficiency, therefore, the loss of linearity response, is it right? It seems there is no escape from this phenomenon so we have to give enough time for the loads reach their full value on each PWM pulse and beyond certain frequencies this is no possible.
About the "silent driver" decoder I mentioned on earlier reply, it is mounted inside every locomotive (DCC system) so I think the decoder supllies a 20Hz, or lower, PWM frequency for the motor and a higher frequency to feed the leds, so that the motor doesn't create a buzz hum sound and the leds doesn't flicker.
As I am currently playing on DC system (the voltage control is on the tracks), when using 20Hz (or lower) frequency the locomotive runs silently, but its leds become flickering, so this is why I was trying to drive the motor on the higher band beyond the audible spectrum (20KHz+).
 

Thread Starter

chi.sp

Joined May 19, 2015
11
Can you share your locomotive motor specs (voltage, amperage, wattage, etc.) and your wiring setup when using the TIP120?

I've been playing with PWM control of a solenoid lately with a TIP120 at 1000Hz with great results so far. Curious to see if the difference in our results is how we're driving the TIP120 or the differences between my solenoid and your motor, or both.

I'm still kind of a beginner with all this, so no promises on being able to help - I'm asking for the sake of my own learning just as much as anything.
Hi, I'm playing with N scale railway models, specifically Kato locomotives. Unfortunatelly, Kato doesn't provide their motor specifications in details on their site. They only say it is a five-pole motor. The voltage limit is 12V and I'm no sure about amperage or wattage. DCC decoders available for these locos have 1A~1.5A on their specs.
The way I've wired the TIP 120 is very simple, connecting a PWM pin of Arduino on Base leg of transistor with a protection of a diode between the Collector and Emitter legs.
I have researched on pages like these:
http://devacron.com/arduino-tip120-control-dc-motor/
http://www.instructables.com/id/Use-Arduino-with-TIP120-transistor-to-control-moto/
http://bildr.org/2011/03/high-power-control-with-arduino-and-tip120/
and http://arduino.cc pages (including inside forum pages)

Now I'm using a L298N H Bridge because of simple setup and easy switching polarity outputs (to reverse loco direction) through simple commands to Arduino pins.
http://tronixlabs.com/news/tutorial-l298n-dual-motor-controller-module-2a-and-arduino/
http://www.instructables.com/id/Arduino-Modules-L298N-Dual-H-Bridge-Motor-Controll/

But the linearity response to high PWM frequencies is similar to TIP 120 transistor.
I think I'm gonna give a try with a mosfet transistor just to see the results compaired to L298N and Tip120..
 

ebeowulf17

Joined Aug 12, 2014
3,307
I'd be curious to see if cutting that in half to increase the base current would make any difference, but it's mostly speculation and wishful thinking on my part. Can't find a whole lot of info on TIP120 switching speeds, but what little I found looked reasonable, and was based on Ic/Ib of 250. Hard to know without better motor specs, but I think you might be running higher than that now, which is what made me wonder.

Looking forward to hearing how MOSFETs work out. Good luck!
 

Thread Starter

chi.sp

Joined May 19, 2015
11
That resistor is for an extra protection of Arduino from sparks coming from DC motor. The main protection is provide by diode.
I'll be researching now for a model of a mosfet and make just a experiment. If the results were somewhat significant, I'll post them here. Thank you!
 

Alec_t

Joined Sep 17, 2013
14,263
Do you have space to include a high-uF electrolytic capacitor across the LEDs to reduce flicker when pulsed at 20Hz?
 

ebeowulf17

Joined Aug 12, 2014
3,307
That resistor is for an extra protection of Arduino from sparks coming from DC motor. The main protection is provide by diode.
I'll be researching now for a model of a mosfet and make just a experiment. If the results were somewhat significant, I'll post them here. Thank you!
No, that resistor controls the current that runs from your Arduino out through the base and then the emitter of your transistor when the Arduino pin is high. There are limits to how much current each of these can handle, although in this case the Arduino would be the limiting factor (IIRC it's good for max of 30mA per pin.) You're limiting it at around 5mA right now, and could easily raise that to 10 safely (it might or might not help your high frequency performance - that's a different question entirely, but it wouldn't be a risk to any of your components!)
 
Top