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

Introduction to Embedded Systems

Embedded systems play a crucial role in various industries and everyday devices, making them an essential topic for engineers and developers. These systems combine hardware and software to perform specific tasks efficiently and reliably. Understanding the fundamentals of embedded systems is vital for anyone working in the field of electronics and programming.

Project: Temperature and Humidity Monitoring System

In this project, we will create a temperature and humidity monitoring system using an Arduino board. The objective is to measure and display real-time temperature and humidity values on an LCD screen. This system can be used in various applications, such as home automation, greenhouse monitoring, or industrial control.

List of components:

  1. Arduino Uno board - 1x
  2. DHT11 temperature and humidity sensor - 1x
  3. 16x2 LCD screen - 1x
  4. Breadboard - 1x
  5. Jumper wires - as required

You can find these components at the following links:

  • Arduino Uno: [link]
  • DHT11 sensor: [link]
  • 16x2 LCD screen: [link]
  • Breadboard: [link]
  • Jumper wires: [link]

Examples:

Example 1: Reading Temperature and Humidity Values

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

#define DHTPIN 2
dht DHT;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

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

void loop() {
  int chk = DHT.read11(DHTPIN);

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

  lcd.setCursor(0, 1);
  lcd.print("Humidity: ");
  lcd.print(DHT.humidity);
  lcd.print("%");

  delay(2000);
}

Explanation:

  • We include the necessary libraries for the DHT sensor and LCD screen.
  • Define the pin to which the DHT11 sensor is connected.
  • Create an instance of the LiquidCrystal class and initialize it with the appropriate pin numbers.
  • In the setup() function, we initialize the LCD screen.
  • In the loop() function, we read the temperature and humidity values from the DHT11 sensor using the read11() function.
  • We display the temperature and humidity values on the LCD screen using the print() function.

Example 2: Controlling an LED based on Temperature

#include <dht.h>

#define DHTPIN 2
#define LEDPIN 13
dht DHT;

void setup() {
  pinMode(LEDPIN, OUTPUT);
}

void loop() {
  int chk = DHT.read11(DHTPIN);

  if (DHT.temperature > 25) {
    digitalWrite(LEDPIN, HIGH);
  } else {
    digitalWrite(LEDPIN, LOW);
  }

  delay(1000);
}

Explanation:

  • We include the necessary library for the DHT sensor.
  • Define the pin to which the DHT11 sensor is connected and the pin to which the LED is connected.
  • In the setup() function, we set the LED pin as an output.
  • In the loop() function, we read the temperature value from the DHT11 sensor using the read11() function.
  • If the temperature is above 25 degrees Celsius, we turn on the LED; otherwise, we turn it off.

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.