Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO-Based Environmental Monitoring System with Wi-Fi Connectivity

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Environmental Monitoring System with Wi-Fi Connectivity

Circuit Documentation

Summary

This circuit integrates various sensors and modules with an Arduino UNO to measure environmental parameters such as temperature, humidity, and pH levels. It also includes a WiFi module for potential data transmission and a relay for controlling external devices.

Component List

  1. DHT11 Humidity and Temperature Sensor

    • Description: Measures humidity and temperature.
    • Pins: VDD, DATA, NULL, GND
  2. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  3. Resistor

    • Description: Provides resistance in the circuit.
    • Pins: pin1, pin2
    • Properties: 10k Ohms
  4. PH Meter

    • Description: Measures the pH level of a solution.
    • Pins: Signal, VCC, GND
  5. 5V Relay

    • Description: Controls high voltage devices with a low voltage signal.
    • Pins: Normally Open, Common terminal, Normally Closed, In, GND, VCC
  6. WiFi Module ESP8266-01

    • Description: Provides WiFi connectivity.
    • Pins: RX, GPIO0, GPIO2, GND, +3V3, Reset, CH-PD Chip power down, TX

Wiring Details

DHT11 Humidity and Temperature Sensor

Arduino UNO

Resistor

PH Meter

5V Relay

WiFi Module ESP8266-01

Documented Code

Arduino UNO Code

#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().getSensor(&sensor);
  Serial.println(F("Humidity 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("%"));
  Serial.print  (F("Min Value:   ")); Serial.print(sensor.min_value); Serial.println(F("%"));
  Serial.print  (F("Resolution:  ")); Serial.print(sensor.resolution); Serial.println(F("%"));
  Serial.println(F("------------------------------------"));
  // Set delay between sensor readings based on sensor details.
  delayMS = sensor.min_delay / 1000;
}

void loop() {
  // Delay between measurements.
  delay(delayMS);
  // Get temperature event and print its value.
  sensors_event_t event;
  dht.temperature().getEvent(&event);
  if (isnan(event.temperature)) {
    Serial.println(F("Error reading temperature!"));
  }
  else {
    Serial.print(F("Temperature: "));
    Serial.print(event.temperature);
    Serial.println(F("°C"));
  }
  // Get humidity event and print its value.
  dht.humidity().getEvent(&event);
  if (isnan(event.relative_humidity)) {
    Serial.println(F("Error reading humidity!"));
  }
  else {
    Serial.print(F("Humidity: "));
    Serial.print(event.relative_humidity);
    Serial.println(F("%"));
  }
  int sensorValue = analogRead(A0); // Read the analog value from pH meter
  float voltage = sensorValue * (5.0 / 1023.0); // Convert the analog value to voltage
  float pHValue = 3.5 * voltage; // Convert the voltage to pH value (example conversion factor)
  
  Serial.print("pH Value: ");
  Serial.println(pHValue); // Print the pH value to the serial monitor
  
  delay(1000);
}

DHT11 Humidity and Temperature Sensor Code

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

PH Meter Code

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

5V Relay Code

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}