Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Temperature+and+Humidity+Sensor
Importance and Utility Temperature and humidity sensors are essential components in various applications, ranging from weather monitoring systems to home automation. These sensors provide accurate measurements of temperature and humidity levels in the environment, allowing for better control and optimization of various systems. By incorporating these sensors into projects, engineers can create smarter and more efficient solutions.
Project: Weather Monitoring System In this example project, we will create a weather monitoring system using an Arduino board and a temperature and humidity sensor. The objective is to measure the temperature and humidity levels in the environment and display them on an LCD screen.
List of Components:
Examples:
#include <dht.h>
dht DHT;
void setup() { Serial.begin(9600); }
void loop() { int chk = DHT.read11(DHTPIN); Serial.print("Temperature: "); Serial.print(DHT.temperature); Serial.print(" °C\t"); Serial.print("Humidity: "); Serial.print(DHT.humidity); Serial.println(" %"); delay(2000); }
Explanation: This code initializes the DHT11 sensor and reads the temperature and humidity values. It then prints these values to the serial monitor every 2 seconds.
2. Displaying Temperature and Humidity on LCD:
dht DHT;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() { lcd.begin(16, 2); lcd.print("Temperature:"); lcd.setCursor(0, 1); lcd.print("Humidity:"); Serial.begin(9600); }
void loop() { int chk = DHT.read11(DHTPIN); lcd.setCursor(12, 0); lcd.print(DHT.temperature); lcd.setCursor(10, 1); lcd.print(DHT.humidity); delay(2000); }
Explanation: This code adds an LCD display to the previous example. It initializes the LCD and displays the temperature and humidity values obtained from the DHT11 sensor.