Altogether, quite a fun challenge! My approach would be to simply have the Arduino send the pressure information by radio to a nearby house, and humans can take care of the filters and valves when needed.
jremington:
Altogether, quite a fun challenge! My approach would be to simply have the Arduino send the pressure information by radio to a nearby house, and humans can take care of the filters and valves when needed.
So the only problem with that is with sand in the filter for irrigation. During the summer months, my neighbor may have to clean out his filter housing 3-4 times a day. If he is not home, the fitler clogs, his sprinklers stop working, and sand gets pushed through the sprinklers. By adding a sediment filter with an automated flush out based on pressure at the filter head, it could possibly run all day without needing attention.
jremington:
An automatic cleanout is a challenging electromechanical problem, with the Arduino being a minor and in comparison, very simple component.
Do you care to go into a bit of detail about how an automatic cleanout is challenging?
If I had a 110V power source, a heavy duty normally closed valve operated off a relay could work, operated off a signal from the sensor. Am I missing something?
jremington:
The experience to know why this will be a challenge.
Just one of the many likely hiccups: what happens WHEN (not IF) sand or other malfunction causes the flush valve to stick open?
It is easy to come on here and say a project someone is doing is hard. The fact that there will be challenges to overcome is the main reason I like doing this kinda thing.
So, I have been looking at valves this morning, and there are a few options. Just on Amazon I have been looking at a magnetically locking solenoid valve, motorized ball valve, a plastic 12v valve.
Like I said one constraint is going to be power. Since the Arduino will just be running off a solar panel/battery/capacitor using a big heavy duty 110ac normally closed valve seems to be off the table. I like the idea of using a plastic low voltage valve because I think it will be less likely to get bound up with the fine sand in the well water.
On the other hand, if a servo motor will have enough torque to open the ball valve already installed on the bottom of the sediment filter housing, then I can make a bracket to attach it there, and do some linkage to make the servo open the ball valve.
I am still working on my code for this project, it is taking me a bit to remember the basics of writing code. I have ran into something I am not sure how to do.
So far I have the flush out valve turning opening at set threshold for 30 seconds.
Now I need to turn the yellow LED on once a pressure drop is read between the two sensors.
That yellow LED needs to stay on until one of two things happens, the board is reset (once the filter has been changed) or once the threshold for the red LED has been met.
The code for the operation of these two LED's needs to be independent of the operation of the flush out valve. What I mean (I think??) is that the code can't get stuck in the conditional statements of the LED operation, and not cycle the flush out valve if threshold is met.
/*
Automated Water Filtration System
Chris Parker
12/19/18
*/
float preVoltage; //declaring pre-filter sensor voltage
float postVoltage; //declaring of post-filter sensor voltage
float prePsi; //declaring pre-filter sensor psi
float postPsi; //declaring post-filter sensor psi
int preSensorValue = A0; //assigning pre-filter sensor to A0
int postSensorValue = A1; //assigning pre-filter sensor to A1
int readPreSensorValue; //declaring voltage of pre-filter sensor
int readPostSensorValue; //declaring voltage of post-filter senor
int yellowLED = A2; //assigning pin number to yellow LED
const int yellowLEDThresholdPsi = 5; //assigning a pressure threshold for yellow LED to illuminate
int redLED = A3; //assigning pin number to red LED
const int redLEDThresholdPsi = 10; //assigning a pressure threshold for red LED to illuminate
int flushValveSolenoid = A6; //assigning pin number to flush valve
int flushValveThresholdPsi = 50; //assinging a pressure threshold for flush out valve to open
int flushValveDelay = 30000; //assigning a delay for flush out valve
void setup() {
Serial.begin(9600); //initialize serial communication at 9600 bits per second
pinMode(preSensorValue, INPUT); //sets pre-filter sensor value as input
pinMode(postSensorValue, INPUT); //sets post-filter sensor value as input
pinMode(yellowLED, OUTPUT); //sets yellow LED as output
pinMode(redLED, OUTPUT); //sets red LED as output
pinMode(flushValveSolenoid, OUTPUT); //sets flush valve solenoid as output
}
void loop() {
readPreSensorValue = analogRead(preSensorValue); //read raw voltage from pre-filter sensor
preVoltage = (5./1023.) * preSensorValue; //calculating voltage from pre-filter sensor
prePsi = (preVoltage - 0.5) * (100.0) / (4.5 - 0.5); //caculating psi from pre-filter sensor
Serial.println("Pre-filter sensor psi is currentlty: " prePsi); //print out pre-filter sensor psi
delay(2000); //delay in between reads for stability
readPostSensorValue = analogRead(postSensorValue); //read raw voltage from post-filter sensor
postVoltage = (5./1023.) * postSensorValue; //calculating voltage from post-filter sensor
postPsi = (postVoltage - 0.5) * (100.0) / (4.5 - 0.5); //caculating psi from post-filter sensor
Serial.Println("Post-filter sensor psi is currently: " postPsi); //print out post-filer sensor psi
if (prePsi < flushValveThreshold) { //if the psi is lower than treshold
digitalWrite(flushValveSolenoid, HIGH); //open flush out valve
delay(flushValveDelay); //delay for flush out valve
digitalWrite(flushValveSolenoid, LOW); //close flush out valve
}
if (postPsi - prePsi > yellowLEDThresholdPsi) { //if the pressure drop is greater than threshold
digitalWrite(yelowLED, HIGH); //turn on the yellow LED
}
}
Thank jremington for the links. I read them and also youtubed some examples, I now understand why delay() would not work. Although it is still over my head on how to apply the principles to my project.
Maybe study a couple more examples, like this one.
Basically, it involves checking the clock to see if the proper amount of time has elapsed, and if so, do whatever needs to be done and reset the start time. You need one start time and one period for each timed process, unsigned long of course!