Project tutorial
Gesture Based Covid'19 Mask

Gesture Based Covid'19 Mask © GPL3+

Simple Covid'19 Mask that can be controlled by hand gestures.

  • 16 views
  • 0 comments
  • 2 respects

Components and supplies

Necessary tools and machines

Apps and online services

About this project

Description: This is a simple gesture based Covid'19 Mask that can be controlled by hand gestures. Whenever the "UP" gesture is made the mask covers the face and when "DOWN" gesture is made the mask goes down and face gets uncovered.

Object Oriented Programming

The device is programmed using Object Oriented Programming (OOP). You can use usual structural programming but OOP is preferred because its fast, flexible and easier to modify, maintain and debug. Also in OOP any attribute can be added by just inheriting the class created by the previous developer. You can learn Object Oriented C++ here.

Hardware Description


1. Arduino Pro Mini : This will be the microcontroller which will be used in this project. This will act as the brain of the device and will be used to rotate servo motors on the device. Complete guide to learn about this microcontroller can be found here and here. Electronic schematics/specs can be found here.
2. MG-90 Servo Motors: These will be used as actuators for this device. For the mask to go up these motors will rotate at an angle of 90 degrees and for the mask to go down these motors will rotate at an angle of 0 degrees. To know about how these motors work and their electronic specs refer this section. The datasheet for this kind of servo motor can be found here.
3. Ice-Cream Sticks: These will be used as the chassis for the device. Using this is optional as you can anything of your choice to make chassis for this device. But make sure that anything that you use is extremely light weight as the user has to wear this mask on his/her face.
4. GY-7620 Gesture Sensor: As the name suggest this sensor will be used to detect the hand gestures of the user. The complete tutorial on how to use this sensor as well its electronic configuration can be found here.
5. Dummy Frame: Dummy frame is nothing but a component which looks like googles or spectacles and which can be worn like spectacles.This will be the component on which the ice cream sticks will be attached onto. Now again this is optional. You can use any other component if you want in place of this frame but make sure it is quite sturdy and wearable like a dummy frame.
6. Velcro Strap: Circuit will be attached on this strap for the user's flexibility. By attaching this user can roam freely with the mask attached to his/her body.

Software Description

Arduino IDE: Arduino IDE is the only software used in this project. This IDE is used for uploading the program/code into the Arduino. The IDE compiles the C++ program and converts it into machine code which is then executed by the microcontroller. To know more about this IDE refer this source.

Note: You can use additonal softwares for this project by adding more attributes to the existing program. The softwares can be MIT app inventor, bluetooth app and many more. More information on these softwares is out of scope of this tutorial.

DIY Step by Step (More Images to be added soon......)

Step 1: Gather 9-10 Ice Cream Sticks. If you are not using a dummy frame then gather around 20 Ice-Cream Sticks.

Step 2: Make 2 pairs of H -Shape using 8 Ice-Cream sticks ( 4 sticks per pair) and then stick them two ends of the dummy frame using glue gun. Make sure that the sticks are glued perfectly.

Step 3: Attach the servo motors on both sides.(1 motor per side) Fit the motors at the bottom of the 2 vertical sticks. Fix the motors with glue gun.

Step 4: To fix the upper parallel stick to the dummy frame use glue gun or you can also use cable ties to fix them temporarily.

Step 5: Get a mask from stationary store or if you already have it well and good. Make two holes in the mask both the holes in middle vertically and 5 cm away horizontally.

Step 6: Take two more sticks and fix one end of those sticks into the two holes made earlier in step 5. Stick both their ends with glue gun.

Step 7: Fix the two other ends of those sticks to the servo motors. Use glue gun to fix those sticks on servo motors.

Step 8: Attach the Circuit made to a velcro strap and fix it to the upper chest by tightening it.

Future Implementation Ideas

Innovation doesn't stop here. There are tons of ideas to explore which can help in tackling covid'19 easily. Some of these ideas are given below:

1. Attaching Thermal Camera: A thermal camera can detect temperature in nearby surroundings. So attaching this kind of thermal camera to the mask can extends its capabilities by detecting any person who has temperature around the user. This will help the user to keep distance from these people. You can find more about the thermal cameras here.

2. Cough Sound Recognition: Sensor or any kind of machine learning algorithm can be integrated which can detect the sound of cough. This feature can be proved very valuable as this might prevent the user to get in contact with such people.

Demonstration Video

Project Demonstration


Code

Covid'19 MaskC/C++
This is the final code of gesture based covid'19 mask. You can add more attributes and functionalities to this mask by simply inheriting the class from this code.
#include <Servo.h>
#include <paj7620.h>

class Covid_19_Mask
{
  /*
   _____________________________________________________________
  |
  | Description
  | -----------
  | - Used for operating Covid_19 Electronic Mask.
  |
  |.............................................................
  |
  | Attributes
  | ----------
  | pin_1 : int
  |    -  Left servo motor signal pin number on Arduino.
  |
  | pin_2 : int
  |    -  Right servo motor signal pin nimber on Arduino.
  |
  |............................................................
  |
  | Methods
  | -------
  | set_mask()
  |       - Attaches the servo to the PWM pin.
  |
  | turn_up()
  |       - Turns on the mask motors.
  |
  | turn_down()
  |       - Detaches motors of the mask.
  |
  | turn_off()
  |       - Turns off the mask.
  |
  | execute()
  |       - Executes the mask in gesture controlled mode.
  |____________________________________________________________
  */
  
  public:
     //servo pins
     int servo_pin_1;
     int servo_pin_2;

     //Gesture constants
     uint8_t fault;
     uint8_t data;
     int GES_REACTION_TIME;
     int GES_ENTRY_TIME;
     int GES_QUIT_TIME;
     String gesture;
     String command;

     //servo instances
     Servo servo_1; // Left Servo
     Servo servo_2; // Right Servo
     
     Covid_19_Mask(int pin_1, int pin_2)
     {
      servo_pin_1 = pin_1;
      servo_pin_2 = pin_2;

      GES_REACTION_TIME = 500;
      GES_ENTRY_TIME = 800;
      GES_QUIT_TIME = 1000;
      fault = 0;
      gesture = "";
     }

     void set_mask()
     {
       /*
        _____________________________________________________________
       |
       | Description
       | -----------
       | - Sets the mask to its initial position.
       |
       |.............................................................
       |
       | Attributes
       | ----------
       |  None
       |............................................................
       |
       | Returns
       | -------
       |  None
       |_____________________________________________________________
       */
       
      Serial.begin(9600);
      servo_1.attach(servo_pin_1, 500, 2500);
      servo_2.attach(servo_pin_2, 500, 2500);

      servo_1.write(90);
      servo_2.write(90);

      fault = paj7620Init();

      if(fault)
       {
        Serial.println("Error occured while initialising the mask: ");
        Serial.println(fault);
       }
      
      else
       {
        Serial.print("Mask Initilized: ");
        Serial.println("Your mask is ready to be operated by hand gestures!");
       }
     }
     
     void turn_up()
     {
        /*
        _____________________________________________________________
       |
       | Description
       | -----------
       | - Turns the mask up.
       |
       |.............................................................
       |
       | Parameters
       | ----------
       |  None
       |............................................................
       |
       | Returns
       | -------
       |  None
       |_____________________________________________________________
       */
       
      servo_1.write(90);
      servo_2.write(90);
     }

     void turn_down()
     {
       /*
        _____________________________________________________________
       |
       | Description
       | -----------
       | - Turns the mask down.
       |
       |.............................................................
       |
       | Parameters
       | ----------
       |  None
       |............................................................
       |
       | Returns
       | -------
       |  None
       |_____________________________________________________________
       */
       
      servo_1.write(150);
      servo_2.write(30);
     }

     void turn_off()
     {
       /*
        _____________________________________________________________
       |
       | Description
       | -----------
       | - Turns off the mask. To turn on the mask again press reset
       |   pin on the Arduino.
       |
       |.............................................................
       |
       | Parameters
       | ----------
       |  None
       |............................................................
       |
       | Returns
       | -------
       |  None
       |_____________________________________________________________
       */
       
      servo_1.detach();
      servo_2.detach();
     }

     String detect_gesture()
     {
       /*
        _____________________________________________________________
       |
       | Description
       | -----------
       | - Detects the gestures made by the user. This gesture detects
       |   two gestures: i) Up and ii) Down
       |
       |.............................................................
       |
       | Parameters
       | ----------
       |  None
       |............................................................
       |
       | Returns
       | -------
       |  String -> gesture
       |       - Gesture(Up or Down) in string format is returned.
       |_____________________________________________________________
       */
       
      data = 0;
      fault = 0;

      fault = paj7620ReadReg(0x43, 1, &data);

      if(!fault)
      {
      switch(data)
        {
          case GES_UP_FLAG:
             delay(GES_ENTRY_TIME);
             paj7620ReadReg(0x43, 1, &data);
             if (data == GES_FORWARD_FLAG)
               {
                gesture = "FORWARD";
                delay(GES_QUIT_TIME);
               }
             else if( data == GES_BACKWARD_FLAG)
               {
                gesture = "BACKWARD";
                delay(GES_QUIT_TIME);
               }

             else
             {
               gesture = "UP";
             }
             break;

          case GES_DOWN_FLAG:
             delay(GES_ENTRY_TIME);
             paj7620ReadReg(0x43, 1, &data);
             if (data == GES_FORWARD_FLAG)
               {
                gesture = "FORWARD";
                delay(GES_QUIT_TIME);
               }
             else if( data == GES_BACKWARD_FLAG)
               {
                gesture = "BACKWARD";
                delay(GES_QUIT_TIME);
               }

             else
             {
               gesture = "DOWN";
             }
             break;
         }
      }
      return gesture;
    }

     void operate()
     {
       /*
        _____________________________________________________________
       |
       | Description
       | -----------
       | - Starts the mask.
       |
       |.............................................................
       |
       | Parameters
       | ----------
       |  None
       |............................................................
       |
       | Returns
       | -------
       |  None
       |___________________________________________________________
       */
       
       command = detect_gesture();
       if(command == "UP")
       {
          turn_up();
       }

       else if(command == "DOWN")
       {
          turn_down();
       }
     }
};


//Declare the class object here.
Covid_19_Mask mask(3,5);

void setup() 
{ 
  mask.set_mask();
}

void loop() 
{
  mask.operate();
}

Schematics

GY-7620 Interfacing Diagram
Interfacing gy 9620 psugh4sjmj
Servo Motor Interfacing
Servo interfacing yjt0hkhlfa

Comments

Similar projects you might like

UV-C Based Germs Disinfecting Machine

Project tutorial by Yeshvanth Muniraj

  • 6,668 views
  • 5 comments
  • 15 respects

The Sorcerer's Door

Project showcase by Varun walimbe

  • 1,508 views
  • 0 comments
  • 5 respects

Gesture Based Media Player Controller Using Arduino

Project tutorial by Jithin Sanal

  • 4,306 views
  • 0 comments
  • 10 respects

Gesture Based Wireless Gaming Console

Project tutorial by Xolcano Technologies

  • 3,692 views
  • 0 comments
  • 4 respects

Simple Gesture Controlled Robot Using Arduino

Project tutorial by Jithin Sanal

  • 15,269 views
  • 2 comments
  • 36 respects

Hand gesture control wheelchair for disabled people

Project tutorial by afsh_ad

  • 11,815 views
  • 15 comments
  • 34 respects
Add projectSign up / Login