[adrotate banner=”7″]

 
If I recall correctly, but you can use any ground, the ground wire comes over here to one side of our voltage divider and this side. This side of the voltage divider also connects to the ground on our flow meter. Go through the resistor. This yellow wire goes back to the PI it’s our input to line 13 pin 13, and then it goes through our 4.7 cabe resistor and this yellow wire is the Hall effect switch on the sensor and that’s pretty much it from our divider let’s go look at Our plug our plug our pulse, our sensor has black, yellow and red wires and I’m. Using the same color scheme. The red wire is the 5 volts from the PI. The yellow wire is to the voltage divider and the black wire is just over here to the ground. So let’s follow this back over here. This is our flow sensor. It’S, the yff 201 it’s got a working range of 1 to 30 litres per minute and you can see the impeller inside there and it’s rather simple. It’S got an arrow on it, which tells you which way the water flows. Water comes in from the left. Side. Goes to the right side: spins the impeller there’s a little magnet on the impeller, the magnet triggers a Hall effect switch and that causes pulses to come back to the PI. We count the PI, we count the pulses. We take the time – and we know how many liters per minute and if we count the total number of pulses and, of course, to get the total liters.

Okay well, that’s it for the hardware setup, let’s, go look at the software and see how this works. Let’S. Look at the software behind this it’s, relatively simple it’s, just a couple screens of code and a lot of its comments. So Python 3 program for the yfs, 2, 0 1 flow meter and I’m going to use polling I’ve got another version that uses interrupts. This uses a nested, wiles I’ve, seen people use for loops and try to time it by using sleep and all that and yeah that that causes the program to change speed and you have to change constants and all that, depending on what your program is doing. So any little change you have to retune your program, which I don’t like that so I’m, going to use the clock. The internal clock instead input on 1013 pin 6 with ground 5 volts I’ve tried it on 3.3. It seems to work, but I get more noise. However, with 5 volts, you must use a voltage divider. This is a quick comment about the voltage. Divider I’ll show you that later and there’s a warning here, there’s no stop flow warning. So if you like, for example, these all these zeros indicate that the impeller is not turning, if you get all one, what I found is that you get erroneous readings. I’Ve tried many ways to stop it, but I can’t there’s a apparently a bug in the RPI code. I found something online about that: ok on where on word, import, the GPIO library.

Ok, we know about that. Import time insists we want sis for getting out of the program nicely and we want time. So we have a real time clock we’re going to use board numbering. I know a lot of people for the other bodies board numbering the input. Pin is going to be pin number 13 I’m going to assign that pin 13 as in these are some variables I need. This is the number of pulses per minute, so I’m, going to reset this. Every time I go around in the loop, this is the total number of pulses and I’m not going to reset that that’s, the total from the beginning of the program until the end total number of minutes, the program has been running. This is a constant, and this constant in my case is very approximate you to get good answer. You need to take your flow meter hook it up to some water run, the water into a say, a five gallon bucket and time with a stopwatch. How long it takes to fill that five gallon bucket and then you’ll have your constant, and this is a new time because I’m using I’m saving, the old and new time. So I can tell when one minute is passed and we’ll. Look at the code down here. Farther these are just comments to the user about what this is doing. This is water flow, it’s, approximate it’s, not accurate because of some of the issues.

We’Ve discussed, control c will exit nicely. We’Ll show you the code down here farther for that and let’s scroll down a couple more lines and here’s. The whole program really from here to here there’s, says two nested, while loops one here and one here and then a little bit of logic and some print out and that’s it. So this is just a loop forever statement, while true and the first thing I’m going to do is grab the time and we’re going to. We have to keep the old time of the new time. So we know that when one minute has elapsed and we’re going to use that down here in the second while loop, the rate counter we’re going to set to zero and that’s the one that we’re keeping pulses per minute. So we have to reset that every time we’re not resetting the total count, because we want to keep that as long as the program is running so here we’re checking to see if the old time the new time are different by more than a minute. If it’s more than a minute, it will go on to the next, it will jump out, come back up here and reset. So this is my 1 minute loop inside here. If you will, if the input is not equal to zero, in other words, it’s one I’m going to increment both of my counters, so the impellers gone by its triggered the hall effect, and I add one to each one – and here is a statement which all it Does is it prints these zeros and you’ll, see ones also when it’s running the zeros and ones just tell you that the impeller is turning, and so this all these zeros tell me the impeller has stopped and the Hall effect switch is not triggered at that point.

So that’s all that print statements doing, except if you hit the control C, what will happen is this will exit nicely? It will do these po clean up. It will tell you it exiting nicely: it will do the gpio clean up it’ll, do the SIS exit and exit nicely. If you do not do that, it will come down here. It will increment the total number of minutes. It will print the litres per minute. The total leaders and the time and then we’ll start back up here again and do a new minute and keep the old totals and just keep rolling around and around and around forever let’s, take a look and see how it works. What I’m going to do is going to use this plastic tube and I’m going to blow into the to the center, because it’s not a good idea that for me to be running water in that TV room, my wife will have me shot. So I will cheat a little bit I’m going to do another cheap. Also, as I set the time, see that tent over there. It should be 60 for one minute, but I don’t want to sit here for one minute and watch this thing scroll by so I’ve cheated a little bit. It’S been set to 10 seconds, so we’ll get a new reading every 10 seconds, but in normal real life. I would change that 10 to a 60. Okay, let’s run it you can see.

The impeller is turning on blowing air into it, and the zero indicates that the impeller stops. So we got 12.1 litres per minute and a total of 12.1 liters. So this time we got 4 litres added onto the old one. We got 16 point one and it will just continue to do this. Okay. So this time we’ve got forty eight point: nine sixty five total third minute the date. This time, we’ve got nine point. Eight per minute: seventy four point: eight total we’re into the fourth minute, there’s the clock and so on, and so on.

 
 

[adrotate banner=”1″]

arduino flow meter Video

[mam_video id=8JXd-2_zJQ0]

 

 

[adrotate banner=”2″]

 

[mam_tag id=4757]

 

 

[adrotate banner=”3″]

 

arduino flow meter news

 

 

 

 

 

[adrotate banner=”4″]

 

 

arduino flow meter Social

 

 

[adrotate banner=”5″]

 

 

official.arduino
2019-10-02T19:32:52+0000

👋 Want to bring Tony Stark-like gesture control to your projects? Learn how with the BLE-enabled MKR WiFi 1010 and Nano 33 BLE Sense boards using the ArduinoBLE library.
official.arduino
2019-10-02T19:08:01+0000

Arduin-yo ho ho! A fairground favorite, the pirate ship is a fun way to explore the oscillation of a pendulum. How much fun, you ask? Access our Science Kit Physics Lab preview and see for yourself: http://bit.ly/2oC6L0Q

🔬 Now that you’ve gotten your feet wet, dive into the kit and enjoy all nine experiments. Order yours today: http://bit.ly/2MnQ7fr

 

[adrotate banner=”6″]