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

How to Monitor Water Consumption Using Arduino

Monitoring water consumption is an essential task for managing resources efficiently, especially in areas facing water scarcity. While the topic of "Consumo Hídrico" (Water Consumption) is not directly related to Arduino, you can use Arduino to create a system that monitors and reports water usage. This can be particularly useful for households, farms, or industries aiming to optimize their water consumption.

Examples:

To create a water consumption monitoring system with Arduino, you will need a flow sensor, an Arduino board (such as Arduino Uno), and some basic electronic components. Here’s a step-by-step guide to building a simple water monitoring system:

Components Required:

  • Arduino Uno
  • Water Flow Sensor (e.g., YF-S201)
  • Jumper wires
  • Breadboard
  • Resistor (10k ohm)
  • LCD Display (optional for displaying the data)

Step-by-Step Instructions:

  1. Connect the Water Flow Sensor:

    • Connect the VCC pin of the flow sensor to the 5V pin on the Arduino.
    • Connect the GND pin of the flow sensor to the GND pin on the Arduino.
    • Connect the signal (yellow) wire from the flow sensor to digital pin 2 on the Arduino.
  2. Set Up the Arduino Code:

    • Open the Arduino IDE and write the following code to read the data from the flow sensor and calculate the water flow rate.
volatile int flowFrequency;  // Measures flow sensor pulses
unsigned int l_hour;         // Calculated litres/hour
unsigned long currentTime;
unsigned long cloopTime;

void flow()  // Interrupt function
{
   flowFrequency++;
}

void setup()
{
   Serial.begin(9600);
   pinMode(2, INPUT);
   digitalWrite(2, HIGH); // Optional Internal Pull-Up
   attachInterrupt(digitalPinToInterrupt(2), flow, RISING);  // Setup Interrupt
   sei();  // Enable interrupts
   currentTime = millis();
   cloopTime = currentTime;
}

void loop()
{
   currentTime = millis();
   // Every second, calculate and print litres/hour
   if(currentTime >= (cloopTime + 1000))
   {
      cloopTime = currentTime;  // Updates cloopTime
      // Pulse frequency (Hz) = 7.5Q, Q is flow rate in L/min.
      l_hour = (flowFrequency / 7.5) * 60;  // (Pulse frequency) / 7.5Q = flow rate in L/min
      flowFrequency = 0;  // Reset Counter
      Serial.print(l_hour, DEC);  // Print litres/hour
      Serial.println(" L/hour");
   }
}
  1. Upload the Code:

    • Connect your Arduino board to your computer using a USB cable.
    • Select the correct board and port from the Arduino IDE.
    • Upload the code to the Arduino board.
  2. Testing:

    • Once the code is uploaded, open the Serial Monitor from the Arduino IDE.
    • The flow sensor will start measuring the water flow and display the consumption rate in liters per hour.
  3. Enhancements:

    • You can add an LCD display to show the water consumption in real-time.
    • Implement data logging to keep track of daily, weekly, or monthly water usage.
    • Integrate with IoT platforms to monitor water consumption remotely.

This system provides a basic framework for monitoring water consumption using Arduino. By adapting and expanding upon this setup, you can create more sophisticated systems tailored to specific needs.

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.