2023
- 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)
- Wire.h: Enables communication with I2C devices.
- LiquidCrystal_I2C.h: Provides an interface to LCD displays that use the I2C bus.
- '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.
This code is licensed under the MIT License. See the LICENSE file for details.