Direct Water Filters: Water Filters | Best Water Filters - water filter system
Double Check ValveBackflow Preventer
/* * pispi_hwt.c * * Copyright 2016 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * */#include #include #include #include #include #include #include // Define Pins#define PIN_EN_AD 7#define PIN_EN_K 8#define OFF 0#define ON 1#define WATER_LEAK_THRESHOLD 1000#define K1 0x01#define K2 0x02#define K3 0x04 // Steinhar-Hart Equation Defines for 10K Thermistor Beta 3380 Temp Sensor#define R_LOAD 10000.0#define R_ROOM_TEMP 10000.0 // for 25 Deg C#define T_BETA 3380#define T_AD_COUNTS 4095 // MCP3208 is 12 bit ADC#define ROOM_TEMP_NOM 25.0 // Prototypes void Initialize_Pi_Hardware(void);void Update_Switch(void);void Update_Water_Leak(void);void Update_Temperatures(void);void Update_Relays(unsigned char status);void Update_Analog(unsigned char channel); // Variables unsigned AN_AD[8];float Temp_Hot_Line, Temp_Cold_Line;int Switch;unsigned char Relay_Status;unsigned char Water_Leak;// mainint main(void) { wiringPiSetupGpio(); Initialize_Pi_Hardware(); digitalWrite(PIN_EN_K, HIGH); digitalWrite(PIN_EN_AD, HIGH); Relay_Status = 0; Switch = OFF; Water_Leak = OFF; while(1) { printf("Water Leak = %s \n", Water_Leak ? "ON" : "OFF"); printf("Test Switch = %s \n", Switch ? "ON" : "OFF"); printf("Cold Water Line = %0.1f Deg C \n", Temp_Cold_Line); printf("Hot Water Line = %0.1f Deg C \n", Temp_Hot_Line); printf("\n"); Update_Switch(); Update_Water_Leak(); Update_Relays(Relay_Status); Update_Temperatures(); delay(500); } return 0;}void Update_Switch(void) { Update_Analog(7); if(AN_AD[7] > 2048) { Switch = OFF; } else { Switch = ON; }}void Update_Water_Leak(void) { Relay_Status |= K3; // Turn ON Water Sense Circuit Update_Relays(Relay_Status); delay(200); Update_Analog(4); // Read Water Sense Circuit AD Counts if(AN_AD[4] > WATER_LEAK_THRESHOLD) { Water_Leak = ON; } else { Water_Leak = OFF; } Relay_Status &= ~ K3; // Turn OFF Water Sense Circuit Update_Relays(Relay_Status);}void Update_Temperatures(void) { float sample; unsigned int average; int i; // Calculate Temperature for Cold Water Line average = 0; for(i=0; i<5; i++) { // take 5 reading and average Update_Analog(5); // to smooth out the reading average += AN_AD[5]; } average = average / 5; sample = ((float)T_AD_COUNTS / average) - 1; sample = (float)R_LOAD / sample; sample = sample / (float)R_ROOM_TEMP; sample = log(sample); sample /= (float)T_BETA; sample += 1.0 / ((float)ROOM_TEMP_NOM +275.15); sample = 1.0 / sample; sample -= 273.15; Temp_Cold_Line = sample; // Calculate Temperature for Hot Water Line average = 0; for(i=0; i<5; i++) { // take 5 reading and average Update_Analog(6); // to smooth out the reading average += AN_AD[6]; } average = average / 5; sample = ((float)T_AD_COUNTS / average) - 1; sample = (float)R_LOAD / sample; sample = sample / (float)R_ROOM_TEMP; sample = log(sample); sample /= (float)T_BETA; sample += 1.0 / ((float)ROOM_TEMP_NOM +275.15); sample = 1.0 / sample; sample -= 273.15; Temp_Hot_Line = sample; // Set Alarm if Hot Water < Cold Water + 10% * Cold Water if(Temp_Hot_Line < (Temp_Cold_Line + (Temp_Cold_Line * .1))) { Relay_Status |= K2; } else { Relay_Status &= ~K2; }}void Update_Analog(unsigned char channel) { unsigned int adc, input; unsigned char buf[3]; wiringPiSPISetup(1, 100000); input = 0x0600 | (channel << 6); buf[0] = (input >> 8) & 0xff; buf[1] = input & 0xff; buf[2] = 0; digitalWrite(PIN_EN_AD, LOW); wiringPiSPIDataRW(1,buf,3); adc = ((buf[1] & 0x0f ) << 8) | buf[2]; digitalWrite(PIN_EN_AD, HIGH); AN_AD[channel] = adc;}void Update_Relays(unsigned char status) { unsigned char buf[2]; if(Switch == ON || Water_Leak == ON) { status |= K1; } else { if(Switch == OFF && Water_Leak == OFF) { status &= ~K1; } } buf[0] = status; wiringPiSPISetup(0, 100000); wiringPiSPIDataRW(0,buf,1); digitalWrite(PIN_EN_K, LOW); delay(1); digitalWrite(PIN_EN_K, HIGH); }void Initialize_Pi_Hardware(void) { // SPI CS Enable Lines pinMode(PIN_EN_AD, OUTPUT); pinMode(PIN_EN_K, OUTPUT);}
TestableDouble Check Valve
For DC Voltge inputs, the Rload resistor is removed. For voltages greater than 3.3 VDC, C2 can be replaced with a resistor creating a voltage divider between R2 and the R where C2 is.
Double check valveair brakes
The reason for toggling the power on the sense circuit is to prevent electrolysis and corrosion on the sensing elements.
Double check valvesymbol
If the hazard is considered a low hazard (such as the hazard effects only the taste and odor of the water), the State requires testing once a year.
Check valve
For instance, sprinkler and irrigation systems are required to be protected by these devices. They are normally installed near the meter in an underground box.
50mmdouble check valve
The key to this circuit (other than the RPi of course ;), is the versatile analog input circuit of the Pi-SPi-8AI. There are 8 channels using the MCP3208, each channel can be configured as a mA input, a Voltage Input, a Thermistor input, a SPST Switch input, and I modified one channel for a water leak sensor input.
The K3 output is turned on to provide a 3.3 VDC output to one of the water leak sensor terminals. After a small delay, the Channel 5 is read by the MCP3208. If there are AD counts higher than the threshold setting, then there is a water leak.
Double CheckNon ReturnValve
This system detects water leaks, measures temperatures for the Cold Water Line and Hot Water Lines, drives an audible alarm, and has a test button. Sample code in C using the Geany Compiler also provided.
A sprinkler and irrigation system that has a chemical feed requires this device. It is also commonly used in commercial establishments to protect against numerous contaminants. These devices must be installed above ground.
Ask just about anyone you know, and you will hear disaster stories of hot water tanks blowing and causing major damage. I recently had my tank blow and thankfully I had a water leak detection system installed. I needed a project for the Pi-SPi modules, here is a Hot Water Tank Leak Detector and Temperature Monitoring Project.
For instance, sprinkler and irrigation systems are required to be protected by these devices. They are normally installed near the meter in an underground box.
This is a very basic setup. The next steps are to add email alerts, a nice GUI interface, more detection points, maybe a water shut-off valve, etc.
If the hazard (substance you are protecting against) is considered a high hazard (i.e., a hazard that can cause health problems), the State requires that the device be tested twice a year. If the hazard is considered a low hazard (such as the hazard effects only the taste and odor of the water), the State requires testing once a year.
This circuit acts as a water conductivity detector, by adjusting the settings, turn on times, etc., this concept can be used for water solids content measuring, soil humidity content, etc.