Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Water Level Sensor

The Importance and Utility of Water Level Sensors

Water level sensors are essential devices used in various applications, such as aquariums, water tanks, and industrial systems. These sensors provide accurate and reliable measurements of the water level, allowing users to monitor and control the water levels effectively. By using a water level sensor, it is possible to prevent overflow or dry running, ensuring the proper functioning of the system and avoiding potential damages.

Project: Water Level Monitoring System

In this project, we will create a water level monitoring system using an Arduino and a water level sensor. The objective is to measure the water level and display it on an LCD screen. Additionally, we will implement an alarm system that alerts the user when the water level exceeds a certain threshold.

List of Components:

  • Arduino Uno
  • Water level sensor
  • LCD display
  • Buzzer
  • Breadboard
  • Jumper wires

You can find these components at the following links:

  • Arduino Uno: [link]
  • Water level sensor: [link]
  • LCD display: [link]
  • Buzzer: [link]
  • Breadboard: [link]
  • Jumper wires: [link]

Examples:

Example 1: Reading Water Level

#include <LiquidCrystal.h>

// Initialize the LCD display
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// Define the water level sensor pin
const int waterLevelPin = A0;

void setup() {
  // Set up the LCD display
  lcd.begin(16, 2);
  lcd.print("Water Level:");

  // Set the water level sensor pin as an input
  pinMode(waterLevelPin, INPUT);
}

void loop() {
  // Read the water level sensor value
  int waterLevel = analogRead(waterLevelPin);

  // Map the sensor value to a percentage
  int percentage = map(waterLevel, 0, 1023, 0, 100);

  // Display the water level percentage on the LCD
  lcd.setCursor(0, 1);
  lcd.print(percentage);
  lcd.print("%");

  delay(1000);
}

Example 2: Water Level Alarm

// Define the water level sensor pin
const int waterLevelPin = A0;
// Define the buzzer pin
const int buzzerPin = 9;

void setup() {
  // Set the water level sensor pin as an input
  pinMode(waterLevelPin, INPUT);
  // Set the buzzer pin as an output
  pinMode(buzzerPin, OUTPUT);
}

void loop() {
  // Read the water level sensor value
  int waterLevel = analogRead(waterLevelPin);

  // Check if the water level exceeds the threshold
  if (waterLevel > 800) {
    // Activate the buzzer
    digitalWrite(buzzerPin, HIGH);
    delay(1000);
    // Deactivate the buzzer
    digitalWrite(buzzerPin, LOW);
    delay(1000);
  }
}

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.