Arduino and ESP32-Based Environmental Monitoring System with Ultrasonic and Water Flow Sensing
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit in question is composed of an Arduino UNO microcontroller, an ESP32 microcontroller, an HC-SR04 Ultrasonic Sensor, a YF-S201 Water Flow Meter, and a BMP280 Barometric Pressure Sensor. The Arduino UNO serves as the primary controller, interfacing with the sensors and the ESP32, which may be used for additional processing or connectivity. The HC-SR04 is used for distance measurement, the YF-S201 measures water flow, and the BMP280 provides atmospheric pressure and temperature readings. The circuit is designed to share common power and ground lines, and it includes serial communication between the Arduino UNO and the ESP32.
Component List
Arduino UNO
- Microcontroller board based on the ATmega328P
- It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.
HC-SR04 Ultrasonic Sensor
- An ultrasonic distance sensor that provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm.
YF-S201 Water Flow Meter
- A water flow sensor that consists of a plastic valve body, a water rotor, and a hall-effect sensor. It is used to measure the flow rate of water.
ESP32
- A microcontroller featuring Wi-Fi and Bluetooth connectivity, suitable for a wide variety of applications ranging from low-power sensor networks to more demanding tasks such as voice encoding, music streaming, and MP3 decoding.
BMP280
- A precision sensor from Bosch for measuring atmospheric pressure and temperature in environmental monitoring applications.
Wiring Details
Arduino UNO
- 3.3V connected to ESP32 (3V3) and BMP280 (VCC)
- 5V connected to HC-SR04 Ultrasonic Sensor (VCC) and YF-S201 Water Flow Meter (VCC)
- GND connected to BMP280 (GND)
- A4 (SDA) connected to BMP280 (SDA)
- A5 (SCL) connected to BMP280 (SCL)
- D9 connected to HC-SR04 Ultrasonic Sensor (TRIG)
- D8 connected to HC-SR04 Ultrasonic Sensor (ECHO)
- D2 connected to YF-S201 Water Flow Meter (SIG)
- D1 (TX) connected to ESP32 (RX0)
- D0 (RX) connected to ESP32 (TX0)
HC-SR04 Ultrasonic Sensor
- VCC connected to Arduino UNO (5V)
- TRIG connected to Arduino UNO (D9)
- ECHO connected to Arduino UNO (D8)
- GND connected to common ground
YF-S201 Water Flow Meter
- SIG connected to Arduino UNO (D2)
- GND connected to common ground
- VCC connected to Arduino UNO (5V)
ESP32
- 3V3 connected to Arduino UNO (3.3V)
- GND connected to common ground
- RX0 connected to Arduino UNO (D1)
- TX0 connected to Arduino UNO (D0)
BMP280
- VCC connected to Arduino UNO (3.3V)
- GND connected to common ground
- SDA connected to Arduino UNO (A4)
- SCL connected to Arduino UNO (A5)
Documented Code
Arduino UNO Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Note: The provided code for the Arduino UNO is a template with empty setup and loop functions. The user is expected to fill in the code according to the specific requirements of the application.
ESP32 Code
No code was provided for the ESP32 microcontroller.
End of documentation.