1
votes

I am working with an Arduino Mega 2560. The problem I have currently is that the servo motor I'm using makes a slight noise in idle state. It's because it's not a pure signal. How do I generate PWM with interrupts for the microcontroller?

Does using interrupts place the counter at the exact same spot every time? If not, how do I deal with a high-resolution servo?

1
Can you post some code? What do you mean by "not pure signal"? Generally on systems like these the PWM is generated by the MCU which is what Arduino's analogWrite() does: it is a much cleaner way to do it than bit-banging to get PWM signal, which is what I think you are referring to.angelatlarge
You should use the servo library if you aren't already arduino.cc/en/Reference/ServoChris Desjardins
I presume this is a standard RC grade servo? If so it should be noted that even if your pulse is perfect some servos will still make the slight jittery noise when centered idle. Sometimes the solution is to simply apply a small amount of constant pressure like a spring or a rubber band. Sometimes the solution is to increase or properly supply voltage to the servo. Sometimes you just ignore it as it's often considered "normal" for certain brands. I'm talking as someone who's built a lot of RC planes.slebetman

1 Answers

0
votes

Binary Code Modulation can be used if you really need a lot of SoftPWM channels without a big CPU overhead. Nice and simple technique.

However, some specialized servo library might be a better solution...