Arduino Based Part Fill Automatic Valve
Part Fill valves are widely used in Rainwater tanks. The valve will open once the water level in the tank has fallen to a low position, this allows the town mains water to enter the tank and, when the water level reaches the minimum level, the valve closes. This arrangement is used to maintain a minimum volume of town mains water in the tank for use with the pump, while leaving most of the tank empty waiting for rain to fill it to the top.
Wanna learn more about the Arduino platform? If you have an irresistible temptation to do some experiments using Arduino microcontroller, just try this simple “electronic” version of a “part fill” valve, wired using an Arduino, a standard hobby servo, and a home-made water sensor. When the Arduino notices the water level inside the rainwater tank is very low , it commands the servo to let the water flow from an alternate source!
Here two pieces of stiff wire is used to sense the conductivity in the gap between the water sensor points. When there is more water, there is a higher conductivity. Arduino reads this conductivity, and at the level set by the sketch, turns the servo to release or constrict the flow of water. Needless to say, you should make your own water sensor pad using short-length of closely spaced wires, needles or solder pads. Besides, little skill and patience required to hook up the servo horn with the existing/new valve. The servo horn should crook the town mains water inlet valve open/close to control the flow of water. Zip ties can be used to secure the mechanical connection. Once in situ, try to hot glue the servo.
Carefully position the water sensor, make good interconnections, connect up the power source and double check all connections. After the tryout, just make sure that town mains water is not leaking out through the servo controlled valve.Note: The analog input (0) of the arduino is connected to a “gimmick” potential divider comprising of R1 and the water sensor. Due to component tolerences, slight tweaking of the sketch ( altering the value “500” in the line : if (input_val < 500) { ) may become necessary. For this, run your program while plugged into the computer and click the serial monitor button on the Arduino IDE to display an outturn of the values. Put the water sensor in a mug of water and use that reading to preset your system.
/*Analog IN Pin 0 grounded (Gnd) through 10K (R1)
Sensor Input Port 1 = Analog IN Pin 0
Sensor Input Port 2 = Vcc 5V
Miniservo Pulse = Digital Pin PWM 9
Miniservo + to Vcc 5V & 0V to Gnd */
#include <Servo.h>
Servo miniservo;
int inputSensor = 0;
int input_val;
void setup() {
Serial.begin(9600); //open serial port
miniservo.attach(9);
}
void loop() {
input_val = analogRead(inputSensor); // read the value from the input sensor
Serial.print("input sensor reads ");
Serial.println( input_val );
delay(1000);
if (input_val < 500){
miniservo.write(170); // see text to tweak the input value
} else {
miniservo.write(0);
}
}