SandroMesquitaBianoreliezerne
Published © GPL3+

COVID-19 Desinfection and Monitoring tunnel

Tunnel to Combat COVID-19 with desinfectante solution sprinkler and company access counter with real-time communication with a online system

AdvancedFull instructions provided1,142
COVID-19 Desinfection and Monitoring tunnel

Things used in this project

Hardware components

Arduino Nano 33 IoT
Arduino Nano 33 IoT
We chose this Arduino for its excellent processing and easy Internet connectivity.
×1
PIR Sensor, 7 m
PIR Sensor, 7 m
Sensor that will detect if there is movement in the entrance, in or out of the tunnel, thus activating the water pump.
×3
Buzzer
Buzzer
Buzzer to inform that there is a person in the tunnel.
×1
SparkFun RedBot Sensor - Line Follower
SparkFun RedBot Sensor - Line Follower
Sensor used to count the flow of people.
×2
Sensor Cable, Water-resistant
Sensor Cable, Water-resistant
Sensor used to measure the level of disinfectant solution in the tank.
×1
Relay Module (Generic)
Relay that has the function of starting the pump.
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
Sensor for independent use of the tunnel that will activate the alcohol dispenser for hand cleaning.
×1
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Yellow
5 mm LED: Yellow
×1
5 mm LED: Green
5 mm LED: Green
×1
Resistor 221 ohm
Resistor 221 ohm
×3

Software apps and online services

Arduino IoT Cloud
Arduino IoT Cloud
We use the Arduino IoT cloud to monitor the number of people entering and leaving the establishment, thus ensuring the maximum capacity allowed by security.

Hand tools and fabrication machines

Drill, Screwdriver
Drill, Screwdriver
Plier, Long Nose
Plier, Long Nose
Plier, Cutting
Plier, Cutting
Tape, Electrical
Tape, Electrical
Hot glue gun (generic)
Hot glue gun (generic)
Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Project Assembly Circuit

Component assembly scheme for the operation of the Disinfection Tunnel project.

PNG image of the Assembly circuit.

Non-editable image of the assembly circuit of the components of the project COVID-19 of the disinfection tunnel.

Code

Main program

Arduino
/*
   PROJECT OF SPRAY AGAINST COVID19
   Version: 4.0
   Commit: Add send to internet.
   Client: Pixels Escola de Design e Tecnologia
   Start: 6/17/2020
   Finish:
   Update:
*/

#include "thingProperties.h"

#define SensorA_  1
#define SensorB_ -1

#define DETECTADO 0

#define tempoEspera 1000

#define MAXIMO_PESSOAS_ISOLAMENTO_SOCIAL 100,00

//Definition of the Arduino pins
const byte pinInputSensor = 2; //Digital pin 2 of the Arduino connected to sense 1 (Thread blue)
const byte pinMiddleSensor = 3; //Digital pin 3 of the Arduino connected to sense 2 (Thread yellow)
const byte pinOutputSensor = 4; //Digital pin 4 of the Arduino connected to sense 3 (Thread orange)
const byte pinRelayPump = 5; //Digital pin 5 of the Arduino connected to pin Relay of Pump Water
const byte pinBuzzer = 0; //Digital pin 6 of the Arduino connected to buzzer (Thread green)
const byte pinGreenLed = 8; // Digital pin 8 of the Arduino connected to Led Green
const byte pinYellowLed = 9; // Digital pin 9 of the Arduino connected to Led Yellow
const byte pinRedLed = 10; // Digital pin 10 of the Arduino connected to Led Red
const byte pinMedLevelSensor = 11; // Digital pin 12 of the Arduino connected to Sensor of Medium Level (Thread white)
const byte pinLowLevelSensor = 12; // Digital pin 11 of the Arduino connected to Sensor of Low Level (Thread orange)
const byte pinSensorPeopleEntering = 7; // Digital pin 14 of the Arduino connected to Infrared Sensor of people entering
const byte pinSensorPeopleOut = 6; // Digital pin 15 of the Arduino connected to Infrared Sensor of people comming out.

//Definition of variables of the sensors
bool inputSensor, middleSensor, outputSensor; //Variables that keep the state of the of presence sensors
bool lowLevelSensor, medLevelSensor; //Variables that keep the state of the of water level sensors
bool sensorPeopleEntering, sensorPeopleOut; // Variables that keep the state of the Infrared Sensor that counts people.
int estadoSensores = 0;
int estadoSensoresAnt = 0;
unsigned long controleTempo;

void setup() {
  Serial.begin(9600); //Starting serial communication
  //Sets the Sensors pins
  pinMode(pinInputSensor, INPUT_PULLUP); //Define the pin 2 as input
  pinMode(pinMiddleSensor, INPUT_PULLUP); //Define the pin 3 as input
  pinMode(pinOutputSensor, INPUT_PULLUP); //Define the pin 4 as input
  pinMode(pinLowLevelSensor, INPUT_PULLUP); //Define the pin 11 as input
  pinMode(pinMedLevelSensor, INPUT_PULLUP); //Define the pin 12 as input
  pinMode(pinSensorPeopleEntering, INPUT_PULLUP); //Define the pin 14 as input
  pinMode(pinSensorPeopleOut, INPUT_PULLUP); //Define the pin 15 as input

  //Sets the Actuators pins
  pinMode(pinRelayPump, OUTPUT); //Define the pin 5 as output
  pinMode(pinBuzzer, OUTPUT); //Define the pin 6 as output
  pinMode(pinGreenLed, OUTPUT); //Define the pin 8 as output
  pinMode(pinYellowLed, OUTPUT); //Define the pin 9 as output
  pinMode(pinRedLed, OUTPUT); //Define the pin 10 as output

  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);

}//End of the setup

void loop() {

  ArduinoCloud.update();

  //Checks water level sensors
  lowLevelSensor = digitalRead(pinLowLevelSensor);
  medLevelSensor = digitalRead(pinMedLevelSensor);

  //Checks infrared sensor if passed person
  sensorPeopleEntering = digitalRead(pinSensorPeopleEntering);
  sensorPeopleOut = digitalRead(pinSensorPeopleOut);

  taxaMaximaOcupacao = float(ocupacao) / MAXIMO_PESSOAS_ISOLAMENTO_SOCIAL;
  Serial.println(ocupacao);
  Serial.println(taxaMaximaOcupacao);

  if (sensorPeopleEntering == DETECTADO && sensorPeopleOut == DETECTADO) {
    controleTempo = millis();

  } else if (sensorPeopleEntering == DETECTADO || sensorPeopleOut == DETECTADO) {

    if (sensorPeopleEntering == DETECTADO) {

      switch (estadoSensoresAnt) {
        case SensorB_ : {
            estadoSensores = 0;
            ocupacao--;
            controleTempo = millis();
            break;
          }
        case 0 : {
            estadoSensores = SensorA_;
            controleTempo = millis();
            break;
          }
        case SensorA_ : {
            estadoSensores = SensorA_;
            controleTempo = millis();
            break;
          }
      }


    }

    if (sensorPeopleOut == DETECTADO) {

      switch (estadoSensoresAnt) {
        case SensorA_ : {
            estadoSensores = 0;
            ocupacao++;
            controleTempo = millis();
            break;
          }
        case 0 : {
            estadoSensores = SensorB_;
            controleTempo = millis();
            break;
          }
        case SensorB_ : {
            estadoSensores = SensorB_;
            controleTempo = millis();
            break;
          }
      }

    }

  } else {
    if ( millis() - controleTempo > tempoEspera ) {
      estadoSensores = 0;
      estadoSensoresAnt = estadoSensores;
    }
  }

  estadoSensoresAnt = estadoSensores;

  //Logic of water level sensors: 0 --> With water | 1 --> No water

  // If both sensors are active (With water)
  if ((lowLevelSensor == 0) and (medLevelSensor == 0)) {
    digitalWrite(pinGreenLed, HIGH);
    digitalWrite(pinYellowLed, LOW);
    digitalWrite(pinRedLed, LOW);
    enabledTunnel();// Tunnel operating function
  }

  // If the medium level sensor not activated (Low water)
  if ((lowLevelSensor == 0) and (medLevelSensor == 1)) {
    digitalWrite(pinGreenLed, LOW);
    digitalWrite(pinYellowLed, HIGH);
    digitalWrite(pinRedLed, LOW);
    enabledTunnel();// Tunnel operating function
  }

  // If the low level sensor not activated (no water) but medium level sensor are active
  if ((lowLevelSensor == 1) and (medLevelSensor == 0)) {
    //Error in sensors
    digitalWrite(pinGreenLed, HIGH);
    digitalWrite(pinYellowLed, HIGH);
    digitalWrite(pinRedLed, HIGH);
    Serial.println("Level sensor in ERROR!");
    disableTunnel();
  }

  // If both sensors not activated (empty tank)
  if ((lowLevelSensor == 1) and (medLevelSensor == 1)) {
    digitalWrite(pinGreenLed, LOW);
    digitalWrite(pinYellowLed, LOW);
    digitalWrite(pinRedLed, HIGH);
    disableTunnel();// Tunnel no operating function
  }
  Serial.println("======================================================");

} //End of the loop

void enabledTunnel() {
  Serial.println("Tunnel enabled.");

  statusTunel = true;

  //Reading the status of the sensors
  inputSensor = digitalRead(pinInputSensor);
  middleSensor = digitalRead(pinMiddleSensor);
  outputSensor = digitalRead(pinOutputSensor);

  //Prints sensor readings on the serial monitor
  Serial.println("Input Sensor: " + String(inputSensor) + " | Middle Sensor: " + String(middleSensor) + " | Output Sensor: " + String(outputSensor));

  //If any of the 3 motion sensors is trigged
  if ((inputSensor == LOW) || (middleSensor == LOW) || (outputSensor == LOW)) {
    Serial.println("Detected person presence in the tunel.");
    digitalWrite(pinRelayPump, HIGH); //Start the pump
    noTone(pinBuzzer);
    tone(pinBuzzer, 440, 200);
    //delay(300);
  }

  else { //If you don't
    Serial.println("No movement in the tunel.");
    digitalWrite(pinRelayPump, LOW); //Turn off the pump
    noTone(pinBuzzer); //Disable the buzzer
    //delay(300);
  }

}//end enabledTunnel

void disableTunnel() {
  //Serial.println("Tunnel disabled.");

  statusTunel = false;

  digitalWrite(pinRelayPump, LOW); //Turn off the pump
  noTone(pinBuzzer); //Disable the buzzer
  //delay(500);
  tone(pinBuzzer, 3000, 200);
  //delay(500);
}

void onOcupacaoChange() {
  
}

void onTaxaMaximaOcupacaoChange() {

}

void onStatusTunelChange() {

}

IOT Cloud thingProperties

Arduino
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
#include "arduino_secrets.h"

const char THING_ID[] = "a73f86b0-9b74-4e9f-9deb-3236b166ee8c";

const char SSID[]     = SECRET_SSID;    // Network SSID (name)
const char PASS[]     = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)

void onOcupacaoChange();
void onTaxaMaximaOcupacaoChange();
void onStatusTunelChange();

int ocupacao;
float taxaMaximaOcupacao;
bool statusTunel;

void initProperties() {

  ArduinoCloud.setThingId(THING_ID);
  ArduinoCloud.addProperty(ocupacao, READWRITE, ON_CHANGE, onOcupacaoChange);
  ArduinoCloud.addProperty(taxaMaximaOcupacao, READWRITE, ON_CHANGE, onTaxaMaximaOcupacaoChange);
  ArduinoCloud.addProperty(statusTunel, READWRITE, ON_CHANGE, onStatusTunelChange);

}

WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);

IOT Cloud sketch.json

Arduino
{"cpu":{"fqbn":"arduino:samd:nano_33_iot","name":"Arduino NANO 33 IoT","port":""},"secrets":[{"name":"SECRET_SSID","value":"","isOptional":false},{"name":"SECRET_PASS","value":"","isOptional":false}]}

IOT Cloud arduino_secrets

Arduino
#define SECRET_SSID ""
#define SECRET_PASS ""

Credits

SandroMesquita

SandroMesquita

14 projects • 113 followers
Professor de robótica com Arduino e Raspberry, estudando e aplicando conhecimentos de I.A. usando a Linguagem Python como base.
Bianor

Bianor

10 projects • 56 followers
eliezerne

eliezerne

0 projects • 1 follower

Comments