PWM management

Hello!
I am new on the forum...

A few years ago (2014) I made an arduino project, which basically consisted in coding from scratch a hobbyking KK3 board to be used as an R/C aircraft 3 axis gyro with control parameters being able to change in function of airspeed which was read by a pitot tube.

Thing is, back in its time, the final code showed a slight issue with servo jittering and offset precission (Lack of, even with gyros disabled) so I never tested it on an airplane, but other than that, it worked fine.

I had thought for quite a long time that these issues had to do with the arduino servo library being not-efficiently coded...

Then I just read somewhere (As I am heading into a new similar project) that the micros() function has a precission of just 4us... that could have been the source of the precission issue.

Mind that I read the PWM signals with PinChangeInt library ISRs and use the servo library to output the PWM to the servos. I have attached the code related to that project, maybe some friendly soul will check whether I am on the right track with the precission issue or maybe there's something entirely different going wrong with my code...

Thanks in advance!

Jandro.

FBW_FINAL.ino (12.6 KB)

I'd try to exclude these:

  • Influence of the servo power supply - too weak?
  • Servo torque sufficient?
  • Servo orientation? Working against gravity can cause hysteresis and other nasty effects.
  • Noise in input signal - filter?

We could easily neglect those, as the servos had proper power feed, they were unloaded during test (nothing attached to the arms), I even tested them with no signal processing, just sending a constant to the output if I recall correctly... and it would jitter nonetheless :confused:

Any other ideas?

Did you ever get this resolved? I'm also working on a project and am trying to solve the servo jitter.

Yeah, well... kind of!

I ended up replacing the interrupt library (Pinchangeinterrupt) by the newest version and then kept using the arduino servo library and now it seems to work well.