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

Arduino Mega ADK Water Level Monitoring System with LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino Mega ADK Water Level Monitoring System with LCD Display

Circuit Documentation

Summary

This circuit is designed to monitor water levels using a water sensor and display the readings on a 16x2 LCD. The core of the circuit is an Arduino Mega ADK (Rev3) microcontroller which reads the analog signal from the water sensor and processes the data to display the water level as a percentage on the LCD. The LCD's contrast is adjustable via a trimmer potentiometer. A resistor is also included in the circuit, likely for current limiting purposes.

Component List

Water Sensor

Arduino Mega ADK (Rev3)

16X2 LCD

Trimmer Potentiometer

Resistor

Wiring Details

Water Sensor

Arduino Mega ADK (Rev3)

16X2 LCD

Trimmer Potentiometer

Resistor

Documented Code

/*
 * This Arduino Sketch reads the water level from a water sensor and displays
 * the level on a 16x2 LCD. The water sensor is connected to analog pin A0,
 * and the LCD is connected using a standard 4-bit mode.
 */

#include <LiquidCrystal.h>

// Initialize the LCD with the numbers of the interface pins
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

// Define the pin for the water sensor
const int waterSensorPin = A0;

void setup() {
  // Set up the LCD's number of columns and rows
  lcd.begin(16, 2);
  // Print a message to the LCD
  lcd.print("Water Level:");
}

void loop() {
  // Read the value from the water sensor
  int sensorValue = analogRead(waterSensorPin);
  // Convert the sensor value to a water level percentage
  int waterLevel = map(sensorValue, 0, 1023, 0, 100);
  // Set the cursor to column 0, line 1
  lcd.setCursor(0, 1);
  // Print the water level to the LCD
  lcd.print(waterLevel);
  lcd.print("%");
  // Wait for a second before the next reading
  delay(1000);
}

This code is designed to run on the Arduino Mega ADK (Rev3) and assumes the wiring as detailed above. It initializes the LCD and continuously reads the water level from the sensor, displaying it as a percentage on the LCD.