First, watch the working video and see how it works


Components used-

  • 3D printed parts
  • Ultrasonic sensor
  • Arduino Nano 
  • 12V or 24V Solenoid Valve

3D printed parts consist of 

  • Container
  • Bottom LID
  • Container lid
  • wall mount bracket
  • ultrasonic sensor holder

First, i Designed this Part which holds the Sanitizer Liquid, the goal here was to make an easy to work Dispenser so i use this generic reservoir design which have a hole at bottom, im gonna connect/add the Solenoid valve here.

This reservoir will hold liquid and solenoid valve will stop it from dropping out, we can turn ON/OFF the solenoid valve to drop the liquid. This will be done by a simple mosfet which is then connected with an arduino nano. Ultrasonic sensor will read the hand of any person and then Arduino will trigger the mosfet and valve will drop the liquid, this setup works without any PUMP, all the main work is done by Gravity.

Bottom Lid basically holds the Electronics part and solenoid valve with Ultrasonic sensor Mount.

Code is pretty basic too, it just sense anything in front of it (10CM) and activates the Mosfet and then turn it off.

int trigPin = 11; 
int echoPin = 10; 

int SOL = 13; //solenoid

void setup()
{  
pinMode(trigPin, OUTPUT); //Sensor
pinMode(echoPin, INPUT); //Sensor  
pinMode(SOL, OUTPUT);
Serial.begin(9600);
} 
void loop(){
  

long duration, distance;
 digitalWrite(trigPin, LOW);
 delayMicroseconds(2);
 digitalWrite(trigPin, HIGH);
 delayMicroseconds(5);
 digitalWrite(trigPin, LOW);
 duration = pulseIn(echoPin, HIGH);
 distance = (duration/2) / 29.1;
 Serial.print ("cm ");
 Serial.print (distance);


if (distance < 10)
{
  digitalWrite(SOL,HIGH);
}
else
  {
    //Serial.println("CLEAR");
    digitalWrite(SOL,LOW);

      }

  delay(200);
}

 this is the Lid of sanitizer reservoir which is also equipped with its own lid, this is for filling up the reservoir without removing the entire LID.