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

ESP32-Based Water Quality Monitoring System with LCD Display

View and Edit Project In Cirkit DesignerImage of ESP32-Based Water Quality Monitoring System with LCD Display

Circuit Documentation

Summary

This circuit is designed to read data from various water quality sensors (TDS, Turbidity, PH, Flow Meter, and Temperature) connected to an ESP32 microcontroller. The sensor readings are displayed on a 16x2 LCD display. The ESP32 reads the sensor data and processes it to be shown on the LCD.

Component List

  1. ESP32 38 PINS

    • Description: A powerful microcontroller with built-in Wi-Fi and Bluetooth capabilities.
    • Pins: GND, 23, 22/SCL, 1, 2, 21/SDA, 19, 18, 5, 17/TX2, 16/RX2, 4, 0, 15, D1, D0, CLK, 3V3, EN, VP, VN, 34, 35, 32, 33, 25, 26, 27, 14, 12, 13, D2, D3, 11, 5V/VIN
  2. TDS-sensor, voor waterkwaliteit

    • Description: Measures the Total Dissolved Solids (TDS) in water.
    • Pins: gnd, v, analog pin
  3. Turbidity Sensor

    • Description: Measures the turbidity (cloudiness) of water.
    • Pins: OUT, VCC, GND
  4. PH Meter

    • Description: Measures the pH level of water.
    • Pins: Signal, VCC, GND
  5. YF-S201 Water Flow Meter

    • Description: Measures the flow rate of water.
    • Pins: SIG, GND, VCC
  6. LCD 16x2 (Wokwi Compatible)

    • Description: A 16x2 character LCD display.
    • Pins: VSS, VDD, V0, RS, RW, E, D0, D1, D2, D3, D4, D5, D6, D7, A, K
  7. DS18B20 1-Wire Temperature Sensor Probe Cable

    • Description: Measures the temperature of water.
    • Pins: shield, GND, DQ, VDD
  8. Potentiometer

    • Description: A variable resistor used to adjust the contrast of the LCD.
    • Pins: GND, Output, VCC

Wiring Details

ESP32 38 PINS

TDS-sensor, voor waterkwaliteit

Turbidity Sensor

PH Meter

YF-S201 Water Flow Meter

LCD 16x2 (Wokwi Compatible)

DS18B20 1-Wire Temperature Sensor Probe Cable

Potentiometer

Code Documentation

ESP32 Code

/*
 * This Arduino Sketch reads data from various water quality sensors
 * (TDS, Turbidity, PH, Flow Meter, and Temperature) connected to an ESP32.
 * The sensor readings are displayed on a 16x2 LCD display.
 */

#include <Wire.h>
#include <LiquidCrystal.h>
#include <OneWire.h>
#include <DallasTemperature.h>

// LCD pins
const int rs = 22, en = 23, d4 = 19, d5 = 18, d6 = 5, d7 = 17;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

// DS18B20 Temperature Sensor
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

// Sensor pins
const int tdsPin = 32;
const int turbidityPin = 35;
const int phPin = 34;
const int flowMeterPin = 33;

void setup() {
  lcd.begin(16, 2);
  sensors.begin();
  pinMode(tdsPin, INPUT);
  pinMode(turbidityPin, INPUT);
  pinMode(phPin, INPUT);
  pinMode(flowMeterPin, INPUT);
}

void loop() {
  sensors.requestTemperatures();
  float temperature = sensors.getTempCByIndex(0);

  int tdsValue = analogRead(tdsPin);
  int turbidityValue = analogRead(turbidityPin);
  int phValue = analogRead(phPin);
  int flowMeterValue = digitalRead(flowMeterPin);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Temp: ");
  lcd.print(temperature);
  lcd.print("C");

  lcd.setCursor(0, 1);
  lcd.print("TDS: ");
  lcd.print(tdsValue);
  lcd.print(" PH: ");
  lcd.print(phValue);

  delay(2000);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Turb: ");
  lcd.print(turbidityValue);

  lcd.setCursor(0, 1);
  lcd.print("Flow: ");
  lcd.print(flowMeterValue);

  delay(2000);
}

TDS-sensor Code

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

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

Documentation File

// No additional documentation provided.