HOMEVIDEOSCOURSESSTUDENTSSPONSORSDONATIONSEVENTSTUTORIALSLINKSNEWSCONTACT


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.
Arduino UNO - RO Water Purifier Controller

Here is my detailed Youtube VLOGs (and a followup) of the same and the Arduino UNO device driver code:
/* 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:


☆ Tutorials :: Arduino UNO Projects ↗


☆ Tutorials :: Network Software Development ↗


☆ Tutorials :: Research and Projects ↗


☆ Tutorials :: Linux (user-space), Systems Architecture ↗


☆ Tutorials :: Linux Kernel Software Development ↗


☆ Tutorials :: Linux Kernel Internals (PDFs) - by Ramin Farajpour ↗


☆ Tutorials :: Software Development (Programming) Tools ↗


☆ Tutorials :: Embedded Projects ↗

Join The Linux Channel :: Facebook Group ↗

Visit The Linux Channel :: on Youtube ↗


💗 Help shape the future: Sponsor/Donate


Recommended Topics:
Featured Video:
Watch on Youtube - [387//0] x263 Inline Programming | Assembly | Scripts | php, python, shell, etc | Rust in Linux Kernel ↗

libpcap Library | Linux User-space Network Stack Development ↗
Sunday' 06-Aug-2023
libpcap is a very popular user-space networking library, with which you can capture and or generate packets. libpcap is the underlying framework for many popular packet capture tools such as tcpdump, Wireshark and so on. In fact libpcap is a part of tcpdump project. But besides just using it as a packet capture tool, you can use libpcap in various applications, such as user-space based networking stack development, etc. In some cases libpcap is yet another alternative to raw-sockets and tun/tap interfaces.

The Linux Channel :: Sponsors ↗
Monday' 30-May-2022
Here is a list of all The Linux Channel sponsors/donors (individual/companies).

Inline Programming | Assembly | Scripts | php, python, shell, etc | Rust in Linux Kernel ↗
Friday' 12-May-2023
Inline programming is a technique where code statements are included directly in the text of a program, instead of being contained in separate files or modules. Inline programming can be useful for small or simple tasks, as it can eliminate the need for a separate script or function. One common example of inline programming is using JavaScripts, Php, etc in HTML documents to create dynamic content. Similarly in Linux Kernel we can find lot of instances where we can find inline programming such as inline assembly and now Rust within the Kernel source.

Linux Kernel /sysfs Interface ↗
Saturday' 14-May-2022
/sysfs is one of the most popular kernel to user-space interface which you can leverage to add an interface to your Kernel code such as Kernel modules, Kernel Device Drivers, etc. Although personally I prefer /proc interface than other alternatives such as /sysfs, ioctl() and so on for my personal Kernel modules/stack. So here is my detailed multi-episode Youtube video series on /sysfs Interface.

Rockchip ROC-RK3566-PC from Firefly | OpenWRT ↗
Thursday' 19-Oct-2023
Here is my multi-episode video series on evaluation of Rockchip ROC-RK3566-PC from Firefly with stock OpenWRT firmware.

What is purpose of Kernel Development - Example SMOAD Networks SDWAN Orchestrator Firewall Kernel Engine ↗
Monday' 18-Jul-2022
Often aspiring students may have this question, that what is the purpose of Linux Kernel Development. Since Linux Kernel is very mature and it has almost everything one would need. Usually, we need custom kernel development in the case of any new driver development for new upcoming hardware. And this happens on and on. But at times we may also come across few features/modules/components which are already provided by the Linux Kernel which are not adequate or atleast not the way we exactly intended to use. So, this is the real-world example, sometimes no matter what Linux Kernel provides as a part of stock Kernel/OS features, sometimes we have to write our own custom kernel stack or module(s) which can specifically cater our exact needs.

Linux Kernel Driver Device Trees ↗
Tuesday' 17-Jan-2023
The Linux kernel is the backbone of the Linux operating system. A device tree is a hierarchical tree structure that describes the various devices that are present in a system, including their properties and relationships to one another. The device tree is used by the Linux kernel to identify and initialize the different devices on a system, and to provide a consistent interface for interacting with them.

Linux Kernel vs User-space - Library APIs - Linux Kernel Programming ↗
Friday' 27-Oct-2023
One of the important aspects a beginner who is into Linux Kernel space systems software development has to understand is that unlike user-space C/C++ programming, where you can freely include any library APIs via respective #include files (which are dynamically linked during run-time via those /lib .so files), in the case of Kernel space programming, these library APIs are written within the Kernel source itself. These are the fundamental APIs which we commonly use, such as memcpy(), memcmp(), strlen(), strcpy(), strcpy() and so on. So here is my detailed Youtube video episode on the same with live demo, walk-through and examples.

Porting Sample libpcap C code to Raw Sockets | User-space Network Stack Framework ↗
Monday' 04-Sep-2023
Here is my multi-episode video series where I demonstrate how you can port the my libpcap sample code, discussed in the earlier episode to raw-socket. This code should further help you to design and architect your own user-space Network stack on top of this fundamental framework.

Roadmap - How to become Systems Software Developer ↗
Friday' 13-May-2022
When you are at the beginning of your career or a student, and aspire to become a software developer, one of the avenues to choose is to become a hard-core Systems Software Developer. However it is easier said than done, since there are many aspects to it as you explore further. As a part of systems developer, you can get into core kernel space developer, kernel device drivers developer, embedded developer and get into things like board bring-up, porting, etc, or can become a user-space systems programmer, and so on. So here is my detailed multi-episode Youtube video series on Roadmap - How to become Systems Software Developer.


Trending Video:
Watch on Youtube - [452//0] x211 Code with Kiran - Live Coding | Linux Kernel Programming | Kernel Libraries | Part 3 ↗

Linux (user-space) RAW Socket Programming ↗
Thursday' 19-Oct-2023



Recommended Video:
Watch on Youtube - [194//0] x26f Porting Sample libpcap C code to Raw Sockets | User-space Network Stack Framework - Part 2 ↗