Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Gustavo Bertoligabriel123br
Published © GPL3+

Touch-less Hand Sanitizer

With the pandemic COVID-19, the world started to review its habits. This project presents a touch less hand sanitizer to support us!

BeginnerFull instructions provided20 hours6,462
Touch-less Hand Sanitizer

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Arduino Relay Shield
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Mini Alcohol Water/Gel Pump
×1
Optical Sensor TCRT5000
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Plastic Hose
Locksmiths

Story

Read more

Schematics

Fritzing Schematics

Code

Arduino Source code

Arduino
The arduino manages the entire product, there is only this code.
int pinRelay = 7;
int pinSensor = 5;
int pin5v = 3;
int pin5vPOT = 4;
int pinGndPOT = 6;
int pinPOT = A5;
int output_action = HIGH;
int value = 0;

 
void setup(){
    pinMode(pinRelay, OUTPUT);
    pinMode(pinSensor, INPUT);
    pinMode(pin5v, OUTPUT);
    pinMode(pin5vPOT, OUTPUT);
    pinMode(pinGndPOT, OUTPUT);
    pinMode(pinPOT, INPUT);
    digitalWrite(pinRelay, HIGH);
    digitalWrite(pin5v, HIGH);
    digitalWrite(pin5vPOT, HIGH);
    digitalWrite(pinGndPOT, LOW);
    
}
 
void loop(){
    output_action = digitalRead(pinSensor);
    value = analogRead(pinPOT);
 
    if (output_action == HIGH){ // if the sensor do not detect something close
        digitalWrite(pinRelay, HIGH); //the relay is open
    } else { //otherwise, sensor senses a hand close
        delay(500);
        digitalWrite(pinRelay, LOW); //activate the relay
        delay(value*2); // delay 
        digitalWrite(pinRelay, HIGH); //deactivate the relay
        delay(2*1000); // delay 
    }
}

Credits

Gustavo Bertoli

Gustavo Bertoli

3 projects • 8 followers
gabriel123br

gabriel123br

0 projects • 1 follower

Comments