Introduction
A Digital Thermometer is a practical project that demonstrates how to measure and display temperature using electronic components. This project is an excellent introduction to interfacing sensors with microcontrollers and displaying data on an LCD. In this tutorial, we will build a Digital Thermometer using an Arduino, a temperature sensor (LM35), and an LCD display. You will learn how to read temperature data and display it digitally.
Materials Needed
For this project, you will need:
Arduino Uno
Breadboard
LM35 Temperature Sensor
16x2 LCD Display (with I2C module for simplicity)
Jumper Wires
Power Source (e.g., USB cable for Arduino)
Step 1: Setting Up the Components
Arduino and Breadboard: Open TinkerCAD and create a new circuit project. Drag and drop an Arduino Uno and a breadboard onto the workspace.
LM35 Temperature Sensor: This analog sensor provides a voltage output that is proportional to the temperature.
VCC: Connect to the 5V pin on the Arduino.
GND: Connect to GND on the Arduino.
OUT: Connect to an analog pin on the Arduino (e.g., A0).
16x2 LCD Display (with I2C module): This LCD will display the temperature readings.
VCC: Connect to the 5V pin on the Arduino.
GND: Connect to GND on the Arduino.
SDA: Connect to the SDA pin on the Arduino (A4 on most boards).
SCL: Connect to the SCL pin on the Arduino (A5 on most boards).
Step 2: Wiring Diagram
Ensure your wiring follows these connections:
LM35 Temperature Sensor:
VCC → 5V on Arduino
GND → GND on Arduino
OUT → Analog Pin A0 on Arduino
16x2 LCD Display (with I2C module):
VCC → 5V on Arduino
GND → GND on Arduino
SDA → SDA (A4 on Arduino)
SCL → SCL (A5 on Arduino)
Step 3: Writing the Code
With the components connected, let's write the Arduino code to read the temperature from the LM35 sensor and display it on the LCD.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
const int tempPin = A0; // Pin connected to the LM35 sensor
LiquidCrystal_I2C lcd(0x27, 16, 2); // Initialize the LCD with I2C address 0x27
void setup() {
lcd.begin(); // Initialize the LCD
lcd.backlight(); // Turn on the backlight
Serial.begin(9600); // Initialize serial communication for debugging
}
void loop() {
int sensorValue = analogRead(tempPin); // Read the analog value from the sensor
// Convert the analog reading (0-1023) to voltage (0-5V)
float voltage = sensorValue * (5.0 / 1023.0);
// Convert the voltage to temperature in Celsius
float temperature = voltage * 100.0;
// Display the temperature on the LCD
lcd.clear(); // Clear the display
lcd.setCursor(0, 0); // Set cursor to the top left corner
lcd.print("Temperature:");
lcd.setCursor(0, 1); // Set cursor to the second line
lcd.print(temperature);
lcd.print(" C");
// Debugging information
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" C");
delay(1000); // Update every second
}
Step 4: Simulating the Circuit
After entering the code, click the "Start Simulation" button in TinkerCAD.
Observe the LCD display showing the temperature in Celsius. Adjust the simulated temperature by changing the input voltage to the LM35 sensor to see how the readings update.
Monitor the Serial Monitor for real-time temperature data and debugging information.
Step 5: Understanding the Code
Reading Sensor Values: The analogRead() function reads the voltage from the LM35 sensor.
Converting Voltage to Temperature: The voltage is converted to a temperature value using the sensor's specifications (10mV per degree Celsius for LM35).
Displaying Data on LCD: The lcd.print() function displays the temperature value on the LCD.
Serial Debugging: The Serial.print() and Serial.println() functions provide temperature readings on the Serial Monitor for verification.
Step 6: Enhancing the System
You can enhance this Digital Thermometer project with additional features:
Temperature Alerts: Add functionality to alert when the temperature exceeds a certain threshold.
Data Logging: Record temperature data over time and log it to a file or display it in a graphical format.
Temperature Units: Include the option to switch between Celsius and Fahrenheit.
Conclusion
You have successfully built a Digital Thermometer using TinkerCAD and Arduino. This project demonstrates how to interface a temperature sensor with a microcontroller and display the data on an LCD, providing practical experience in sensor integration and data presentation.
Want us to guide you through your project or make the project for you ?
Create Various Projects
Check out our Free Arduino Projects Playlist - Arduino Projects
Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects
Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects
Check out our Free IoT Projects Playlist - IoT Projects
Check out our Free Home Automation Projects Playlist - Home Automation Projects
Check out our Free NodeMCu Projects Playlist - NodeMCu Projects
Comments