Quantcast
Channel: Question and Answer » pwm
Viewing all articles
Browse latest Browse all 108

Arduino Mega ADC error when using PWM

$
0
0

I am building a temperature controller, where I read 16 ADC inputs (thermocouple amplifiers), and at the same time I am using 6 PWM outputs (at 10 Hz).

When I am only reading the ADC values, I have no issues, but when I turn on my control (PWM switching at 50% at 10 Hz), the ADC reads jump up about a degree on average across all 16 ADC inputs. I see a larger jump when my PWM outputs are connected to SSR switches, and the jump is large with a higher duty cycle.

My ADC is set to internal reference of 2.56V, and I am sampling each ADC 3 times in free running mode, throwing the first read away for accuracy. I see the same problem when just using the built in analogRead() function. I am also running a digital filter (in software) to get rid of most of the noise. My loop for reading ADCs is running at 100 Hz, meaning I read all 16 thermocouples, and filter them every 10 ms.

Does anyone know why turning on the PWM (pins 11,12,13,5,2,3) would cause the ADC to shift slightly? Any ideas on how to fix this? I would like to avoid using an external reference voltage as I am going for a psuedo-embedded and cheap solution, so I don’t want to add a large clunky power supply.


Viewing all articles
Browse latest Browse all 108

Trending Articles