Looking for existing code

Hello, I am not an experienced coder but have an Arduino Uno R3 project involving water flow from a pump through an 8mm line that I hope to get some code for.
The project is this: Over an ongoing period of time (indefinite / always on) a pump runs (via a 10A relay module) for 15 minutes once per hour. If water flow (using a YF-S402 or equivalent) is not detected in each 1-hour period, then another relay module becomes energized to power an alarm.
In addition to the pump operation and flow detection, the code also needs to incorporate another timer that powers a third relay module on and off every 12 hours.
Does anybody have any existing code like this they would be willing to share? Thank you.

It is extremely unlikely that anyone will have such code laying around

What hardware do you have and what code have you tried so far ?

I’ve got the Uno, pwr cable, relays, jumpers, breadboard, etc. I don’t have any code. I don't need help with the peripheral hardware (past the relays like pump, alarm,etc) and could probably figure out I/O with the Uno, I'm just hoping to get a jumpstart, maybe a big jumpstart, with the code.

all my projects are based on the BlinkWithoutDelay example.
looks like it would be a good start for you too

1 Like

My advice would be to use an RTC for the timing as it will remain stable over long periods

As @UKHeliBob said, it's unlikely that someone has the exact code you need, but it sounds simple enough that you could use it as a first learning project.

Do you care about time accuracy or just that the pump runs 15 minutes out of 60?

Accurate time is not really necessary, if I could get +/- 5 minutes per month accuracy that would be fine, I just need the pump to run for 15 (or 14 or 16; a user-defined variable) out of 60 "minutes" (fixed).

But the project is moot without incorporating a flow indicator (like a YF-S402) that's coded to do nothing if flow (any flow-doesn't matter how long) is detected within the same (or any) fixed (60) period, and provide an output signal (to a relay) if no flow has been detected within that same (60) period.

Once I get those 2 parameters working I'll worry about the "third relay" for a separate 12 hr timer.

Find out how to express "no flow" in an if-statement, then activate relay if no_flow==true.

Defined before compiling by editing the sketch or after by user input ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.