So I'm referring two whining noise, not electrical noise. When you change the speed of a DC motor to less then the max speed they seem to make a high pitch whining noise. But for my project I ramp in and out of speed changes with my motor. I have a few $$$ motors from micomo, and even those make high pitch wining noise....
Does anyone have any suggestions, or out of the box ideas for change the speed of motors without the whining noise when you run them at lower rpms?
The whining noise may be related to the PWM frequency. Some setups will let you use ultrasonic PWM frequencies. You should tell us how you are controlling your motor.
Upping the PWM to 16kHz is the solution. But that needs a motor driver than
isn't lossy at that sort of frequency and you have neglected to tell us anything about
the driver(s) you're using.
MarkT:
Upping the PWM to 16kHz is the solution. But that needs a motor driver than
isn't lossy at that sort of frequency and you have neglected to tell us anything about
the driver(s) you're using.
Just an FYI: The MicroMo motors. When just sending them different voltages, changing the speed from a desktop power supply. They are as quite as a church mouse who just had his nails clipped, running a cross carpet... I'm from the south.....
So would changing the PWM to 16kHz fix the whine? If so, how would I do something like that? I'm open to using other drivers. But it's nice that this is a nice and neat little package.
Here are some notes out of the library that I'm using to drive the motor. The library comes from Pololu for that board. After reading them, does this mean I can change the PWM for the arduino and have it talk to the driver at that speed forcing the driver to run at 16kHz? The board I'm using is the "Baby Orangutan B"
// initialize timers 0 and 2 to generate the proper PWM ouputs
// to the motor drivers
void OrangutanMotors::init2()
{
#ifdef _ORANGUTAN_SVP
// Configure for non-inverted fast PWM output on motor PWM pins:
// Normal port operation, OC2x disconnected (changes later when a non-zero speed is set)
// Timer2 counts up from 0 to 255 and then overflows directly to 0.
TCCR2A = 0x03;
// use the system clock/8 (=2.5 MHz) as the timer clock,
// which will produce a PWM frequency of 10 kHz
TCCR2B = 0x02;
// use the system clock (=20 MHz) as the timer clock,
// which will produce a PWM frequency of 78 kHz. The Baby Orangutan B,
// Orangutan SVP, and 3Pi can support PWM frequencies this high. The
// Orangutan LV-168 cannot support frequencies above 10 kHz.
//TCCR2B = 0x01;
Read the comments in the code you posted! They tell you that the PWM frequency is 10 kHz, and show how to set it to 78 kHz (TCCR2B).
If you want to understand the settings, consult the ATmega328 data sheet for Timer 2.
So I uncommented TCCR2B = 0x01; and commented TCCR2B = 0x02; in the library provided by pololu.
I still get the whine.. Should I be trying to change the PWM Freq in the motor library of in the setup of the project? Am I going about this all wrong?
There is an option in the library for Arduino. For anyone else looking for this later
File Name: OrangutanMotors.cpp
#ifndef ARDUINO
// use the system clock/8 (=2.5 MHz) as the timer clock,
// which will produce a PWM frequency of 10 kHz
// Arduino uses Timer0 for timing functions like micros() and delay() so we can't change it
//TCCR0B = TCCR2B = 0x02; //<-- Comment Out
#endif
// use the system clock (=20 MHz) as the timer clock,
// which will produce a PWM frequency of 78 kHz. The Baby Orangutan B
// and 3Pi can support PWM frequencies this high. The
// Orangutan LV-168 cannot support frequencies above 10 kHz.
TCCR0B = TCCR2B = 0x01; //<-- Uncomment
Hi All.
Interesting reading I too have the same problem with whining motors when uing PWM!. Even in my what seems like old Picaxe days, where if I set the PWM freq too high nothing worked. I now have a couple of Uno's and leave the PWM freq at the default of about 490Hz, which seems very low to me, so how can I change it?? I am new to the Arduino scene and C.
I have whining robots what can I do?
Other info:
I now know that the Tamiya motors in the twin gearbox soon draw lots of current when stalled and the Pololu DRV8833 module soon complans and activates the FAULT output. Micrometal motors still whin but don't use anywhere near the current limit, but perhaps depends which you using for what!!. This whinning is a shame as I assume! the motors could be running at lower speeds, mine don't move until the analogue out hits about 90?
Any help or advice. would be very welcome.
Regards
It's intuitively simple! As stated above, if the "whine" is objectionable the only way to mitigate that is to increase the PWM frequency above audible range. At 10KHz you will hear it. At 18KHz, probably not. We used to PWM the phase current in our steppers at 25Khz, but designing an H-Bridge with FET's and switch at 25Khz is anything but trivial. Most cheap (e-bay) controllers don't switch that fast to stay simple. --Rob
Hi rmetzner49,
Thanks I think! if it's so simple then do tell me how! I'm sure there's some timer commands somewhere, perhaps in a library or perhaps you just use a bit of C coding, but if you don't know how or where, we're lost.
Please enlighten us? give us something to experiment with.