Digital temp to LCD

Hello all!
im making a project using a LM35 and a LCD 16x2...
I put all my connections in and I make sure their not connecting, and it appears that all that happens is that my temp reading is 40C above the temp, and that the LCD is blank
:confused:
heres the code
const int sensor=A1; // Assigning analog pin A1 to variable 'sensor'
float tempc; //variable to store temperature in degree Celsius
float tempf; //variable to store temperature in Fahreinheit
float vout; //temporary variable to hold sensor reading
void setup()
{
pinMode(sensor,INPUT); // Configuring pin A1 as input
Serial.begin(9600);
}
void loop()
{
vout=analogRead(sensor);
vout=(vout
500)/1023;
tempc=vout; // Storing value in Degree Celsius
tempf=(vout*1.8)+32; // Converting to Fahrenheit
Serial.print("in DegreeC=");
Serial.print("\t");
Serial.print(tempc);
Serial.println();
Serial.print("in Fahrenheit=");
Serial.print("\t");
Serial.print(tempf);
Serial.println();
delay(1000); //Delay of 1 second for ease of viewing
}

Im using a arduino uno..
if you get a cool face, its a 8 and a )
heres the link


for the circut

(deleted)

There's no lcd in that code

INTP:
There's no lcd in that code

I just realised that .-.

So, heres the second part... what am I doing wrong?
.-.

#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 
const int sensor=A1; // Assigning analog pin A1 to variable 'sensor'
float tempc;  //variable to store temperature in degree Celsius
float tempf;  //variable to store temperature in Fahreinheit 
float vout;  //temporary variable to hold sensor reading
void setup()
{
pinMode(sensor,INPUT); // Configuring pin A1 as input
Serial.begin(9600);
lcd.begin(16,2);  
  delay(500);
}
void loop() 
{
vout=analogRead(sensor);
vout=(vout*500)/1023;
tempc=vout; // Storing value in Degree Celsius
tempf=(vout*1.8)+32; // Converting to Fahrenheit 
lcd.setCursor(0,0);
lcd.print("in DegreeC= ");
lcd.print(tempc);
lcd.setCursor(0,1);
lcd.print("in Fahrenheit=");
lcd.print(tempf);
delay(1000); //Delay of 1 second for ease of viewing in serial monitor
}

I have 2 pieces of code...
1st, LM35 code...

const int sensor=A1; // Assigning analog pin A1 to variable 'sensor'
float tempc;  //variable to store temperature in degree Celsius
float tempf;  //variable to store temperature in Fahreinheit 
float vout;  //temporary variable to hold sensor reading
void setup()
{
pinMode(sensor,INPUT); // Configuring pin A1 as input
Serial.begin(9600);
}
void loop() 
{
vout=analogRead(sensor);
vout=(vout*500)/1023;
tempc=vout; // Storing value in Degree Celsius
tempf=(vout*1.8)+32; // Converting to Fahrenheit 
Serial.print("in DegreeC=");
Serial.print("\t");
Serial.print(tempc);
Serial.println();
Serial.print("in Fahrenheit=");
Serial.print("\t");
Serial.print(tempf);
Serial.println();
delay(1000); //Delay of 1 second for ease of viewing 
}

2nd, the LCD code, (PS. im horrible at this ;-;. i burnt 4 boards in a month xD)

#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 
const int sensor=A1; // Assigning analog pin A1 to variable 'sensor'
float tempc;  //variable to store temperature in degree Celsius
float tempf;  //variable to store temperature in Fahreinheit 
float vout;  //temporary variable to hold sensor reading
void setup()
{
pinMode(sensor,INPUT); // Configuring pin A1 as input
Serial.begin(9600);
lcd.begin(16,2);  
  delay(500);
}
void loop() 
{
vout=analogRead(sensor);
vout=(vout*500)/1023;
tempc=vout; // Storing value in Degree Celsius
tempf=(vout*1.8)+32; // Converting to Fahrenheit 
lcd.setCursor(0,0);
lcd.print("in DegreeC= ");
lcd.print(tempc);
lcd.setCursor(0,1);
lcd.print("in Fahrenheit=");
lcd.print(tempf);
delay(1000); //Delay of 1 second for ease of viewing in serial monitor
}

and i kinda merged them together to create

#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 
const int sensor=A1; // Assigning analog pin A1 to variable 'sensor'
float tempc;  //variable to store temperature in degree Celsius
float tempf;  //variable to store temperature in Fahreinheit 
float vout;  //temporary variable to hold sensor reading
void setup()
{
pinMode(sensor,INPUT); // Configuring pin A1 as input
Serial.begin(9600);
lcd.begin(16,2);  
  delay(500);
}
void loop() 
{
vout=analogRead(sensor);
vout=(vout*500)/1023;
tempc=vout; // Storing value in Degree Celsius
tempf=(vout*1.8)+32; // Converting to Fahrenheit 
lcd.setCursor(0,0);
lcd.print("in DegreeC= ");
lcd.print(tempc);
lcd.setCursor(0,1);
lcd.print("in Fahrenheit=");
lcd.print(tempf);
delay(1000); //Delay of 1 second for ease of viewing in serial monitor
vout=analogRead(sensor);
vout=(vout*500)/1023;
Serial.print("in DegreeC=");
Serial.print("\t");
Serial.print(tempc);
Serial.println();
Serial.print("in Fahrenheit=");
Serial.print("\t");
Serial.print(tempf);
Serial.println();
delay(1000); //Delay of 1 second for ease of viewing 
}

plz help me, ;-;
heres the website

What are you seeing in Serial Monitor?

I think I found my culprit... a little short circut,
il have a look into this tomorrow, .-.
plz,
its 11PM

here

http://imgur.com/a/VPBnv

the short wire was a false, ;-;
it seems to be the code, or something...

What is happening?
Is the LCD showing anything?

clockpie_5436:
here

http://imgur.com/a/VPBnv

the short wire was a false, ;-;
it seems to be the code, or something...

In my experience, one of the biggest problems a newbie faces is building a project without testing each component using known good example code.

  • You should test the Arduino & LCD
  • You should test the Arduino & LM35

Once you know your parts work with known good code, you can start the process of coding the "glue" to tie everything together.

Ray

I just did this little project. I believe the TMP 35 output is 1mV/deg C. I found either on a data sheet or in the adafruit documentation, a chart showing 50 mV at the freezing point of water. Subtracting 50 from the raw value gives me a reasonably consistent 100 deg C when dunked in boiling water.

odometer:
What is happening?
Is the LCD showing anything?

the bottom row just changes colours, no words,

mrburnette:
In my experience, one of the biggest problems a newbie faces is building a project without testing each component using known good example code.

  • You should test the Arduino & LCD
  • You should test the Arduino & LM35

Once you know your parts work with known good code, you can start the process of coding the "glue" to tie everything together.

Ray

Ive tested everything... They all seem to work, i did the 2 projects form the hand book, and it all comes out good :confused:

Hi,

the bottom row just changes colours, no words,

What do you mean changes colours.
Can you post a picture of your project please, and attach it to you post.

Use REPLY rather than QUICK REPLY and it has an attachment facility,

Off site images are not compatible with some of the forum members platforms.

Thanks.. Tom.. :slight_smile:

I found my error, the diagram the website provides is for another LCD, i used the diagram from the starter kit, and it worked! i had to re-upload the code, because I was getting strange symblos :confused:
@moderaror,
please lock post, thanks

Hi,
Good to hear.
Now all you need to do is Edit the thread subject and put [SOLVED] at the start of the subject title.

[SOLVED] Digital temp to LCD.

Tom... :slight_smile: