Jaspal Singh Kushwaha
Published

Touchless Soap + Water & Sanitizer Dual-Mode Dispenser

Multipurpose dispenser made from components of water purifier, scrap & hardware to use either soap+water or sanitiser dispensing

BeginnerFull instructions provided5 hours257
Touchless Soap + Water & Sanitizer Dual-Mode Dispenser

Things used in this project

Hardware components

ESP32S
Espressif ESP32S
ESP32 DEV KIT
×1
Grove - 2-Channel SPDT Relay
Seeed Grove - 2-Channel SPDT Relay
I have used 4 channel relay in which only 2 channels were utilised
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
SOLENOID VALVE
VALVE IS USED IN ALL KIND OF WATER PURIFIER AND WAS AVAILABLE IN LOCKDOWN ( AS WATER PURIFIER REPAIR SERVICES WERE OPEN AS ESSENTIAL SERVICES)
×2
5V 2.5A Switching Power Supply
Digilent 5V 2.5A Switching Power Supply
×1
24 V, 2A POWER SUPPLY
×1
Female/Female Jumper Wires
Female/Female Jumper Wires
×1
ON OFF SWITCH
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Resistor 330 ohm
Resistor 330 ohm
×1
resistance 2k
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
HACK SAW
Plier, Long Nose
Plier, Long Nose
Multitool, Screwdriver
Multitool, Screwdriver
Mastech MS8217 Autorange Digital Multimeter
Digilent Mastech MS8217 Autorange Digital Multimeter

Story

Read more

Schematics

Schematic - Dual Mode Touchless Soap+Water / Sanitiser Dispenser

Use this schematics for connection of sensor, switches, valves & relays with ESP32

Code

Code for Dual Mode Soap+Water and Sanitiser Dispenser

C/C++
This code can to uploaded to ESP32 directly through Arduino IDE
/*
 TOUCHLESS DUAL MODE SOAP+ WATER AND SANITIZER DISPENSER
=========================================================
 CREATED BY JASPAL SINGH KUSHWAHA, BHOPAL, INDIA
 ========================================================
 NOTE: DISPENSING TIME DELAY CAN BE ADJUSTED AS PER USER 
 REQUIREMENT,SUCH AS 20 SECOND SOAP  AND WATER DISPENSING 
 CYCLE, OTHER NUMEROUS OPTION CAN BE TRIED AND FIT TO USE
 THIS CODE IS THE BEST CASE AND PUT TO USE, NO PROBLEM 
 FACED TILL DATE.
 ========================================================  
*/

long duration, inches, cm;

const int pingPin = 16; // Trigger Pin of Ultrasonic Sensor
const int echoPin = 17; // Echo Pin of Ultrasonic Sensor

int watervalve  = 32; // SOLENOID VALVE FOR WATER SUPPLY
int soapvalve = 33;   // SOLENOID VALVE FOR LIQUID SOAP
int modes = 25;       // MODE SWITCH FOR SOAP+WATER OR SANITISER DISPENSING

int soaprange = 10;   // DISTANCE TO ACTIVATE SOAP VALVE
int waterrange =25;   // DISTANCE TO ACTIVATE WATER VALVE


void setup()

{
Serial.begin(115200); // STARTING SERIAL TERMINAL

pinMode(pingPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(watervalve, OUTPUT);
pinMode(soapvalve, OUTPUT);
pinMode(modes, INPUT);


}

void loop()
{

ping();           // READ DISTANCE OF HAND
Serial.print(cm);
Serial.println("cm1");
int modesanitize =digitalRead(modes);
Serial.println(modesanitize);
Serial.print("=mode");

if(modesanitize ==LOW) //SOAP + WATER MODE
     {
      ping();
      
      Serial.print(cm);
      Serial.println("cm");
      
      if(cm <= waterrange && cm >16 ) // RANGE FOR WATER VALVE OPERATION
        {
        digitalWrite(watervalve, LOW);
        digitalWrite(soapvalve, HIGH);
        Serial.println("Water supply ON");
        delay(1500);
        }
        else
        {
        digitalWrite(watervalve, HIGH);
        Serial.println("Water supply OFF");
        }
              if(cm <= 15 && cm >2)   RANGE FOR SOAP VALVE OPERATION
              {
              digitalWrite(soapvalve, LOW);
              digitalWrite(watervalve, HIGH);
              Serial.println("Soap supply ON");
              delay(1500);
              }
              else
              {
          
              digitalWrite(soapvalve, HIGH);
              Serial.println("Soap supply OFF");
              }
      }

if(modesanitize == HIGH)      // SANITIZER MODE
      {
      ping();
      Serial.print(cm);
      Serial.println("cm");
      digitalWrite(watervalve, HIGH);
      
      if(cm <= waterrange && cm >20)    // RANGE FOR SOAP VALVE OPERATION
                                        //( TANK FILLED WITH SANITIZER) 
     
      {             
              digitalWrite(soapvalve, LOW);
              digitalWrite(watervalve, HIGH);
              Serial.println("Sanitizer supply ON");
              delay(1500);
              digitalWrite(soapvalve, HIGH);
              delay(2000);     
      }
      else
      {  
      digitalWrite(soapvalve, HIGH);
      digitalWrite(watervalve, HIGH);
      Serial.println("Sanitizer supply OFF");
      }
      }  
}


unsigned long ping() 

{
pinMode(pingPin, OUTPUT); // Make the Pingpin to output
digitalWrite(pingPin, LOW); //Send a low pulse
delayMicroseconds(2); // wait for two microseconds
digitalWrite(pingPin, HIGH); // Send a high pulse
delayMicroseconds(5); // wait for 5 micro seconds
digitalWrite(pingPin, LOW); // send a low pulse
pinMode(pingPin,INPUT); // switch the Pingpin to input
duration = pulseIn(echoPin, HIGH); //listen for echo

/*Convert micro seconds to Inches
-------------------------------------*/

inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
}


long microsecondsToInches(long microseconds) // converts time to a distance
{
return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds) // converts time to a distance
{
return microseconds / 29 / 2;
}

Credits

Jaspal Singh Kushwaha

Jaspal Singh Kushwaha

1 project • 0 followers
I have keen interest in IOT, Electrical Engineer with exp Manufacturing, Planning & Execution of Hydro-Electric, Thermal & Solar Plants

Comments

Add projectSign up / Login