GoForSmoke:
Exactly. He's getting way too much variation to conclude that millis() are the cause.
Exactly X2
I did a quick look at your code and offer these suggestions:
- Delay() is bad, and it appears your code is planted there. Try using a non-blocking delay.
- You are running lots of ISRs (Serial, SPI, ADC, to identify a few) which could be blocking. Try eliminating/minimizing some and see if your timer accuracy improves.