ESP32-Based Smart Soil Monitoring System with Wi-Fi Connectivity
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit designed to interface various sensors and an OLED display with an ESP32 microcontroller. The circuit includes a DHT22 temperature and humidity sensor, a pH sensor, an NPK soil sensor, a capacitive soil moisture sensor, an RS485 communication module, and a 0.96" OLED display. The circuit is powered by a combination of power supplies and voltage regulators.
Component List
DHT22
- Description: Temperature and Humidity Sensor
- Pins: +, Out, -
pH Sensor
- Description: pH Sensor Module
- Pins: +9volt, output pin, GND
NPK Soil Sensor
- Description: Soil Nutrient Sensor
- Pins: 12V DC, A, B, GND
ESP32 (30 pin)
- Description: Microcontroller
- Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, Vin, D23, D22, TX0, RX0, D21, D19, D18, D5, TX2, RX2, D4, D2, D15, 3V3
Capacitive Soil Moisture Sensor V1.2
- Description: Soil Moisture Sensor
- Pins: GND, VCC, AOUT
RS485
- Description: RS485 Communication Module
- Pins: VCC, RO, RE, GND, B, A, DE, DI
0.96" OLED
- Description: OLED Display
- Pins: GND, VDD, SCK, SDA
7808
- Description: Voltage Regulator
- Pins: INPUT, GND, OUTPUT
Power Supply
- Description: Power Supply Module
- Pins: +, -
9V Battery
- Description: Battery
- Pins: +, -
Wiring Details
DHT22
- Out connected to ESP32 D13
- + connected to RS485 VCC, Capacitive Soil Moisture Sensor VCC, OLED VDD, ESP32 3V3
- - connected to 7808 GND, RS485 GND, NPK Soil Sensor GND, Capacitive Soil Moisture Sensor GND, Power Supply -, pH Sensor GND, OLED GND, ESP32 GND
pH Sensor
- output pin connected to ESP32 D34
- +9volt connected to 7808 GND
NPK Soil Sensor
- 12V DC connected to 7808 OUTPUT
- A connected to RS485 A
- B connected to RS485 B
- GND connected to 7808 GND, RS485 GND, DHT22 -, Capacitive Soil Moisture Sensor GND, Power Supply -, pH Sensor GND, OLED GND, ESP32 GND
ESP32 (30 pin)
- D34 connected to pH Sensor output pin
- D35 connected to Capacitive Soil Moisture Sensor AOUT
- D13 connected to DHT22 Out
- D23 connected to RS485 DI
- D22 connected to RS485 RE
- D19 connected to OLED SDA
- D18 connected to OLED SCK
- D4 connected to RS485 RO
- D2 connected to RS485 DE
- 3V3 connected to RS485 VCC, DHT22 +, Capacitive Soil Moisture Sensor VCC, OLED VDD
Capacitive Soil Moisture Sensor V1.2
- AOUT connected to ESP32 D35
- VCC connected to RS485 VCC, DHT22 +, OLED VDD, ESP32 3V3
- GND connected to 7808 GND, RS485 GND, DHT22 -, NPK Soil Sensor GND, Power Supply -, pH Sensor GND, OLED GND, ESP32 GND
RS485
- DI connected to ESP32 D23
- RE connected to ESP32 D22
- RO connected to ESP32 D4
- DE connected to ESP32 D2
- VCC connected to DHT22 +, Capacitive Soil Moisture Sensor VCC, OLED VDD, ESP32 3V3
- GND connected to 7808 GND, DHT22 -, NPK Soil Sensor GND, Capacitive Soil Moisture Sensor GND, Power Supply -, pH Sensor GND, OLED GND, ESP32 GND
- A connected to NPK Soil Sensor A
- B connected to NPK Soil Sensor B
0.96" OLED
- SDA connected to ESP32 D19
- SCK connected to ESP32 D18
- VDD connected to RS485 VCC, DHT22 +, Capacitive Soil Moisture Sensor VCC, ESP32 3V3
- GND connected to 7808 GND, RS485 GND, DHT22 -, NPK Soil Sensor GND, Capacitive Soil Moisture Sensor GND, Power Supply -, pH Sensor GND, ESP32 GND
7808
- GND connected to RS485 GND, DHT22 -, NPK Soil Sensor GND, Capacitive Soil Moisture Sensor GND, Power Supply -, pH Sensor GND, OLED GND, ESP32 GND
- OUTPUT connected to NPK Soil Sensor 12V DC
- INPUT connected to Power Supply +
Power Supply
- + connected to 7808 INPUT
- - connected to 7808 GND, RS485 GND, DHT22 -, NPK Soil Sensor GND, Capacitive Soil Moisture Sensor GND, pH Sensor GND, OLED GND, ESP32 GND
Documented Code
DHT22
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
pH Sensor
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
NPK Soil Sensor
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
ESP32
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Capacitive Soil Moisture Sensor V1.2
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
RS485
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
0.96" OLED
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}