Wednesday, 6 May 2020

CoViD-19 Social Distance Enforcing Device

Hope you are keeping safe in 2020!
Social distancing is one of the top recommended ways to stop the spread of CoViD-19 disease by the WHO. It is also important to make sure that this is enforced at all times as people can be absent minded or accidentally come close to each other. This is especially true in crowded areas like hospitals and work places.


To mcontinuously onitor and enforce this I have come up with a simple ESP based  device. The idea is to provide everyone working in one location with this device that will continuously monitor if there is a similar device around them. If there is another similar distance around them close to a preset distance of roughly 1 meter or 3 meters according to the regulations in the location and use of PPE, the device will light up or ring loudly alerting the wearer to move away from the location or to be extra cautious.

The Device

The device that I have used is a WeMos ESP8266 device powered through the computer. This will be powered by a battery for the industrial version. Each ESP8266 device will be broadcasting its own Wi-Fi hotspot using the soft access point function. Thereafter, each device will also be listening in to the Wi-Fi signals in the surroundings. If there is a Wi-Fi signal in the surroundings from a similar device with a high signal strength, the built in LED is switched on.

I have tested this out with 6 WeMos devices that I currently had at home and this was a moderate success. There is a maximum delay of about 5 seconds to switch on the LED in the worst case, but the general response is within 1 second. 



The Code

/*  Author - John Samarasinghe
 *  Creation Date: 2020.05.04
 *  
 *  @iamJohnnySam
 */
#include <ESP8266WiFi.h>
#define THRESHOLD 65
#define WATCH "CovidWatch-0005"
void setup(){
  Serial.begin(115200);
  pinMode(LED_BUILTIN, OUTPUT);
  boolean result = WiFi.softAP(WATCH, "administrator");
  if(result != true) while(1);
}
void loop(){
  int numberOfNetworks = WiFi.scanNetworks();
  digitalWrite(LED_BUILTIN, HIGH);
 
  for(int i =0; i<numberOfNetworks; i++){
    int strength = WiFi.RSSI(i) + THRESHOLD;
    String ssid = WiFi.SSID(i);
    
    if ((strength >= 0) and (ssid.substring(0,5) == "Covid")){
      Serial.print("Watch ID ");
      Serial.print(ssid.substring(11,15));
      Serial.println(" is too close to me!");
      digitalWrite(LED_BUILTIN, LOW);
    }
    else if (ssid.substring(0,5) == "Covid"){
      Serial.print("Watch ID ");
      Serial.print(ssid.substring(11,15));
      Serial.print(" is close... ");
      Serial.println(WiFi.RSSI(i));
    }
  }
  Serial.println("-----------------------");
  delay(1000);
}

Further Development

  • The code can be definitely improved for better detection
  • Battery module and recharging module needs to be added for portability
  • The device can be miniaturized when moving to the bare version of the ESP8266
Please keep me updated if any of you have built this and made improvements for industrial use!

No comments:

Post a Comment