tomtom643
Published © CC BY-NC

COVID-19 Forehead temperature detective gun DIYArduino+GY906

How to make a Forehead gun自製額溫槍

IntermediateProtip2,491
COVID-19 Forehead temperature detective gun DIYArduino+GY906

Things used in this project

Story

Read more

Custom parts and enclosures

forehard_gun_body_XKQMPk443f.stl

forehard_gun_body-1_cfhZ4dC6X5.stl

forehard_gun_body-2_pygYGPc282.stl

forehard_gun_cover_w25aZSnwRO.stl

Schematics

Arduino uno

img_3821_AAt14LqLe6.JPG

93440570_690345341796830_9171491357359865856_n_BrdSnz0YrY.jpg

94245875_2635033990109160_679053725569908736_n_g8qccWrVTX.jpg

LCD I2C

94257040_2469673533324681_5573377999715172352_n_nw3tqPzzkR.jpg

94337117_1105570809817410_3240521166628061184_n_bj0xO8XXv7.jpg

94349280_288359945496520_1752233505854586880_n_RwHijMvV0F.jpg

94381769_649051719005510_6076446737411604480_n_g0Rfm3hc6R.jpg

94385982_1602795249876279_3225381217931100160_n_UAH8VOgKEb.jpg

94392734_1098195813895399_7370580272720379904_n_zMcRTtvZ2e.jpg

94426540_2823242657784187_4994957458129551360_n_lYPUwSjQ9q.jpg

94455082_521990838681094_3347519560864497664_n_H4rOT8NvZ4.jpg

94506309_549997932317928_6828295756307234816_n_gbAJWKpnA3.jpg

Code

HC-SR04Forehead gun

Arduino
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_MLX90614.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
const byte trigPinA=12;//
const byte echoPinA=13;
int Average=10;//
int cm6=5.5;//
int cm5=5.2;//
int cm4=4.8;//
int cm3=4.4;//
int cm2=4.5;//
int buzzer=4;//
void setup() 
{
  lcd.begin(16,2);
  pinMode(2,INPUT_PULLUP);//Button1
  pinMode(3,INPUT_PULLUP);//Button2
  pinMode(buzzer,OUTPUT);//
  pinMode(trigPinA, OUTPUT);
  Serial.begin(9600);
  Serial.println("MLX90615 infra-red temperature sensor test");
  mlx.begin(); 
}   
void loop() 
{
  unsigned long A=pingA()/58;
  int Button1=digitalRead(2);//Button1
  int Button2=digitalRead(3);//Button2 
  if(Button1==LOW)//[Room]
  {    
    Serial.println("Room MODE");
    lcd.setCursor(2,1);
    lcd.print("[ROOM__MODE]");
    if(Button2==LOW)
    {
    lcd.setCursor(2,1);
    lcd.print("[ROOM__MODE]");  
    tone(buzzer,1000);
    delay(100);
    noTone(buzzer);
    delay(50);
    float Temp = 0;
    for(int i=0; i<Average; i++) 
    {
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temp=");  
    Temp += mlx.readObjectTempC();
    lcd.println(mlx.readObjectTempC(),1); 
    lcd.setCursor(11,0);
    lcd.print((char) 0xDF);
    lcd.print("C");               
    Serial.print("Temp: "); 
    Serial.print(mlx.readObjectTempC(),1);
    Serial.println("C");
    Serial.println();
    delay(100);
    }
    Temp = Temp/Average;
    for(int i=0;i<3;i++) 
    {
    tone(buzzer,1000);
    delay(100);
    noTone(buzzer);
    delay(50);
    }
    noTone(buzzer);
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temp=");    
    lcd.println(Temp,1);
    lcd.setCursor(11,0);
    lcd.print((char) 0xDF);
    lcd.print("C");      
    }
    if(Button2==HIGH)
    {      
    }
  }
  if(Button1==HIGH) //[Body]
  {   
    Serial.println("Body MODE");
    lcd.setCursor(2,1);
    lcd.print("[Body__MODE]");
    Serial.print("HC-SR04=");
    Serial.print(A);
    Serial.print("cm");
    delay(100);
    if(Button2==LOW)
    {
    lcd.setCursor(2,1);
    lcd.print("[Body__MODE]");  
    tone(buzzer,1000);
    delay(100);
    noTone(buzzer);
    delay(50);
    if(A>=7)
    {
    lcd.clear();
    lcd.setCursor(7,0);
    lcd.print("OL");    
    } 
    if(A==6)
    {
    float Temp = 0;
    for(int i=0; i<Average; i++) 
    {
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temp=");  
    Temp += mlx.readObjectTempC();
    lcd.println(mlx.readObjectTempC(),1); 
    lcd.setCursor(11,0);
    lcd.print((char) 0xDF);
    lcd.print("C");               
    Serial.print("Temp: "); 
    Serial.print(mlx.readObjectTempC(),1);
    Serial.println("C");
    Serial.println();
    delay(100);
    }
    Temp = Temp/Average;
    for(int i=0;i<3;i++) 
    {
    tone(buzzer,1000);
    delay(100);
    noTone(buzzer);
    delay(50);
    }
    noTone(buzzer);
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temp=");    
    lcd.println(Temp+cm6,1);
    lcd.setCursor(11,0);
    lcd.print((char) 0xDF);
    lcd.print("C");          
    }
    if(A==5)
    {
    float Temp = 0;
    for(int i=0; i<Average; i++) 
    {
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temp=");  
    Temp += mlx.readObjectTempC();
    lcd.println(mlx.readObjectTempC(),1); 
    lcd.setCursor(11,0);
    lcd.print((char) 0xDF);
    lcd.print("C");               
    Serial.print("Temp: "); 
    Serial.print(mlx.readObjectTempC(),1);
    Serial.println("C");
    Serial.println();
    delay(100);
    }
    Temp = Temp/Average;
    for(int i=0;i<3;i++) 
    {
    tone(buzzer,1000);
    delay(100);
    noTone(buzzer);
    delay(50);
    }
    noTone(buzzer);
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temp=");    
    lcd.println(Temp+cm5,1);
    lcd.setCursor(11,0);
    lcd.print((char) 0xDF);
    lcd.print("C");        
    }
    if(A==4)
    {
    float Temp = 0;
    for(int i=0; i<Average; i++) 
    {
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temp=");  
    Temp += mlx.readObjectTempC();
    lcd.println(mlx.readObjectTempC(),1); 
    lcd.setCursor(11,0);
    lcd.print((char) 0xDF);
    lcd.print("C");               
    Serial.print("Temp: "); 
    Serial.print(mlx.readObjectTempC(),1);
    Serial.println("C");
    Serial.println();
    delay(100);
    }
    Temp = Temp/Average;
    for(int i=0;i<3;i++) 
    {
    tone(buzzer,1000);
    delay(100);
    noTone(buzzer);
    delay(50);
    }
    noTone(buzzer);
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temp=");    
    lcd.println(Temp+cm4,1);
    lcd.setCursor(11,0);
    lcd.print((char) 0xDF);
    lcd.print("C");      
    }      
    if(A==3)
    {
    float Temp = 0;
    for(int i=0; i<Average; i++) 
    {
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temp=");  
    Temp += mlx.readObjectTempC();
    lcd.println(mlx.readObjectTempC(),1); 
    lcd.setCursor(11,0);
    lcd.print((char) 0xDF);
    lcd.print("C");               
    Serial.print("Temp: "); 
    Serial.print(mlx.readObjectTempC(),1);
    Serial.println("C");
    Serial.println();
    delay(100);
    }
    Temp = Temp/Average;
    for(int i=0;i<3;i++) 
    {
    tone(buzzer,1000);
    delay(100);
    noTone(buzzer);
    delay(50);
    }
    noTone(buzzer);
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temp=");    
    lcd.println(Temp+cm3,1);
    lcd.setCursor(11,0);
    lcd.print((char) 0xDF);
    lcd.print("C");      
    } 
    if(A==2)
    {
    float Temp = 0;
    for(int i=0; i<Average; i++) 
    {
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temp=");  
    Temp += mlx.readObjectTempC();
    lcd.println(mlx.readObjectTempC(),1); 
    lcd.setCursor(11,0);
    lcd.print((char) 0xDF);
    lcd.print("C");               
    Serial.print("Temp: "); 
    Serial.print(mlx.readObjectTempC(),1);
    Serial.println("C");
    Serial.println();
    delay(100);
    }
    Temp = Temp/Average;
    for(int i=0;i<3;i++) 
    {
    tone(buzzer,1000);
    delay(100);
    noTone(buzzer);
    delay(50);
    }
    noTone(buzzer);
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("Temp=");    
    lcd.println(Temp+cm2,1);
    lcd.setCursor(11,0);
    lcd.print((char) 0xDF);
    lcd.print("C");      
    }        
   }
  }
}
unsigned long pingA() 
  { 
  digitalWrite(trigPinA, HIGH);
  delayMicroseconds(10);  
  digitalWrite(trigPinA, LOW);
  return pulseIn(echoPinA, HIGH);
  }
 

Credits

tomtom643

tomtom643

1 project • 0 followers

Comments