Michael Guerero
Published © GPL3+

Simple Electric Thermometer

Measures the ambient temperature and displays both the Fahrenheit and Celsius on the LCD.

BeginnerShowcase (no instructions)1,183
Simple Electric Thermometer

Things used in this project

Story

Read more

Code

LCD_Thermometer

Arduino
Makes use of both the LCD and temperature sensor libraries (MCP9808).
#include <Adafruit_MCP9808.h>
#include <LiquidCrystal.h>
#include <Wire.h>

Adafruit_MCP9808 tempsensor = Adafruit_MCP9808();
LiquidCrystal lcd(1,2,4,5,6,7);

void setup() {
  if (!tempsensor.begin()) {
    while (1);
  }
  lcd.begin(16,2);  
  lcd.setCursor(0,0);
}
void loop() {
  float c = tempsensor.readTempC();
  float f = c * 9.0 / 5.0 + 32;
  
  lcd.setCursor(4,0);
  lcd.print(f);
  lcd.print(" F");
 
  lcd.setCursor(4,1);
  lcd.print(c);
  lcd.print(" C");
  
  delay(1000);
  lcd.clear();
}

Credits

Michael Guerero

Michael Guerero

3 projects • 43 followers
Earned my BS in Mechanical Engineering from Cal Poly Pomona in 2018. Currently working for the California Air Resources Board.

Comments