Thanyasit / Liquid_Flow_Meter_with_Arduino

This code is for an Arduino-based liquid flow meter using a hall-effect sensor. The flow meter is designed to measure the rate of liquid flow and display it on a Liquid Crystal Display (LCD) in liters per hour

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Liquid Flow Meter with Arduino

Description

This code is for an Arduino-based liquid flow meter using a hall-effect sensor. The flow meter is designed to measure the rate of liquid flow and display it on a Liquid Crystal Display (LCD) in liters per hour. The flow meter has a setpoint feature that allows the user to set a desired flow rate, and the meter will turn a digital output on or off based on whether the measured flow rate is above or below the setpoint.
2023

Hardware Requirements

  • Arduino board
  • Hall-effect sensor (connected to digital pin 2)
  • 16x2 LCD display (connected via I2C to pins A4 and A5)
  • 2 push buttons (connected to digital pins 4 and 5)
  • 1 LED (connected to digital pin 6)

Prerequisites

  • Wire.h: Enables communication with I2C devices.
  • LiquidCrystal_I2C.h: Provides an interface to LCD displays that use the I2C bus.

Code Overview

  • 'NbTopsFan' and 'Calc' are integer variables used to count the number of pulses from the hall-effect sensor and calculate the flow rate.
  • The 'rpm'() function is called by an interrupt whenever a pulse is detected from the hall-effect sensor. It increments NbTopsFan each time it is called.
  • The 'setup'() function initializes the pins, the LCD display, and sets the initial values of the variables.
  • The 'loop()' function reads the setpoint value from the push buttons, turns the LED on or off depending on whether the flow rate is above or below the setpoint, and updates the LCD display with the current flow rate and setpoint values.
  • The flow rate is calculated by dividing the number of pulses ('NbTopsFan') by a conversion factor of 7.5Q. The result is then multiplied by 60 to convert the flow rate from pulses per second to liters per hour. The result is stored in Calc.
  • The 'delay()' function is used to wait for a short period between iterations of the 'loop()' function.

Usage

Connect the hardware components as described above and upload the code to the Arduino board. Adjust the setpoint value using the push buttons. The LED will turn on or off depending on whether the measured flow rate is above or below the setpoint, and the LCD display will show the current flow rate in liters per hour and the setpoint value.

License

This code is licensed under the MIT License. See the LICENSE file for details.

About

This code is for an Arduino-based liquid flow meter using a hall-effect sensor. The flow meter is designed to measure the rate of liquid flow and display it on a Liquid Crystal Display (LCD) in liters per hour

License:MIT License


Languages

Language:C++ 100.0%