Noise on analog input when using an ethernet shield & external power

Hi folks,

I wonder if anyone has seen this before and has ideas on how to fix or troubleshoot?

I have a set up with an ethernet shield (this one: and a TMP36 temperature sensor. I'm trying to report the temperature remotely over ethernet. I'm using the A5 analog input having read elsewhere that the A0 and A1 inputs have pullup resistors attached in the ethernet shield.

When powered from USB on my laptop, everything works as expected - I see pretty stable temperature values from second to second.

However, when powered from an external 9V adaptor [this one:], the analog input becomes extremely noisy when read with analogRead on the arduino.

I've tried a few debugging steps, here's what I found:

I have metered the Vcc and signal levels with a multimeter in both scenarios and they are both very stable, including under load when I make an HTTP request to the device. I also tried printing out a value read 500ms in the past in case the act of serving an HTTP request introduced the noise, but this shows just as much noise in the externally powered setup.

Has anyone seen this before or able to suggest the next step in debugging?

A multimeter won't show you the noise from the power supply. Its a switch-mode supply so its bound to be noisy. I'd try adding a 5V regulator with lots of decoupling (0.1uF ceramic, 10.0uF ceramic and 2200uF electrolytic say) on its output and put that between the PSU and Arduino and see if that improves matters.

A quick test would be to just add more decoupling from Vcc to Gnd, and also from Vin to Gnd - an external regulator might be overkill.

Are you sure its not just the ethernet shield that's the problem though? You aren't clear whether its also present in the USB-powered setup.

Thanks for the advice, Mark. The ethernet shield is present in the USB setup so hopefully we can reject that as the source of the problem.

I'll add some decoupling between Vcc and GND and the signal and GND right now to see what difference it makes. I should have mentioned that the Arduino board I'm using is an UNO. I guess you're saying that the on-board regulator still leaves a very noisy 5V with a switch-mode supply!

I added a 220uF electrolyic [all I had to hand] from Vcc to GND near the TMP35 and that has significantly improved matters, so looks like this is exactly the right answer - thanks! Will add more when I manage to strip some caps off another project.

(you can see the values its reporting at if you’re interested :slight_smile: )

Another simple tweak that might help is to add a ferrite toroid on the +ve wire from the psu - you might find one of these on an old USB cable. You can wrap the wire through it several turns to increase its low-pass-filtering effect.

Thanks for the tip! The power supply DC cable had a ferrite core on it already (near the plug), but I've added another. Hard to say if it's made a significant difference, I'll produce some graphs once I have a bit more data.

No, not on the whole cable, just on the positive supply wire. That common-mode suppressor won't stop differential noise. An RF choke would also do if you have one lying about (less likely?).

I my project, when I try to read 64 measurements analog inputs on an(0),
some data were lost. Dont know why.
But what I’m saying , direct access to ADC solve a problem.:
ADCSRA = 0x87;
// turn on adc, freq = 1/128 , 125 kHz.
ADMUX = 0x60;
//Bit 5 – ADLAR: ADC Left Adjust Result
ADCSRA |= (1<<ADSC);
// while((ADCSRA&(1<<ADIF)) == 0); //Discard first conversion result.
while(!(ADCSRA & 0x10));

for(i=0; i<N; i++ ) {
ADCSRA |= (1<<ADSC);
// while((ADCSRA&(1<<ADIF)) == 0);
while(!(ADCSRA & 0x10));

x = ADCL;
_ x += (ADCH << 8); _
} _
There is book , that would be helpful in you project:
“C Programming for microcontrollers”, by Joe Pardue.