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

Arduino UNO-Based Contactless Water Level Monitoring System with LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Contactless Water Level Monitoring System with LCD Display

Circuit Documentation

Summary

This circuit is designed to monitor water levels using a contactless water level sensor and display the readings on an I2C LCD screen. The system is controlled by an Arduino UNO microcontroller, which reads the sensor data and updates the LCD display accordingly.

Component List

Arduino UNO

LCD I2C

XKC-Y26-V Contactless Water Level Sensor

Wiring Details

Arduino UNO

LCD I2C

XKC-Y26-V Contactless Water Level Sensor

Code Documentation

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Initialisation de l'écran LCD (adresse I2C = 0x27 ou 0x3F selon votre écran)
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Définir les broches
const int waterSensorPin = A0; // Capteur connecté à A0
const int waterMaxValue = 1023; // Valeur maximale analogique pour le capteur (0-1023)

// Variables
int waterLevelRaw = 0;     // Lecture brute du capteur
float waterLevelPercent = 0.0; // Pourcentage d'eau dans le bassin

void setup() {
  // Initialisation de la communication série
  Serial.begin(9600);

  // Initialisation de l'écran LCD
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Initialisation...");
  delay(2000);
  lcd.clear();
}

void loop() {
  // Lecture du capteur de niveau d'eau
  waterLevelRaw = analogRead(waterSensorPin);

  // Conversion de la valeur brute en pourcentage (0% à 100%)
  waterLevelPercent = (waterLevelRaw / (float)waterMaxValue) * 100.0;

  // Affichage des informations sur le LCD
  lcd.setCursor(0, 0);
  lcd.print("Niveau d'eau:");
  lcd.setCursor(0, 1);
  lcd.print(waterLevelPercent, 1); // Afficher avec 1 chiffre après la virgule
  lcd.print("%");

  // Affichage des informations dans le moniteur série
  Serial.print("Niveau d'eau: ");
  Serial.print(waterLevelPercent);
  Serial.println("%");

  // Pause avant la prochaine mesure
  delay(1000);
}

This code initializes the LCD and sets up the water level sensor. In the main loop, it reads the sensor value, converts it to a percentage, and displays the value on both the LCD and the serial monitor. The loop repeats every second.