Arduino Water Quality Meter
by ahmedkadi3108 in Circuits > Arduino
15 Views, 0 Favorites, 0 Comments
Arduino Water Quality Meter
Hello, in this instructable we will make an Arduino water quality meter. Photos are created by microsoft copilot.
Supplies
- Arduino Uno R3
- TDS (Total Dissolved Solids) Sensor
- Water Pump (12V DC)
- Relay Module (To control the pump)
- Buzzer (for alarm)
- LCD Screen (16x2) (To show water quality)
- 10K Potentiometer (for LCD contrast adjustment)
- Connection cable
- breadboard
System Working Prencibe
The Arduino-based water purification system is designed to monitor the quality of water and automatically initiate the purification process when necessary. Let's explain step by step how the system works:
Step by Step Working Principle
Measuring Water Quality with TDS Sensor:
The TDS sensor is placed in water and measures the amount of total dissolved solids (TDS) in the water.
The sensor produces an analog signal and this signal is sent to the analog input pin (A0) of the Arduino.
Processing of Data:
Arduino converts the analog signal to a digital value and converts this value to TDS value (in ppm).
This calculation is made using the voltage value from the sensor.
Display of TDS Value:
The LCD screen continuously displays the TDS value of water. In this way, the user can instantly see the quality of the water.
Water Quality Control:
When the TDS value rises above a certain level (for example, 500 ppm), it means that the quality of the water has decreased.
Arduino detects this situation and initiates the necessary operations.
Automatic Purification and Alarm:
When the TDS value rises above 500 ppm, the Arduino activates the relay that controls the water pump.
The pump starts to work and water purification is carried out.
At the same time, a buzzer (alarm) is activated and notifies the user that the water quality has decreased.
Return to Normal Status:
The user understands that the water quality has deteriorated by hearing the buzzer sound.
The pump begins to purify the water, the water quality improves.
Stopping:
When the TDS value drops below 500 ppm, the Arduino closes the relay and stops the pump.
The buzzer is also turned off and the alarm is stopped.
This system constantly monitors the quality of the water and automatically starts the purification process when it exceeds a certain level and gives an alarm to the user. In this way, the quality of the water can be monitored at all times and automatically improved when necessary.
When the TDS value drops back to acceptable levels (for example, below 500 ppm), the Arduino closes the relay and the pump stops.
The buzzer also stops and the alarm is stopped.
Detailed Working Flow
Beginning:
When the system receives power, Arduino and LCD screen start working.
The TDS sensor starts measuring the quality of the water and this data is continuously sent to Arduino.
Measurement and Display:
Arduino reads the data from the TDS sensor every second and makes calculations.
The LCD screen shows the updated TDS value.
Quality control:
Arduino constantly checks the TDS value.
If the TDS value is above the specified threshold value (500 ppm), it activates the relay and starts the pump.
At the same time, the buzzer is activated.
Alarm and Purification:
The user understands that the water quality has deteriorated by hearing the buzzer sound.
The pump begins to purify the water, the water quality improves.
Stopping:
When the TDS value drops below 500 ppm, the Arduino closes the relay and stops the pump.
The buzzer is also turned off and the alarm is stopped.
This system constantly monitors the quality of the water and automatically starts the purification process when it exceeds a certain level and gives an alarm to the user. In this way, the quality of the water can be monitored at all times and automatically improved when necessary.
Circuit
Circuit diagram
Arduino:
5V -> Breadboard pozitive
GND -> Breadboard negative
TDS Sensor:
VCC -> Arduino 5V(in breadboard)
GND -> Arduino GND(in breadboard)
Analog Pin -> Arduino A0
Role Module:
IN -> Arduino D8
VCC -> Arduino 5V(in breadboard)
GND -> Arduino GND(in breadboard)
Buzzer:
Positive -> Arduino D9
Negative -> Arduino GND(in breadboard)
LCD Screen:
VCC -> Arduino 5V(in breadboard)
GND -> Arduino GND(in breadboard)
SDA -> Arduino A4
SCL -> Arduino A5
Water pump:
It is connected to 12V DC power supply via relay.
Code
//CPP code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// LCD display
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int tdsSensorPin = A0;
const int relayPin = 8;
const int buzzerPin = 9;
void setup() {
pinMode(tdsSensorPin, INPUT);
pinMode(relayPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
lcd.begin();
lcd.backlight();
Serial.begin(9600);
}
void loop() {
int tdsValue = analogRead(tdsSensorPin);
float voltage = tdsValue * (5.0 / 1024.0);
float tds = (133.42 * voltage * voltage * voltage - 255.86 * voltage * voltage + 857.39 * voltage) * 0.5;
lcd.setCursor(0, 0);
lcd.print("TDS Value:");
lcd.setCursor(0, 1);
lcd.print(tds);
Serial.print("TDS Value: ");
Serial.println(tds);
if (tds > 500) {
digitalWrite(relayPin, HIGH);
digitalWrite(buzzerPin, HIGH);
} else {
digitalWrite(relayPin, LOW);
digitalWrite(buzzerPin, LOW);
}
delay(1000);
}
Explanation
TDS Sensor: Measures the amount of total dissolved solids in the water.
Role and Pump: When the quality of the water drops below a certain level (TDS > 500 ppm), it starts to purify the water by turning on the pump.
Buzzer: It gives an alarm when the water quality deteriorates (TDS > 500 ppm).
LCD Screen: Shows the TDS value of water.
With this system, you can monitor the quality of the water and automatically purify it when it rises above a certain level.