Hardware Based PWM


Been using the Servo library and having some issues. I noticed the servo library uses sodtware based PWM, setting interrupts etc. This means my "Real time" is not so real time anymore, due to all the interrupts.

The arduino has PWM pins, are these run at the hardware level and do not require any software intervention short of telling it the duty cycle? I want to use them to drive servos and not bother my software with interrupts. Anyone tried it?

The issue I am having is I am suing serial, I2C as well as Pulse In and I think it is too much with 5 servos attached.

I am considering using another arduino just as a servo driver but it would still have to use I2C or serial anyways to get the values to set, so I am confused as the I2C routine will disable interrupts and I will still get some servo jitter.


The problem with using hardware PWM for driving servos is typically limited resolution.
With a 5 - 10% duty cycle, you're limited in the range of values, unless you up the bit-count available from the usual eight bits.

And you are limited to pins 9 and 10 only, since they are the only ones controlled
by 16 bit timer on the Uno.

I am suing serial, I2C as well as Pulse In

It's the damned lawyers causing problems.