guitarnoob123
Junior Member level 1
- Joined
- Aug 18, 2013
- Messages
- 16
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 148
I want to display the LM35 temperature reading in both serial and the LCD.
I used a soldering iron to heat up the surroundings near the sensor to test my setup.
After displaying 31.75 degrees celcius, further exposure to heat produces a negative output on the LCD and the serial monitor.
The sensor is not at fault since I replaced it 3 times already only to get the same result as the first sensor.
Same data is recorded in both output devices (LCD serial) - no problem there perhaps?
I also observed proper pinouts for the sensor. Vs - 5V, Gnd - Gnd, Vout - A0 of Arduino
What could be the problem?
Here is the code
I used a soldering iron to heat up the surroundings near the sensor to test my setup.
After displaying 31.75 degrees celcius, further exposure to heat produces a negative output on the LCD and the serial monitor.
The sensor is not at fault since I replaced it 3 times already only to get the same result as the first sensor.
Same data is recorded in both output devices (LCD serial) - no problem there perhaps?
I also observed proper pinouts for the sensor. Vs - 5V, Gnd - Gnd, Vout - A0 of Arduino
What could be the problem?
Here is the code
Code:
#include <LiquidCrystal.h>
#define tempSensor 0
LiquidCrystal lcd(7, 6, 5, 4, 3, 2); //RS, Enable, D4, D5, D6, D7
int Vin; // Variable to read the value from the Arduino’s pin A0
float TC; // Variable that receives the converted voltage value to ºC temperature
void setup()
{
lcd.begin(16, 2);
delay(2000);
lcd.clear();
Serial.begin(9600);
}
void loop()
{
Vin = analogRead (tempSensor); // Tells the Arduino to read A0 and stores the value in “Vin”
TC=(5*100*Vin)/1024.0; // Converts the voltage value into temperature and stores it into the “TC” variable (in ºC)
lcd.setCursor(0, 0); // Moves the cursor of the display to the next line
lcd.print (TC);
lcd.print((char)223);// degree symbol
lcd.print("C");
Serial.print("DATA,TIME,"); Serial.println(TC);
delay(1000);
}