![controlair flow arduino controlair flow arduino](http://2.bp.blogspot.com/-3aHSQyxWoKc/U3734CpUKwI/AAAAAAAAAL4/1yWWfCjmers/w1200-h630-p-k-no-nu/flowchart.jpg)
- #Controlair flow arduino how to
- #Controlair flow arduino serial
- #Controlair flow arduino software
- #Controlair flow arduino code
- #Controlair flow arduino plus
The application is for a planted freshwater aquarium ( this is my tank).
#Controlair flow arduino how to
You can also check How to select the best water flow sensor for your project to help you find the right one.I don't know the flow rate in anything other than bubbles per second. So, the formula should be: f = 4380*Q(L/s) N/t happen to be frequency f, so: f = 450*Q(L/s) įor the YF – S402, every liter of water that flows, the Hall Sensor outputs 4380 pulses. Then we get: V_total(L) = N* 1/450(L)Īlso, the total volume of fluid flowing through the water flow sensor is equal to the water flow rate(Q - unit L/s) multiplied by time t(unit s). We take the total volume of liquid flowing through the water flow sensor at a certain time t(unit s) as V_total(unit L), and the total number of pulses detected as N. Let’s do little math here.Ĥ50 pulse for 1 liter, so each pulse means 1/450 liter water flowing through. In fact, the YF series uses a ring magnet with six alternating poles, so that for every revolution, three low levels and three high levels, i.e., three pulses, are generated.įor the YF-S201, every liter of water that flows, the Hall Sensor outputs 450 pulses.
![controlair flow arduino controlair flow arduino](http://2.bp.blogspot.com/-sCIcmMs1dPU/Tf4rTulX0BI/AAAAAAAAAZU/UPp0pWdjEig/s1600/LAMINAR+FLOW+NOZZLE+CIRCUIT.jpg)
Thus, we can establish an equation between the number of pulses and the water flow. At the same time, the number of pulses generated per revolution of the wheel is also a certain amount.
#Controlair flow arduino code
In the code section, we used the following formula, so how did this formula come about? l_hour = (flow_frequency * 60 / 7.5)Įarlier we mentioned that with each revolution of the wheel, the volume of fluid flowing through is certain. The Formula for the calculation of water flow sensor as the water through, the flow value will print to the appropriate window.
#Controlair flow arduino serial
Open the serial monitor tool and set the baud rate to 9600. Serial.print(l_hour, DEC) // Print litres/hour L_hour = (flow_frequency * 60 / 7.5) // (Pulse frequency x 60 min) / 7.5Q = flowrate in L/hour Pulse frequency (Hz) = 7.5Q, Q is flow rate in L/min. Every second, calculate and print litres/hourĬloopTime = currentTime // Updates cloopTime Unsigned char flowsensor = 2 // Sensor InputĭigitalWrite(flowsensor, HIGH) // Optional Internal Pull-UpĪttachInterrupt(0, flow, RISING) // Setup Interrupt
![controlair flow arduino controlair flow arduino](https://mikroelectron.com/ProImg/X4/b6adee53-da0b-4cc3-80f9-e4b10993067a.jpg)
Volatile int flow_frequency // Measures flow sensor pulsesunsigned Water Flow Sensor output processed to read in litres/hour The code used for both is almost the same, with only one factor to be modified. Beacause we do not have YF – S201 in our hand. The code here is for the most classic YF – S201 Water Flow Sensor. Then open your Arduino IDE and copy the code below.
#Controlair flow arduino plus
Whenever the rising edge of the pulse is detected, an interruption is triggered, counting plus one.įor more detail about interrupt please check attachinterrupt(). However, this approach is not real-time, and the program requires a certain waiting time for each execution, during which new pulses are not detected.įor such real-time demanding applications, we typically use interrupt. Count number plus one whenever a high level is read. Of course, you can use digitalread() in the LOOP function to read the output of the water flow sensor.
#Controlair flow arduino software
Water flow sensor connect with Arduino Software Code
![controlair flow arduino controlair flow arduino](https://theorycircuit.com/wp-content/uploads/2017/11/Air-flow-sensor-arduino-interfacing-298x248.png)
If you are using other Arduino board please use jumper cables to connect to the right pin. If you are using Seeeduino + Grove base shield, just plug the water flow sensor to the D2 connecter. In this blog, we use the D2 pin to detect the pulse output by the water flow sensor. Digital pin 2 for interrupt 0, and digital pin 3 for interrupt 1. There are two digital pins that can be used as an interrupt. Material Requiredįor the Atmega 328-based board like Arduino UNO and Seeeduino V4.2. How to use the water flow sensor with Arduino. Therefore, we can calculate the flow of water by counting the number of square waves(pulse). In order to explain how does the water flow work, let’s open the lid and take a look.įor every round of the wheel, the volume of water flowing through is a certain amount, as is the number of square waves output. So, how does the Hall water flow sensor work? How does the water flow sensor work? For example, the most classic water flow sensor YF-S402 and YF-S201 rely on Hall sensors. There are a variety of flow sensors of different principles, but for makers using Arduino or Raspberry Pi, the most common flow sensor is based on a Hall device. People often use water flow sensor for automatic water heater control, DIY coffee machines, water vending machines, etc. The water flow rate is the volume of fluid that passes per unit time. We use a water flow sensor to measure the water flow rate.