Introduction: Automatic Hand Sanitizer Dispenser and Thermometer

During the pandemic a lot of places have a safety protocol requiring us to measure our temperature and clean our hands with hand sanitizer. With automation, less human work is needed and reducing close contact. Implementation of automation as a safety protocol have been used in a number of places, but it still use separate machine for the temperature and hand sanitizer dispenser. This device is created in order to reduce the time it takes to complete the safety protocol by putting 2 task in 1 machine.

Supplies

Main Components :

- Arduino Uno x 1

- Micro Servo x 2

- Infra Red Sensor

- GY-90R Infrared Temperature Sensor

- LCD 16X2 I2C

- Cable

Step 1: Schematics

This is the schematics used for the project. You can see the lcd I2C, IR sensors, and Temperature sensors.

Step 2: Connect Servo and Sensors to Arduino Through LCD

Start by connecting the servo motor using cable to arduino digital, power, and ground pin. Connect the sensors and LCD to the Arduino, easier to use I2C.

Step 3: The Code

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <Adafruit_MLX90614.h>
#include <Servo.h>

Adafruit_MLX90614 mlx = Adafruit_MLX90614();
LiquidCrystal_I2C lcd(0x27,16,2);

Servo myservo;
Servo myservo2;

unsigned long previousMillis = 0;
unsigned long elapsedMillis = 0;

int pos ;
int ledState = LOW;
int debounceTime = 100;

void setup()
{
  mlx.begin();  
  lcd.init();                      
  lcd.backlight();
  myservo.attach(4);
  myservo2.attach(5);
  pinMode(9, INPUT);

  lcd.setCursor(1,0);
  lcd.print("Hello Everyone");
  lcd.setCursor(1,1);
  lcd.print("Loading. . . . .");
  delay(2000);
  lcd.clear();
  
}


void loop()
{
  Handsanit();
}

void Handsanit(){
  elapsedMillis = millis() - previousMillis;
  if(digitalRead(9) == LOW && elapsedMillis > debounceTime){
    if(ledState == HIGH){
      ledState = LOW;
      lcd.setCursor(1,0);
  if(mlx.readObjectTempC()>37){
    delay(100);
    lcd.print("suhu anda tinggi!!");
  }
  lcd.print(" NonContact ");
  lcd.setCursor(2,1);
  lcd.print("Suhu: ");
  lcd.print(mlx.readObjectTempC()+2.2);
  lcd.print("C    ");
  delay(500);
      for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'                      // waits 15ms for the servo to reach the position
    myservo2.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);   
    }
    for (pos = 40; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
                           // waits 15ms for the servo to reach the position
    myservo2.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);
    }
    }else{
      for ( ;pos <= 80; pos += 1) 
  { 
    myservo.write(pos); 
    myservo2.write(pos);              // tell servo to go to position in variable 'pos'           
    delay(5);                        
   }
    ledState = HIGH;
    lcd.setCursor(1,0);
  if(mlx.readObjectTempC()>37){
    delay(1000);
    lcd.print("Suhu Anda Tinggi!!");
  }
  lcd.print(" NonContact ");
  lcd.setCursor(2,1);
  lcd.print("Suhu: ");
  lcd.print(mlx.readObjectTempC()+2.2);
  lcd.print("C    ");
  delay(500);
    }
    previousMillis = millis();
    }
}<br>


Use this code on the arduino. For this device we use the MLX90614 and I2C library.

Step 4: Connect Servo to Hand Sanitizer Using Rope

Tie a rope to the servo and pull the rope around the hand sanitizer handle and tie it to the 2nd servo on the other side. You need a hand sanitizer with a tall bottle and with a push mechanism.

Step 5: Start Building the Case

For this project, we are using a simple cardboard box for the case. If you want to get more creative you can make the case from acrylic or even using a 3d printed case. At this step the technical step is over and you can start exploring your creativity

Step 6: Try Out the System

After all the case building and circuitry, now we can try our arduino creation. If the device is working correctly you should have a spinning servo and a working temperature display!