system
October 12, 2014, 5:19pm
1
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);
}
system
October 12, 2014, 5:22pm
2
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.
system
October 12, 2014, 5:27pm
3
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
system
October 12, 2014, 5:31pm
4
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.
system
October 12, 2014, 5:32pm
5
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.
system
October 12, 2014, 5:43pm
7
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 ?
Which temperature sensor and how is it wired ?
system
October 12, 2014, 6:10pm
11
UKHeliBob:
Which temperature sensor and how is it wired ?
TMP36 temperature sensor and for the wiring look at the pictures
system
October 12, 2014, 7:35pm
12
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
system
October 12, 2014, 7:52pm
13
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.