River Water Quality Monitoring System using ESP32 with pH and turbidity sensors. This project is ideal for IoT-based environmental monitoring.
Monitoring river water quality is essential for environmental protection and public health.
This project uses ESP32 to measure pH and turbidity of water in real-time, providing data for dashboards, alerts, or cloud storage.
pH Measurement:
Turbidity Measurement:
Data Logging & Visualization:
#define PH_PIN 34
#define TURBIDITY_PIN 35
void setup() {
Serial.begin(115200);
}
void loop() {
// Read sensors
int phValueRaw = analogRead(PH_PIN);
int turbidityRaw = analogRead(TURBIDITY_PIN);
// Convert raw readings to real values (calibration required)
float voltagePH = phValueRaw * (3.3 / 4095.0);
float ph = 3.5 * voltagePH * 3; // approximate conversion, calibrate with buffer solution
float voltageTurbidity = turbidityRaw * (3.3 / 4095.0);
float turbidityNTU = (voltageTurbidity - 0.5) * 300; // approximate NTU, calibrate
Serial.printf("pH: %.2f, Turbidity: %.2f NTU\n", ph, turbidityNTU);
delay(2000); // read every 2 seconds
}
Connect pH sensor and turbidity sensor to ESP32 analog pins. Upload the code to ESP32 and open Serial Monitor.

“LVGL is the only framework that I've seen as open source Graphics Library for Microcontrollers. It’s easy to customize, adapts to any design, and the build size is tiny.”

Nokia 5110 LCD PCD8544 driver with a Raspberry Pi using WiringPi

OLED ssd1306 display interface with Raspberry Pi using WiringPi

To control a 4-channel relay using an ESP32 with a touch display (via LVGL library), you can integrate the relay control with a graphical user interface (GUI).

Interface the ADS1115 analog-to-digital converter (ADC) with a Raspberry Pi using WiringPi

MPU6050 Accelerometer and Gyroscope interface with Raspberry Pi using WiringPi

To perform HTTP GET and HTTP POST requests on an ESP32, you can use the WiFi and HTTPClient libraries.