Arduino UNO-Based Environmental Monitoring System with GSM Module
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to monitor environmental conditions using an Arduino UNO microcontroller. It includes a DHT11 sensor for temperature and humidity measurements, a water level sensor for soil moisture detection, and a SIM900A module for sending SMS notifications. The circuit is powered via a USB power source.
Component List
Arduino UNO
- Description: A 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
DHT11
- Description: A digital temperature and humidity sensor.
- Pins: VCC, GND, DATA
Water Level Sensor
- Description: A sensor to measure the water level or soil moisture.
- Pins: SIG, VCC, GND
USB Power
- Description: Provides power to the circuit.
- Pins: +, -
SIM900A
- Description: A GSM module for sending SMS messages.
- Pins: GND, DB9-3 (RXD), DB9-2 (TXD), 5V, 3VR, 5VR, 3VT, 5VT, VCC, Ring, RESTART, RESET, STATUS
Wiring Details
Arduino UNO
- 5V: Connected to 5V of SIM900A, VCC of Water Level Sensor, VCC of DHT11
- GND: Connected to GND of SIM900A, GND of Water Level Sensor, GND of DHT11
- A0: Connected to SIG of Water Level Sensor
- D8: Connected to DB9-3 (RXD) of SIM900A
- D7: Connected to DB9-2 (TXD) of SIM900A
- D2: Connected to DATA of DHT11
DHT11
- VCC: Connected to 5V of Arduino UNO
- GND: Connected to GND of Arduino UNO
- DATA: Connected to D2 of Arduino UNO
Water Level Sensor
- VCC: Connected to 5V of Arduino UNO
- GND: Connected to GND of Arduino UNO
- SIG: Connected to A0 of Arduino UNO
USB Power
- +: Not connected in the provided net list
- -: Not connected in the provided net list
SIM900A
- 5V: Connected to 5V of Arduino UNO
- GND: Connected to GND of Arduino UNO
- DB9-3 (RXD): Connected to D8 of Arduino UNO
- DB9-2 (TXD): Connected to D7 of Arduino UNO
Code Documentation
Arduino UNO Code
#include <DHT.h>
#include <SoftwareSerial.h>
#define DHTPIN 2
#define DHTTYPE DHT11
#define SOIL_MOISTURE_PIN A0
DHT dht(DHTPIN, DHTTYPE);
SoftwareSerial gsm(7, 8); // RX, TX
void setup() {
Serial.begin(9600);
gsm.begin(9600);
dht.begin();
delay(1000);
// Initialize GSM module
gsm.println("AT");
delay(1000);
gsm.println("AT+CMGF=1"); // Set SMS to text mode
delay(1000);
}
void loop() {
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
int soilMoisture = analogRead(SOIL_MOISTURE_PIN);
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
String message = "Temp: " + String(temperature) + "C, Humidity: " + String(humidity) + "%, Soil Moisture: " + String(soilMoisture);
sendSMS(message);
delay(60000); // Wait for 1 minute before sending the next reading
}
void sendSMS(String message) {
gsm.println("AT+CMGS=\"+1234567890\""); // Replace with your phone number
delay(1000);
gsm.print(message);
delay(1000);
gsm.write(26); // ASCII code for CTRL+Z to send the SMS
delay(1000);
}
This code initializes the DHT11 sensor and the SIM900A GSM module. It reads temperature, humidity, and soil moisture data, then sends this data via SMS every minute.