So I am struggling with a problem, i am sure someone would have faced. I have a RAMPS shield with a arduino Mega working as the brain of my printer

Temperature readings from the heater thermocouple are noisy. The tuning process is on from last couple of hours.

1) When the atmega2560 is powered from the USB of the phone charger, the Vcc is 5.01 V. The temperature is very very stable and shows the same as my room temperature read from a mercury thermometer, which is 29C.

2) When the usb is disconnected, and 12 v supply from ramps is brought in, the voltage is stable at 4.98v. Temperature readings from Marlin vary from 29C to 34C and changes every second. When powered from the 12v from a 20a power brick, why should the temperature vary so much?

There is actually no temperature table for a thermocouple. The temperature is linearly related to the output of the ad595 TC chip. Is the noise of the switching supply somehow coupled to the 5v, so that the adc reference is noisy? Will adding a capacitor to the 12v output on the 5A rail clean this up?

• Hmm... the ADC on the ATMega2560 has a rated accuracy of 3LSB with a 4V reference, which translates to ~4C. The Arduino by default uses a 5V reference, which I'm assuming has roughly the same error. Depending on which AD595 chip there is, there could be up to another 3C accuracy error, for a maximum of 7C. However, I didn't find any information on the noise characteristics of either device. Assuming you're sticking to sub 100C temperatures, have you tried switching the MCU's reference to the internal 1.1V? Commented Dec 4, 2014 at 17:23
• Why not try adding a capacitor on from +5V to GND and see what happens? Order magnitude 100nF, 1µF, 10µF. Adding a capacitor in parallel to the 12V is of little use if the output current is indeed somewhere near 5A, the required capacitor would be large and expensive, whereas the little once cost couple cents. Commented Dec 4, 2014 at 18:19
• Have you tried bridging the inputs with a short? This should turn the chip into a thermometer. Also, the power supply rejection is 10mV per volt on the power line - this is quite a lot when you consider the power rail might be moving up and down just a few millivolts. Commented Dec 4, 2014 at 19:34
• I tried switching the reference to internal 2.56v, I find the same unstable temperature, everything else being same. I will try the capacitors on the 5v line. Shorting the inputs does change it to a thermomemeter. Commented Dec 7, 2014 at 7:17