4 x 16 bit servo control on Atmega328p
Controlling four motors with Atmega328 Timer1 One of the challenges in a quadcopter project is to correctly control the four thrust motors, via ESCs. The control is effected by a pulse between 1-2 ms. In ESC controllers, the refresh rate can be as low as 8 Hz or 20 Hz. In quadcopters this refresh rate is far too slow - I have seen 100-200 Hz suggested as a suitable update frequency. The "SimonK" hex is often reflashed to ESC controllers, as it has a refresh rate of approximately 488 Hz, very close to the theoretical refresh limit of just below 500 Hz. Algorithm idea Using the Atmega328 chip, we have only one 16-bit timer available, Timer 1. Of course there are two other timers, but they are 8 bit timers, and I really want to stick to the resolution of the 16-bit timers. We could consider using an AVR with four 16-bit hardware timers and use the four timer output pins, but it is interesting to see what can be done with just one. So we ...