LCD displayed a very high temperature instead of the one sensed

Hi,
I’m new here.
I’m doing on a project that requires a temperature sensor to be sensed and display the temperature on the LCD but the temperature was not shown base on what the sensor sensed.
Here is my codes I’m not sure if there’s anything wrong with it.

#include <LiquidCrystal.h>

LiquidCrystal lcd(12,11,5,4,3,2);
const int inPin = 0;

void setup()
{
lcd.begin(16,2);
}

void loop()
{
int value = analogRead(inPin);
lcd.setCursor(0, 1);
float millivolts = (value / 1024.0) * 5000;
float celsius = millivolts / 10;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(celsius);
lcd.print(“Celsius”);
lcd.setCursor(0, 1);
lcd.print((celsius * 9) / 5 + 32);
lcd.print(“Fahrenheit”);
delay(10000);
}

what temperature sensor are you using?

I'm using TMP36 temperature sensor.

I've been to that website and the Serial.print code is only to transmit wirelessly right? I want it to be able to display on the LCD without being wireless first then connect it and received it wireslessly after temperature being sensed.

change their Serial.print to lcd.print

Ok. I will go change and try it. Thanks for your advice.

I managed to get the temperature now but at the end of the display, after it shows degreeC there is some unknown shades that i do not know how to get rid. Got any ways can help me?

monkeyo: I managed to get the temperature now but at the end of the display, after it shows degreeC there is some unknown shades that i do not know how to get rid. Got any ways can help me?

Is your LCD contrast too high?

I'm not sure but i'm using the 10K potentiometer to adjust it.

monkeyo: I'm not sure but i'm using the 10K potentiometer to adjust it.

Dis the adjustment help in anyway? Can you upload a picture? Repost your code if it changed after looking at that pdf.

how do i add the photo? i cant load it in here.

Under your message click "Additional Options..." then browse to pic a pic off your computer.

Thanks!!
Here’s the picture of the display with shades.

After this, I need to be able to transmit to the receiver side wirelessly. Meaning the temperature sensor will be the one transmitting while LCD will be the receiver together with LED and Buzzer. So how do i make changes or what changes is there to make from the codes i show below?

int sensorPin = 0;

void setup() { Serial.begin(9600); }

void loop() { int reading = analogRead(sensorPin); float voltage = reading * 5.0; voltage /= 1024.0;

Serial.print(voltage); Serial.println(" volts");

float temperatureC = (voltage - 0.5) * 100 ; Serial.print(temperatureC); Serial.println(" degrees C");

float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0; Serial.print(temperatureF); Serial.println(" degrees F");

delay(1000);

}

In your latest code, I’m not seeing any LCD clearscreen or any other lcd commands… might want to look into those

The original post had init etc

Your posted code does not match the posted picture but my crystal ball says that you used lcd.println() instead of lcd.print.

Don

Okies. Thanks for all the advices and suggestions. I will try it out.

Can check if my these codes got anything wrong because it cant work wirelessly.

This is the Transmitter codes

//#include <LiquidCrystal.h>

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

int val = 0;
int temp = 0;

void setup() {

Serial.begin(9600);
//lcd.begin(16,2);

}

void loop() {
val = analogRead(A0);
temp = val * (5000 / 1024); //degree conversion

//if(temp >= 38) //sense if temperature higher than 38 degree
{
// lcd.print(‘FERVER!!’);

}

//else if(temp < 38) //sense if lower than 38 degree
{
//lcd.print(‘OK!!’);
}

}

This is the receiver codes.

#include <LiquidCrystal.h>

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

int incomingByte = 0;

void setup()
{
lcd.begin(16,2);
Serial.begin(9600);
//pinMode(2, OUTPUT);
//pinMode(3, OUTPUT);

}

void loop() {

if(Serial.available() > 0 )
{
incomingByte = Serial.read();
}

if(incomingByte >= 25)
{
lcd.println(“COLD”);
//digitalWrite(2, HIGH);
//digitalWrite(3, HIGH);
}

else if(incomingByte < 25)
{
lcd.println(“FREEZE”);
//digitalWrite(2, LOW);
//digitalWrite(3, LOW);
}

lcd.write(incomingByte);

What I am doing now is to sense the temperature sensor and send it wirelessly to the LCD so that the temperature will be displayed on the LCD.