Track COVID-19 Outbreak by ESP8266
by opengreenenergy in Circuits > Arduino
6685 Views, 20 Favorites, 0 Comments
Track COVID-19 Outbreak by ESP8266
This little gadget will help you to be up to date about the coronavirus outbreak and the situation in your country. This is an IoT based project which displays the real-time data of cases, deaths and recovered people by the coronavirus ( COVID-19 ). It uses a Wemos D1 Mini Pro board which is based on the ESP8266 Wifi module to get data from the worldometers via ThingSpeak API. I have used an 0.96" OLED display for making a dashboard for all the realtime data.
Note: I made this project for fun and learning. The COVID-19 data display in this project is completely based on information on www.worldometers.info/coronavirus/ . Follow WHO (https://www.who.int/) for COVID19 Updates.
Supplies
Prepare the Board
To make the project compact and neat, I made it by using a perforated board.
First I measure the width of the Wemos board, then cut out a piece of the perforated board slightly greater than width. I used a utility knife to cut out the perforated board.
Mount the Wemos Board ( ESP8266 )
To mount the Wemos board, you need a female straight header pin. When you purchase the straight headers, they'll be too long for the Arduino Nano. You'll need to trim them down to an appropriate length. I used a nipper to trim down it.
Then solder the female header pins to the perforated board.
Mount the OLED Display
In this project, I am using an 0.96" I2C OLED Display. So you need a 4 pins header.
Just like the previous step, trim out the header pin by a nipper.
Then solder the header pins as shown in the above picture.
Mount the Switch
The switch is required to isolate the power from the battery to the Wemos board. I am using a slide switch for this.
Solder the slide switch as shown in the above picture.
Make the Circuit
The circuit diagram for this project is very simple. The OLED display is hooked up to the Wemos board in I2C communication mode.
OLED -> Wemos
VCC -> VCC
GND - > GND
SCL-> D1
SDA -> D2
I have used 24AWG colored wires to make the circuit. Solder the wire as per the circuit diagram.
The schematic is attached below.
Downloads
Mount the Battery Holder
The power required to drive the Wemos board and OLED display are supplied by a 18650 Li-Ion battery.
First, mount a double-sided tape on the backside of the battery holder.
Then paste it on the bottom side of the perforated board. You can see the above image for it.
Then I applied hot glue all around the battery holder.
Complete the Circuit
At last, you have to complete the circuit by connecting the battery terminal to the Wemos board via the slide switch.
Connect the positive terminal of the battery holder to the Slide switch middle pin. Then connect one of the remaining two-pin of the switch to Wemos 5V pin.
Connect the negative terminal of the battery to the GND pin of the Wemos board.
ThingSpeak Settings
First, create an account in ThingSpeak and then log in to your account.
From the top menu click on the app and press “New ThingHTTP”.
You will notice a lot of blank fields but don't worry, you have to enter fill up the following three:
1. Name: Name the field as per your choice
2. URL: https://www.worldometers.info/coronavirus/
3. Parse String: In the next step, I will guide you on how to get this string.
Enter the Parse String
Go to WorldOmeters website https://www.worldometers.info/coronavirus/
Search for the country name, in my case it is India. Then click on the Country name. You will find 3 counters
1. Coronavirus Cases
2. Deaths
3. Recovered
Select the counter -> Right click -> Inspect
On the right side of the screen, just hover over those elements until you select the correct data to get. You can see the above image for a better understanding.
Then press the right click on the element and Copy XPath.
Now go back to ThingHTTP field ( Cases ) and paste it in Parse String, and press “Save ThingHTTP”.
Now you are done!
Software and Libraries
First, download the code attached below. Then download the OLED library from GitHub.
To use Wemos D1 with the Arduino library, you'll have to use the Arduino IDE with ESP8266 board support. If you haven't already done that yet, you can easily install ESP8266 Board support to your Arduino IDE by following
this tutorial by Sparkfun.
In the code, fill up your WiFi Router SSID and Password.
Then fill up the api_key for all the 3 fields.
You can refer to the above picture to get the api_key.
Once you edited your code, compile it and then upload it into your Wemos/ ESP8266 board.
Credit: The original code was written by SurtrTech, I have modified the code to fit into my requirement.
Downloads
Final Testing
After uploading the code successfully, you can go to your serial monitor. You will find the numbers as displayed on the WorldoMeters website.
Here is a short clip for testing:
https://www.instagram.com/p/B-xemNTjI2C/?utm_sourc...
Congratulations, now your little gadget is ready to use. Insert the 18650 battery into the battery holder.
Slide the switch to ON position, you will notice the CORONA virus icon on the OLED display. Then one after data will be displayed.
Thank You for reading this article.