divakar238
Published

Automatic hand sanitizer with temperature detection

Able to dispense limited amount of sanitizer without any delay and measure the accurate temperature of human being

IntermediateShowcase (no instructions)159
Automatic hand sanitizer with temperature detection

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
MLX90640 Thermal Camera Breakout
Pimoroni MLX90640 Thermal Camera Breakout
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
DC Motor, 12 V
DC Motor, 12 V
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Activity diagram

Code

Automatic hand sanitizer dispenser with temperature detection

C/C++
#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>

Credits

divakar238
0 projects • 0 followers

Comments