TUTORIALS 》 Arduino UNO - RO Water Purifier Controller
Here is a Youtube VLOG of my DIY RO Water Purifier Controller done via Arduino UNO.
I want the Arduino UNO to control the RO pump, so that it pumps for a specific duration and stops automatically.
This is done via Opto-isolated 4 Channel 5V 10A Relay Board meant for Arduino UNO, Raspberry Pi or similar SoC boards which offers GPIO pins.
To this relay I have connected the RO water purifier booster pump which works at 24V DC connected via 220V AC to 24V DC power supply adaptar.
I have also connected a small active 5V buzzer to notify the progress and completion as it fills the tank/canister.
/* The Linux Channel * Code for Video Episode: 0x1eb Arduino UNO - RO Water Purifier Controller * Author: Kiran Kankipati * Updated: 03-Mar-2020 * Version: 02 */ //before writing to Arduino, do: //sudo chmod 777 /dev/ttyACM0 //Debug/Test //unsigned long SECOND = 10; unsigned long HALFSECOND = 500; unsigned long SECOND = 1000; unsigned long MIN = SECOND*60; int PIN8_SW1_ROFILTER = 8; int PIN4_SW4_BELL = 4; int PIN2_SW3_HEATER = 2; int RELAY_ON=LOW; int RELAY_OFF=HIGH; int cycle=0; void setup() { pinMode(PIN8_SW1_ROFILTER, OUTPUT); pinMode(PIN4_SW4_BELL, OUTPUT); pinMode(PIN2_SW3_HEATER, OUTPUT); } void loop() { digitalWrite(PIN8_SW1_ROFILTER, RELAY_OFF); digitalWrite(PIN4_SW4_BELL, RELAY_OFF); digitalWrite(PIN2_SW3_HEATER, RELAY_OFF); if(cycle==0) { digitalWrite(PIN4_SW4_BELL, RELAY_ON); delay(HALFSECOND); digitalWrite(PIN4_SW4_BELL, RELAY_OFF); delay(HALFSECOND); digitalWrite(PIN4_SW4_BELL, RELAY_ON); delay(HALFSECOND); digitalWrite(PIN4_SW4_BELL, RELAY_OFF); delay(HALFSECOND); //RO Filter Cycle for(int i = 0; i < 8; i++) { if(i<=6) { digitalWrite(PIN8_SW1_ROFILTER, RELAY_ON); delay(MIN*10); digitalWrite(PIN4_SW4_BELL, RELAY_ON); delay(HALFSECOND); digitalWrite(PIN4_SW4_BELL, RELAY_OFF); delay(HALFSECOND); } else if(i==7) { digitalWrite(PIN8_SW1_ROFILTER, RELAY_OFF); digitalWrite(PIN4_SW4_BELL, RELAY_ON); delay(HALFSECOND); digitalWrite(PIN4_SW4_BELL, RELAY_OFF); delay(HALFSECOND); digitalWrite(PIN4_SW4_BELL, RELAY_ON); delay(HALFSECOND); digitalWrite(PIN4_SW4_BELL, RELAY_OFF); delay(HALFSECOND); digitalWrite(PIN4_SW4_BELL, RELAY_ON); delay(HALFSECOND); digitalWrite(PIN4_SW4_BELL, RELAY_OFF); delay(HALFSECOND); } } digitalWrite(PIN8_SW1_ROFILTER, RELAY_OFF); } else { delay(MIN*1000); } //long indefinite wait cycle++; }
NOTE: I have modified, and removed that calling bell with a tiny low-voltage Active buzzer which can work as it is with Arduino output pins without relay.
And as well modified the code accordingly and refined existing code and fixed couple of bugs. I did my first field-test, seems to be working fine.
I have to do couple of more times and see.
Here is my updated code:
/* The Linux Channel * Code for Video Episode: 0x1eb Arduino UNO - RO Water Purifier Controller * Author: Kiran Kankipati * Updated: 05-Mar-2020 * Version: 03 */ //before writing to Arduino, do: //sudo chmod 777 /dev/ttyACM0 //Debug/Test //unsigned long _SECOND = 8; unsigned long HALFSECOND = 500; unsigned long SECOND2 = 2000; unsigned long SECOND = 1000; unsigned long _SECOND = 1000; unsigned long MIN = _SECOND*56; //adjusted for buzzer int PIN8_SW1_ROFILTER = 8; int PIN13_BUZZER = 13; int PIN4_SW4_BELL = 4; int PIN2_SW3_HEATER = 2; int RELAY_ON=LOW; int RELAY_OFF=HIGH; int cycle=0; void setup() { pinMode(PIN8_SW1_ROFILTER, OUTPUT); pinMode(PIN4_SW4_BELL, OUTPUT); pinMode(PIN2_SW3_HEATER, OUTPUT); pinMode(PIN13_BUZZER, OUTPUT); } void _buzzer_sequence(int count) { for(int i=0; i < count;i++) { digitalWrite(PIN13_BUZZER, HIGH); delay(SECOND); digitalWrite(PIN13_BUZZER, LOW); delay(SECOND); } } void _end_buzzer_sequence() { digitalWrite(PIN13_BUZZER, HIGH); delay(SECOND*5); digitalWrite(PIN13_BUZZER, LOW); } void loop() { digitalWrite(PIN8_SW1_ROFILTER, RELAY_OFF); digitalWrite(PIN4_SW4_BELL, RELAY_OFF); digitalWrite(PIN2_SW3_HEATER, RELAY_OFF); //digitalWrite(PIN1_BUZZER, LOW); delay(SECOND2); if(cycle==0) { _buzzer_sequence(3); //RO Filter Cycle for(int i = 1; i <=7; i++) { if(i<=7) { digitalWrite(PIN8_SW1_ROFILTER, RELAY_ON); delay(MIN*10); _buzzer_sequence(i); } } digitalWrite(PIN8_SW1_ROFILTER, RELAY_OFF); _end_buzzer_sequence(); } else { delay(MIN*1000); } //long indefinite wait cycle++; }
Featured Video:
Suggested Topics:
Join The Linux Channel :: Facebook Group ↗
Visit The Linux Channel :: on Youtube ↗
💗 Help shape the future: Sponsor/Donate
Recommended Topics:
Featured Video:
Trending Video:
Thursday' 19-Oct-2023
Recommended Video: