The ongoing COVID 19 pandemic have literally put our world to a standstill. However, in order to prevent the community spread, the need for social distancing is absolutely necessary and important. In this project, we are trying to solve the problem of crowd gathering which will make a favorable condition for the community spread of the pandemic. Referring to the highly successful #KeralaModel for Covid19, social distancing & containment were one of the major factors that helped to flatten the curve.
At present, authorities are relying on visual inspections and drones for crowd monitoring and social distancing. But these are not optimal or require remote managing. Our solution to this problem is different and unique which allows every person to contribute himself autonomously in social distancing with zero effort. This is simple to implement, but at the same time, affordable and effective also.
WorkflowDue to the explosion of technology and technology-enabled devices, all of us have easy access to a wireless device. The wireless device, be it WiFi, BLE, LoRa, ZigBee, GPS, etc, they all emit radio signals. Any signal, which is essentially an EM wave has a certain strength which depends on the distance from its source, measured as RSSI. By measuring RSSI, we will be able to estimate the distance of the device from the measured point. We use Arduino MKR WiFi 1010 for our project.
In a crowded public place, the need for social distancing is very high. In such cases, it is normal that people would switch on their WiFi or BLE while going through such places. So by measuring the RSSI emitted from the devices, we can estimate the distance to each of them. If the distance is less than a particular set threshold, an appropriate warning will be produced to indicate the same.
The indication can be done by certain warnings such as a buzzer or even an LED indication. In this project, to establish the concept, RGB LED will be used as the warning
Our solution is based on RSSI measurement. In telecommunications,received signal strength indicator (RSSI) is a measurement of the power present in a received radio signal. RSSI is usually invisible to a user of a receiving device. However, because signal strength can vary greatly and affect functionality in wireless networking,IEEE 802.11 devices often make the measurement available to users. Signal strength (also referred to as field strength ) refers to the transmitter power output as received by a reference antenna at a distance from the transmitting antenna. High-powered transmissions, such as those used in broadcasting, are expressed in dB-millivolts per meter (dBmV/m). For very low-power systems, such as mobile phones, signal strength is usually expressed in dB-microvolts per meter (dBμV/m) or in decibels above a reference level of one milliwatt (dBm). In broadcasting terminology, 1 mV/m is 1000 μV/m or 60 dBμ (often written dBu).
Normally RSSI can be measured for any wireless networks. But in out case, we measure the RSSI values of our nearby WiFi and BLE enabled broadcasting devices, especially mobile phones.
For measuring RSSI, we use the ArduinoBLE and WiFiNINA libraries of Arduino.
For Bluetooth:
#include <ArduinoBLE.h>
...
BLE.scan();
BLEDevice peripheral = BLE.available();
if (peripheral)
{
rssi_value = peripheral.rssi();
}
For WiFi:
#include <WiFiNINA.h>
#include <SPI.h>
#include <Vector.h>
...
const int SSID_COUNT = 25;
Array<int,SSID_COUNT> rssi_array;
int num_ssid = WiFi.scanNetworks();
for (int i = 0; i < num_ssid; i++)
{
rssi_array.push_back(WiFi.RSSI(i));
}
Once we have the RSSI measured, it is then quite easy to estimate the distance to the device whose RSSI was measured. Referring to the publication here, we have the RSSI distance relationship as:
RSSI = A - 10 * n * log ( d )
"d" is the undetermined distance.
"n" indicates the path loss index in a specific environment.
"A" indicates the signal strength is received from a reference node, normally at a distance of 1m.
Rearranging,
𝑑 = 10 ^ (( 𝐴 − RSSI ) / 10 * 𝑛 )
float ratio = (M_Pwr - RSSI_v)/(10 * N);
Distance = pow(10,ratio);
From the trials, getting RSSI from WiFi was far easier than that from BLE. So further steps will focus on WiFi.
The Arduino MKR WiFi 1010 will be modified just to measure the RSSI of other devices (used by nearby commuters via their WiFi-enabled devices) within its range and deploy a notification (as RGB LED indication) to the user in case if someone is closing in beyond the permissible social distance.
Setting up ArduinoIf you want to program your MKR WIFI 1010 while offline you need to install the Arduino Desktop IDE and add the Arduino SAMD Core to it. This simple procedure is done by selecting the Tools menu, then Boards and last Boards Manager, as documented in the Arduino Boards Manager page.
With the SAMD core installed, you now proceed with the driver installation.
OSX No driver installation is necessary on OSX. Depending on the version of the OS you're running, you may get a dialog box asking you if you wish to open the “Network Preferences”. Click the "Network Preferences..." button, then click "Apply". The MKR WIFI 1010 will show up as “Not Configured”, but it is still working. You can quit System Preferences.
Windows (tested on 7, 8, and 10) If you properly installed the SAMD Core, just connect the MKR WIFI 1010 to your computer with a USB cable. Windows should initiate its driver installation process once the board is plugged in.
Linux No driver installation is necessary for Linux.
In order to use the WiFi RSSI measurement features of Arduino MKR WIFI 1010, we need to install the WIFININA library
This library requires that your board has a matching firmware installed. When the library is updated, also the firmware might be updated, but it is not mandatory. To avoid any issue and ensure that you have the most up to date setup, check your WiFiNINA library with the Arduino Software (IDE) Library Manager. There is an option in the Preferences that enables the check for updates of any of the installed libraries at startup. If you haven't installed the WiFiNINA library yet, you won't get notified about its updates.
Search for the library for "wifinina", select "WiFiNINA by Arduino" and install the latest version.
Using WiFiNINA library, we are also capable of driving the onboard RGB LED.
WiFiDrv::pinMode(25, HIGH);
WiFiDrv::pinMode(26, HIGH);
WiFiDrv::pinMode(27, HIGH);
There are 3 states of operation.
Normal
: if all devices (ie, person) are outside the outer threshold, the RGB will turn to GREEN.
Warning
: if any devices (ie, person) is within the warning threshold, the RGB will turn to YELLOW.
Critical
: if any devices (ie, person) is within the inner critical threshold, the RGB will turn to RED.
Now copy-paste the sketch code from the repository in the code section.
You'll need to select the entry in the Tools > Board menu that corresponds to your Arduino board.
Select the serial device of the board from the Tools | Serial Port menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port.
Now, simply click the "Upload" button in the environment. Wait a few seconds - you should see the green progress bar on the right of the status bar. If the upload is successful, the message "Done uploading." will appear on the left in the status bar.
A few seconds after the upload finishes, you should see the on-board LED start to blink (in orange). If it does, congratulations! You've gotten your MKR WIFI 1010 up-and-running with the RSSI based Social Distancing program.
TestingFor the distance measurement, the "n" and "A" variables of the RSSI distance formulae needed to be found out.
"n" indicates the path loss index in a specific environment, which is normally the value 2.
"A" indicates the signal strength is received from a reference node, normally at a distance of 1m. For this, we took the help of an Android app named WiFi Analyzer to find the RSSI values at a unit distance for our testing phone.
The app tells us the measured RSSI and estimated distance of each WiFi unit. For our testing phone, it came around -50 ~ -57 dB. So, rounding down, A is given a value of -60.
The same testing phone was used to capture the testing visuals. Here we can see the states changing as the thresholds are broken. For easy measurements, lower thresholds were used for this testing.
ConclusionAll necessary requirements were met and the project is completed. However, this approach is not limited to Arduino MKR WiFi 1010 alone. Any wireless device can be used to measure the appropriate RSSI and achieve the same result which helps us to enable social distancing with little to zero effort.
Advantages:
- Very easy to set up
- Low cost
- Utilizes onboard capability of wireless devices
- Doesn't require any additional setup
Disadvantages:
- Public wireless networks could sometimes make the measurements identified ambiguous with persons.
https://www.hackster.io/contests/touchlessdomore/hardware_applications/12616
https://www.hackster.io/contests/touchlessdomore
https://www.who.int/india/news/feature-stories/detail/responding-to-covid-19---learnings-from-kerala
https://en.wikipedia.org/wiki/Received_signal_strength_indication
https://journals.sagepub.com/doi/10.1155/2014/371350
https://www.arduino.cc/en/Guide/MKRWiFi1010
https://www.arduino.cc/en/Reference/WiFiNINA
https://play.google.com/store/apps/details?id=com.vrem.wifianalyzer&hl=en
Comments