Arduino Projects

DISPLAY TMP36 TO LCD

Here's a breakdown of the code:

1. You include the `Adafruit_LiquidCrystal` library to work with the LCD display.

2. Initialize a variable `seconds` to keep track of time.

3. Create an instance of the `Adafruit_LiquidCrystal` class called `lcd_1`, with a parameter of 0, which presumably specifies the LCD's I2C address.

4. Define the analog pin `sensorPin` to which the TMP36 sensor is connected.

5. In the `setup()` function:

   - Begin serial communication at a baud rate of 9600 for debugging purposes.

   - Initialize the LCD display with 16 columns and 2 rows.

   - Print "Temperature" on the first line of the LCD display.

6. In the `loop()` function:

   - Read the analog voltage from the TMP36 sensor.

   - Convert the analog reading to voltage.

   - Calculate the temperature in Celsius and Fahrenheit.

   - Print the temperature values to the serial monitor.

   - Set the cursor on the LCD display to the second line.

   - Print the temperature in Fahrenheit on the LCD.

   - Turn on the LCD backlight.

   - Wait for 500 milliseconds before repeating the loop.


It's important to ensure that your hardware connections are correctly set up, including connecting the TMP36 sensor to analog pin A0, and the LCD display to the appropriate pins. Also, make sure you have the `Adafruit_LiquidCrystal` library installed in your Arduino IDE.

/*  |********************************************************** Project           : Displaying TMP36 Temperature Sensor on LCD with Arduino** Program name      :  TMP36 Temperature Sensor with LCD** Author            : Douglas Fessler** Date created      : 06252023** Purpose           : Display Temperature using the TMP36 senosor to display to LCD & serial monitor on Arduino* Revision History  :|*************************************************************/#include <Adafruit_LiquidCrystal.h>
int seconds = 0;
Adafruit_LiquidCrystal lcd_1(0);
// Define the analog pin, the TMP36's Vout pin is connected to#define sensorPin A0
void setup(){  // Begin serial communication at 9600 baud rate  Serial.begin(9600);    lcd_1.begin(16, 2);
  lcd_1.print("Temperature");}
void loop(){  // Get the voltage reading from the TMP36  float reading = analogRead(sensorPin);
  // Convert that reading into voltage  // Replace 5.0 with 3.3, if you are using a 3.3V Arduino  float voltage = reading * (5.0 / 1024.0);
  // Convert the voltage into the temperature in Celsius  float temperatureC = (voltage - 0.5) * 100;
  // Print the temperature in Celsius  Serial.print("Temperature: ");  Serial.print(temperatureC);  Serial.print(" Degrees Celsius "); // shows degree symbol      // Print the temperature in Fahrenheit  float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;  Serial.print(temperatureF);  Serial.println(" Degress Fahrenheit"); // shows degree symbol    lcd_1.setCursor(0, 1);  lcd_1.print(temperatureF);  lcd_1.print(" F");  lcd_1.setBacklight(1);  delay(500); // Wait for 500 millisecond(s)
  seconds += 1;}

Donate

If you've enjoyed exploring my Arduino projects and want to see more amazing creations, your support can make a big difference! By contributing, you're helping me continue to innovate and bring even more exciting projects to life. Together, we can explore the endless possibilities of DIY electronics! Don't forget to like, subscribe, and follow for updates on the latest developments. Thank you for being a part of this journey! 

Click here to make a difference with your donation today!