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

Arduino UNO-Based Water Quality Monitoring System with Wi-Fi Connectivity

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Water Quality Monitoring System with Wi-Fi Connectivity

Circuit Documentation

Summary

This circuit is designed to measure water quality parameters including pH, turbidity, and Total Dissolved Solids (TDS). The measurements are taken using respective sensors and the data is processed by an Arduino UNO microcontroller. The processed data is then sent to a cloud server for monitoring and analysis.

Component List

  1. Turbidity Sensor

    • Description: Measures the turbidity (cloudiness) of water.
    • Pins: OUT, VCC, GND
  2. 5V Battery

    • Description: Provides power to the circuit.
    • Pins: positive, negative
  3. Arduino UNO

    • Description: Microcontroller used to process sensor data and send it to the cloud.
    • 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
  4. PH Meter

    • Description: Measures the pH level of water.
    • Pins: Signal, VCC, GND
  5. TDS Sensor

    • Description: Measures the Total Dissolved Solids in water.
    • Pins: AI, GND, 5V

Wiring Details

Turbidity Sensor

5V Battery

Arduino UNO

PH Meter

TDS Sensor

Documented Code

Arduino UNO Code

// Include necessary libraries
#include <ESP8266WiFi.h>

// WiFi credentials
const char* ssid = "Your_WiFi_SSID";
const char* password = "Your_WiFi_Password";

// Server or cloud API endpoint
const char* server = "api.thingspeak.com"; // Example: ThingSpeak API
const char* apiKey = "Your_API_Key"; // Replace with your actual API key

// Pin definitions
const int pH_PIN = A0;        // pH sensor connected to A0
const int TURBIDITY_PIN = A1; // Turbidity sensor connected to A1
const int TDS_PIN = A2;       // TDS sensor connected to A2

// WiFi client
WiFiClient client;

void setup() {
  Serial.begin(115200);

  // Initialize WiFi
  Serial.println("Connecting to WiFi...");
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.print(".");
  }
  Serial.println("\nWiFi connected");
}

void loop() {
  // Read sensor values
  int phValue = analogRead(pH_PIN); // Raw pH sensor value
  int turbidityValue = analogRead(TURBIDITY_PIN); // Raw turbidity value
  int tdsValue = analogRead(TDS_PIN); // Raw TDS sensor value

  // Convert raw values to meaningful data (example calibration)
  float pH = (phValue / 1023.0) * 14.0; // Example pH conversion
  float turbidity = (turbidityValue / 1023.0) * 100.0; // Example turbidity in NTU
  float tds = (tdsValue / 1023.0) * 500.0; // Example TDS in ppm

  // Print values to Serial Monitor
  Serial.print("pH: ");
  Serial.print(pH);
  Serial.print(" | Turbidity: ");
  Serial.print(turbidity);
  Serial.print(" NTU | TDS: ");
  Serial.print(tds);
  Serial.println(" ppm");

  // Send data to the server
  if (client.connect(server, 80)) {
    String data = "field1=" + String(pH) + "&field2=" + String(turbidity) + "&field3=" + String(tds);
    client.println("POST /update HTTP/1.1");
    client.println("Host: api.thingspeak.com");
    client.println("Connection: close");
    client.println("Content-Type: application/x-www-form-urlencoded");
    client.print("Content-Length: ");
    client.println(data.length());
    client.println();
    client.print(data);
    client.stop();

    Serial.println("Data sent to server.");
  } else {
    Serial.println("Connection to server failed.");
  }

  delay(20000); // Send data every 20 seconds
}

PH Meter Code

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

}

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

}