Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Mamane Kabirou OusseiniSeydou Gnali Ousman
Published

Connected Visor

A connected protective visor which helps to respect preventive measures against COVID-19.

IntermediateWork in progress6 hours8,869

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
MLX90614
×1
Buzzer, Piezo
Buzzer, Piezo
×1
9V battery (generic)
9V battery (generic)
×1
9V Battery Clip
9V Battery Clip
×1
Switch Actuator, Head for spring return push-button
Switch Actuator, Head for spring return push-button
×1
Jumper wires (generic)
Jumper wires (generic)
×1
LED (generic)
LED (generic)
×1
Resistor 221 ohm
Resistor 221 ohm
×1
Android device
Android device
×1

Software apps and online services

MIT App Inventor 2
MIT App Inventor 2
Fusion
Autodesk Fusion
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

Body

Cover

Schematics

MIT inventor design application mobile

MIT inventor Blocks code for application mobile

Project MIT inventor for application mobile (aia format)

Schematic

Code

Firmware

Arduino
#include <Wire.h>
#include <Adafruit_MLX90614.h> // adafruit library
#include <SoftwareSerial.h>

SoftwareSerial serieBT(10, 11); //RX TX define
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

const int trigPin = 4;
const int echoPin = 3;
long duration;
int distance;
int a=0;

bool Handwash = true;
bool Sound = true;

char junk;
String inputString="";
char c;
String Data;
int i=0;

unsigned long intervall2 = millis(); 


void setup() 
{
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT); 
  pinMode(5, OUTPUT); 
  pinMode(6, OUTPUT); 
  Serial.begin(9600);
  mlx.begin();  
  serieBT.begin(9600); 
  }

void loop() {
  // the bluetooth is used to configure the visor throuth the mobile application
  if(serieBT.available()){
    while(serieBT.available())
    {
      char inChar = (char)serieBT.read(); //read the input 
      inputString += inChar;        //make a string of the characters coming on serial
      }
    while (serieBT.available() > 0)  
    {
      junk = serieBT.read();
      }

    // if message is 1a the visor desactive handwash function
    if(inputString == "1a\r\n"){
      Handwash = false;
      }
    // if message is 1b the visor active handwash function
    if(inputString == "1b\r\n"){
      Handwash = true;
      }
    // if message is a the visor active the piezo speaker in the social distance function
    if(inputString == "a\r\n"){
      Sound = true;
      }
    // if message is a the visor desactive the piezo speaker in the social distance function
    if(inputString == "b\r\n"){
      Sound = false;
      }
    inputString = "";
    }
 
   else{ 
    Serial.print("ok ");
    if(millis()>intervall2+10000){ 
        serieBT.print(mlx.readAmbientTempC()); //the temperature is send every 10 second to the application to displaying
        intervall2 = millis();
        }
    fdistance();
    delay(200);
    //the function who active handwash funtion if you placed 
    if(i >8){
        if (Handwash) hand();
        else i = 0; 
        }
       }
  }

// function distanciation social 1 meter
void fdistance(){
  digitalWrite(trigPin, LOW);delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance= duration/58.2;
  Serial.println(distance);
  delay(100);
  if(distance<=100){
    digitalWrite(5, HIGH);
    if(Sound){
      digitalWrite(6, HIGH);
      }
    if (distance <10){
      i++;
      }
    }
  else if(distance> 100){
    digitalWrite(5, LOW);
    digitalWrite(6, LOW);
    }
}

//handwashing timer function (20 sec)
void hand (){
  unsigned long currentMillis = millis();
  unsigned long intervall = currentMillis + 20000; 
  i = 0;

  //the piezo speaker sound three time to warn user that he can start washing hand

  digitalWrite(6, LOW);
  delay(200);
  digitalWrite(6, HIGH);
  delay(200);
  digitalWrite(6, LOW);
  delay(200);
  digitalWrite(6, HIGH);
  delay(200);
  digitalWrite(6, LOW);
  delay(200);
  digitalWrite(6, HIGH);
  delay(200);
  digitalWrite(6, LOW);

  //20 second timer
  while(millis()<intervall)
  {
    Serial.print("hand");
    digitalWrite(5, HIGH);
    }
    
   //the piezo speaker sound three time to warn user that he can stop washing hand
  digitalWrite(6, HIGH);
  delay(200);
  digitalWrite(6, LOW);
  delay(200);
  digitalWrite(6, HIGH);
  delay(200);
  digitalWrite(6, LOW);
  delay(200);
  digitalWrite(6, HIGH);
  delay(200);
  digitalWrite(6, LOW);
  }
  

Credits

Mamane Kabirou Ousseini
1 project • 4 followers
Seydou Gnali Ousman
1 project • 3 followers

Comments