Hello people Hello !!!!
I'm doing a little project with Arduino but grabbed a point here and can not get out.
I will explain how the system is.
It is a system to fill the water tank and the cistern, or fill the ciatern pumping the water from the street:
When the water on tank runs out, S1 is brought to HIGH state and the pump on pin 4 and the solenoid valve V2 are activated.
If for some reason the cistern water runs out, the S2 key is brought to the HIGH state and the valve V2 is turned off and valves V1 and V3 trigger with the pump on Pin 4.
So far so good. It's working.
The problem is as follows:
I want that when the cistern runs out of water. The pump is activated and the V1 and V3 solenoids too ..... but, after 30 seconds, if you have no water flow in the F1 flow sensor they stop and after 1 hour try again.
It would be something like logic.
SE S2 = HIGH
Turn on the pump (pino4) and V3 and V1 (pins 11 and 13)
but if you have no flow 30 seconds after hang up.
try again after one hour to fill the tank (s2 = LOW)
The Sketch I made is attached along with the Fritzing file.
When you turn on the pump, record the value of millis(). Keep reading the flow meter and checking the vale of milis() against the recorded value. If the difference is greater than 30,000, turn the pump off and record the value of millis() again. This time check the time each time through loop() and wait for the hour. Look at the blink without delay example in the IDE.
groundfungus:
When you turn on the pump, record the value of millis(). Keep reading the flow meter and checking the vale of milis() against the recorded value. If the difference is greater than 30,000, turn the pump off and record the value of millis() again. This time check the time each time through loop() and wait for the hour. Look at the blink without delay example in the IDE.
Hello.
When I Start the pump, the flowmeter registers 0, if there is no flow on the piping. There may be air in the piping. The arduino must register the flow until 30 seconds after pump start, if within 30 seconds no flow is detected it may turn off the pump and wait for an hour to try again. The flowmeter can be a flow switch. Signal 0 or 1.
And how can i record millis () value, what function do i need to use?
could you please show me any example.
To record the value of millis() declare a variable to store it unsigned long pumpOnTimer;, then when you want to record the time (value of millis()) assign millis() to the variable pumpOnTimer = millis();.
Please read the Reference section on millis(), the several things at a time thread pointed out by Robin2 and the blink without delay example in the IDE (File, Examples, Digital). The answer to your question is in those articles.