lm34 on a breadboard, strange stuff

i know alot of posts exist about taking 2 samples, ignoring the first and using the second, and which ground to use etc. im experimenting with just an atmega328p on a breadboard, powered by usb, and an lm34. its still reading 4-5 degrees higher than hooked up to an uno (the uno is reading correctly). lm34 is powered from avcc and gnd pin 22. i have .01uf across pins 20 and 22. i cant for the life of me figure this out. the breadboard has crystal and caps and pullup on rst, nothing else. the usb is an ftdi clone, but even with other power sources (another uno, batteries etc) using an lcd, its still reading consistently wrong. also, when i leave the lm34 on the breadboard and wire it to the uno, im getting correct values, and ive tried 2 different atmega328p's on the breadboard. if i wasnt already bald id be pulling alot of hair out. this is the only thing holding me up on completion of my weatherstation, i could use other sensors reading correctly, but im just so curious as to whats causing this.

edit. i got my dmm on the supply to the sensor (on the breadboard) its 4.94, after adjusting the sketch to relfect this, its right on the numbers. how/why am i losing this lil bit of voltage? any way around this other than what i did? i mean if it works its all good, but im not understanding why im not at 5 volts on the breadboard.

5 degrees is 50 mV, that is not a lot.

I don't understand how you have connected it.
It should be like this:
Both GND to ground (pin 8 and pin 22).
Vcc and Avcc to 5V (pin 7 and pin 20).
100nF to GND and 5V.
Vcc to power the LM34, ground to GND, output to an analog input.

Can you measure the 5V voltage on the ATmega328p with a multimeter ? If it is lower due to bad connections on the breakboard, you would read a higher value.

You could avoid all this with a digital temperature sensor.

but im not understanding why im not at 5 volts on the breadboard.

I've never ever met 5.0V somewhere on a board. The USB stuff is 4.6-4.9V, standard voltage reglers are 5V +/- 0.2V, every USB port gives different voltage. LM34 operates from 5V min, so a small drop may affect your reading.

lm34 is powered from avcc and gnd pin 22

Avcc is an input, shall be connected to Vcc (sometimes through a filter).

I don't understand how you have connected it.
It should be like this:
Both GND to ground (pin 8 and pin 22).
Vcc and Avcc to 5V (pin 7 and pin 20).
100nF to GND and 5V.
Vcc to power the LM34, ground to GND, output to an analog input.

thats how i got it connected.

I've never ever met 5.0V somewhere on a board. The USB stuff is 4.6-4.9V, standard voltage reglers are 5V +/- 0.2V, every USB port gives different voltage. LM34 operates from 5V min, so a small drop may affect your reading.

im begining to see this.

You could avoid all this with a digital temperature sensor.

since im looking for somewhat accuracy, i just ordered a ds18b20. lol.

thank you for your input folks, ive learned from this experience :slight_smile: