Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Temperature Display

Temperature Display

Introduction: The temperature display is a common project in the field of electronics and programming. It allows us to measure and display the current temperature in a specific environment. This article will guide you through the process of creating a temperature display using Arduino, providing example codes and a list of components required for the project.

Project: The goal of this project is to create a temperature display that can accurately measure and show the temperature in Celsius. The display will be connected to an Arduino board, which will read the temperature from a sensor and display it on a LCD screen. This project can be useful in various applications such as home automation, weather monitoring, or temperature control systems.

Components Required:

  • Arduino Uno board
  • DHT11 temperature and humidity sensor
  • 16x2 LCD screen
  • Breadboard
  • Jumper wires
  • Potentiometer (for LCD contrast adjustment)

Examples: Example 1: Reading and Displaying Temperature

#include <dht.h>
#include <LiquidCrystal.h>

#define DHTPIN 2
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

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

void loop() {
  float temperature = dht.readTemperature();

  lcd.setCursor(0, 0);
  lcd.print("Temperature:");
  lcd.setCursor(0, 1);
  lcd.print(temperature);
  lcd.print("C");

  delay(2000);
}

Explanation:

  • The code starts by including the necessary libraries for the DHT sensor and LCD screen.
  • The DHTPIN and DHTTYPE are defined to specify the pin connected to the DHT sensor and the sensor type (DHT11 in this case).
  • In the setup function, the LCD screen is initialized with its dimensions (16x2) and the DHT sensor is started.
  • The loop function reads the temperature from the DHT sensor and stores it in the "temperature" variable.
  • The temperature is then displayed on the LCD screen, along with a label and the unit (Celsius).
  • The delay function is used to wait for 2 seconds before repeating the process.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.