Hello All,
Before anyone posts to check, I have checked the forum several times and while there are answers to similar-ish problems I figured it best to just ask as my solutions (derived from those posts) are not working.
The project:
I am taking two 100 Hz signals (one sin and one cosine) in via analog read. I am using atan2 to compute the angle of signals. The atan2 function is giving the expected signals, but my signal is not being sampled well. The atan2 is being sent through a DAC for the final output.
I have large quantized steps (aliasing) from the DAC output. I have been trying to get a better sample of the signal using many methods, I changed my baud rate from 9600 to 115200, added a delay (1us) and changed the prescaler for the ADC. I still need to maintain the 10 bit accuracy. I need to output position with a .1 degree accuracy.
The only one that seemed to have an effect on the sampling was the prescaler (16). From my understanding the Arduino should be able to sample 100Hz withoutorescaling anything.
Is there something I am missing? I know analogread is slow and I am calling it twice in a loop, but man, 100Hz is a slow sample to be aliasing.
Any thoughts or help is appreciated.