Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Monitoring systems are essential for various applications, from environmental monitoring to industrial automation. With Arduino, you can create a customizable and cost-effective monitoring system. This article will guide you through the process of setting up a basic monitoring system using Arduino.
In this example, we will use a DHT11 sensor to monitor temperature and humidity levels. The data will be displayed on the Serial Monitor.
Components Needed:
Step-by-Step Instructions:
Wiring the Components:
Installing the DHT Library:
Sketch
-> Include Library
-> Manage Libraries...
DHT sensor library
and install it.Writing the Code:
#include "DHT.h"
#define DHTPIN 2 // Digital pin connected to the DHT sensor
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
delay(2000); // Wait a few seconds between measurements
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C");
}
Uploading the Code:
Tools
menu.Viewing the Data:
Tools
menu.In this example, we will use an LDR (Light Dependent Resistor) to monitor light intensity. The data will be displayed on the Serial Monitor.
Components Needed:
Step-by-Step Instructions:
Wiring the Components:
Writing the Code:
void setup() {
Serial.begin(9600);
}
void loop() {
int lightLevel = analogRead(A0);
Serial.print("Light Intensity: ");
Serial.println(lightLevel);
delay(1000);
}
Uploading the Code:
Tools
menu.Viewing the Data:
Tools
menu.