I have a problem with connecting 4x water flow sensors yf-s401 with arduino nano, I don't know how to connect them except pins 2 and 3.
Can anyone help me solve this problem?
I found a solution only to connect them to pins 2 and 3 and nothing else
I am sorry, but I don't understand your problem. What is stopping you from using any other of the many Arduino pins?
I think @yetimag has seen only code which uses external interrupt pins for the sensors.
@yetimag please post a link to the specs of the sensors you plan to use and also describe how they will be used and what the maximum flow will ever be.
Data sheet states:
Frequency: F = 98 * Q (L / Min)
So if the flow is 10 litres per minute, the frequency will be almost 1000 pulses per second. For 4 sensors, 4000 pulses per second.
If pin-change interrupts are used, both edges of the pulses would trigger interrupts, so 8000 interrupts per second. That is one interrupt for every 2000 clock cycles of the Nano, which should be fine I think.
This is my sensor
@PaulRB he has right, i seen only code which uses external interrupt pins for the sensors and i don;t know other way how use this code for my project which use 4x water flow sensor
Could you tell me how to use your way with pin change interrupts and water flow sensor?
at least One single example with a different pin and water flow meter sensor please.
I've had a problem with this for a long time and this forum is my last chance....
Sorry for my bad english
I recommend a library PinChangeInterrupt.h from Nico Hood. It's available through the library manager.
The syntax used is very similar as you use with external interrupts.
attachInterrupt(digitalPinToInterrupt(pin), interrupt function, MODE);
attachPCINT(digitalPinToPCINT(pin), interrupt function, MODE);
You do realise this is a community forum? No one here is getting paid to help you. But if you are willing to learn and put in some effort, there are many here who will help you for free. But in order to help, they may need to ask you a few questions...
Max flow will be about 3-4 liters, this sensor will work with a peristaltic pump.
You mention 4 sensors. Does that mean 4 pumps, as well?
There is one pump but it has 4 circuits
Can you show us your code for one or two two flow sensors using the external interrupts and your peristaltic pump.
If you have external interrupt code which functions correctly adding additional sensors with pin change interrupts will be pretty straightforward.
So, a change in one circuit setting will effect the other three? Not a good system.
Thanks guys for yours help.
I us way with attachinterrupt and detachInterrupt() and my system start working .
Thanks
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.