My First Project

hi i'm new here so don't know if i'm doing this in the right way.
i wanted to make a temerature sensor using the arduino uno starter kit
the temp sensor and the LCD display
the problem is that the temperature keeps changing on the LCD and i searched the internet
and i think i need to average the temperature before i put it on the LCD i found some codes but i don't know how to use it
this is the code i'm using now it works only it keeps changing the degrees.

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int tempPin = 0;

void setup() {

lcd.begin(16, 2);

lcd.print("Room Temperature");
}

void loop()
{
int tempReading = analogRead(tempPin);
float tempVolts = tempReading * 5.0 / 1024.0;
float tempC = (tempVolts - 0.5) * 100.0;
float tempF = tempC * 9.0 / 5.0 + 32.0;
lcd.setCursor(0, 1);
lcd.print("Temp C ");
lcd.setCursor(6, 1);
lcd.print(tempC);
delay(2000);
}

the problem is that the temperature keeps changing on the LCD

How much? Up and down by 75 degrees indicates one problem. Up and down by 0.1 degrees indicates another problem.

PaulS:

the problem is that the temperature keeps changing on the LCD

How much? Up and down by 75 degrees indicates one problem. Up and down by 0.1 degrees indicates another problem.

i use degrees celcius and it changes from about 17 to 25 degrees

i use degrees celcius and it changes from about 17 to 25 degrees

From one read to the next? Averaging isn't going to help.

What temp sensor are you using? Most are not analog devices.

no it go's from 17 to 16 to 18 to 22 to 25 and so on

Using Pin 0 for input is a little strange. Try using a different pin.

econjack:
Using Pin 0 for input is a little strange. Try using a different pin.

got it in pin 1 now and problem is still there altough i think its a bit less

Is that pin 1 or pin A1 ?

UKHeliBob:
Is that pin 1 or pin A1 ?

A1

Which temperature sensor and how is it wired ?

UKHeliBob:
Which temperature sensor and how is it wired ?

TMP36 temperature sensor and for the wiring look at the pictures

i connected the ground from the temperature sensor straight to the arduino this helps a lot it now changes between 17,87 - 17,38 16,89 celcius

i connected the ground from the temperature sensor straight to the arduino this helps a lot it now changes between 17,87 - 17,38 16,89 celcius

So. less than 1/2 a degree per reading. Now, it makes sense to take several reading, add them up, and divide by the number of readings.