This circuit is designed to collect environmental data using various sensors and control actuators such as fans and servos. The central controller is an Arduino UNO, which interfaces with multiple sensors and actuators. The sensors include a DHT11 for temperature and humidity, an MQ-2 for gas detection, and PMS5003 and ZH03B for particulate matter detection. The actuators include fans and micro servos. A 4-channel relay module is used to control the fans.
2 x AA Battery Mount
Micro servo 9G
Fan
Arduino UNO
4 channel relay module
MQ-2
PMS5003 Board (6-pin)
DHT 11
ZH03B
/**
* This example demonstrates how to collect temperature and humidity measurements
* from the Adafruit DHT11 sensor. Measurements are printed out to the serial monitor.
*
* - Make sure to first install the following libraries through the Arduino Library Manager:
* - DHT Sensor Library (by Adafruit)
* - Adafruit Unified Sensor (by Adafruit)
* - When you open the serial monitor to view measurements from the DHT11, make sure
* that you select 9600 baud so that the serial monitor can receive data from the Arduino.
*
* This example was originally written by Adafruit Industries LLC.
*/
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 2 // Digital pin connected to the DHT sensor
// Feather HUZZAH ESP8266 note: use pins 3, 4, 5, 12, 13 or 14 --
// Pin 15 can work but DHT must be disconnected during program upload.
// Uncomment the type of sensor in use:
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
// See guide for details on sensor wiring and usage:
// https://learn.adafruit.com/dht/overview
DHT_Unified dht(DHTPIN, DHTTYPE);
uint32_t delayMS;
void setup() {
Serial.begin(9600);
// Initialize device.
dht.begin();
Serial.println(F("DHTxx Unified Sensor Example"));
// Print temperature sensor details.
sensor_t sensor;
dht.temperature().getSensor(&sensor);
Serial.println(F("------------------------------------"));
Serial.println(F("Temperature Sensor"));
Serial.print (F("Sensor Type: ")); Serial.println(sensor.name);
Serial.print (F("Driver Ver: ")); Serial.println(sensor.version);
Serial.print (F("Unique ID: ")); Serial.println(sensor.sensor_id);
Serial.print (F("Max Value: ")); Serial.print(sensor.max_value); Serial.println(F("°C"));
Serial.print (F("Min Value: ")); Serial.print(sensor.min_value); Serial.println(F("°C"));
Serial.print (F("Resolution: ")); Serial.print(sensor.resolution); Serial.println(F("°C"));
Serial.println(F("------------------------------------"));
// Print humidity sensor details.
dht.humidity().get