Keep Track of COVID-19 Outbreak in your country using ESP8266 12E (NodeMcu)
Hello there, I hope you are well and safe, this project uses ESP8266 12E or NodeMcu v1.0 to keep track of the virus outbreak in your country or the whole world.This project uses: ThingSpeak, especially the ThingHTTP App. And the data is retrieved from WorldOMeters.
Important !!
Please I want to inform you that after testing for a bit longer, the WorldOMeters website seems not keeping the order of the countries, so if you can access to your country data (Check update “#1 after reading the article) take it directly from there… it’s the same procedure, you copy the full address with “/” at the end, and then you look for the element to read.
The parse and data received are different but if you get the idea it will be easier for you to scrap data from a stable website.
Read the Update #1 below.
I Supposed that you have already installed ESP8266 boards on your Arduino IDE.
There are two codes below: One for using the Serial monitor only and one for the TFT RGB LCD I’ve used.
ThingSpeak stuff and data retrieve from WorldOMeters
First create an account in ThingSpeak if you haven’t. And to show you an example I’m gonna take Italy (Land of Arduino) as example.

You’ll find a lot of fields to fill but those are the important ones, put a name to the thing, and copy that URL:
https://www.worldometers.info/coronavirus/
This field is also very Important, and we’ll see how to get that value
Now you go to WorldOmeters, the CoronaVirus meter https://www.worldometers.info/coronavirus/
Look for the country you want, and do this, I have a French computer. “Le computer”
Once you open the tool, go to the right and just hover over those elements in the red square until you select the correct data to get (check two pictures).
Press right click on the element of the correct value to get and Copy XPath
And now you go back to your ThingHTTP we called it “Italy cases” and paste it in Parse String, and press “Save ThingHTTP”.
You’ll see something like this, keep in mind the string I put inside the rectangle we gonna use it later in the code, it looks something like this:
1 |
/apps/thinghttp/send_request?<span class="hljs-attribute">api_key</span>=12WW2L8UDXUZV0VA |
So you do this for the other values too, in my example I’m reading the number of recovered people and also dead people… you can remove or add other data.In the video I did the 3 of them.
Code and some stuff
Here’s the code first: Download the code here
Here you can see the links that we got from ThingHTTP and we add them as “url1” “url2″…, I’m reading the data separately… some prefer to get one single data and extract all the values, but I prefer this method.
1 2 3 |
<span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span>* url1 = <span class="hljs-string">"/apps/thinghttp/send_request?api_key=12WW2L8UDXUZV0VA"</span>; <span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span>* url2 = <span class="hljs-string">"/apps/thinghttp/send_request?api_key=LE11LAN099543GEG"</span>; <span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span>* url3 = <span class="hljs-string">"/apps/thinghttp/send_request?api_key=UW6VMKBE0W8M9OC3"</span>; |
So the basic idea of the code is that first I get the data, and this is an example of the raw data received.
Those are the Raw data I receive from the 3 URLs, and every single one of them goes from “<td style…..” until </td>.So in the code to get just the numbers that are in the rectangles, I search in the string for the symbol ” > ” and I remove it +everything before it and I store it then I search for the symbol ” < ” and I remove it + everything after it, so the String will change like this.
Using the TFT RGB LCD
So this is how it looks, this display is very nice and big enough to display everything, Of course below you’ll find the wiring required for this, the libraries and the code.
Wiring
Libraries
Here you’ll find the two libraries needed for the display:
https://github.com/adafruit/Adafruit-ST7735-Library
https://github.com/adafruit/Adafruit-GFX-Library
Code
Here you can get the code (Google Drive): Download the code here
Result
Update #1
So as I said above the website display is not stable, as it orders country’s depending on the number of cases, so here’s a first solution.
If you can access to your country’s page in the website it will be possible, let’s take Germany as example.
You click on the country in that table we’ve seen before or look for it.
https://www.worldometers.info/coronavirus/country/germany/
Go to the counter -> Right click -> Inspect
Then you do the same as before, click to expand
You paste it here “Parse String” (in ThingHTTP) as seen above
And above instead of putting the general URL as we’ve seen before you put the URL specific to Germany.
That’s all and in the code, instead of reading every data separately we read them all at once and we extract the numbers using some String functions.
Code with update
And if you compare it with the previous code they are pretty much the same all you have to do is get data and extract it.
Result
The numbers below concerns Germany and above them are Italy’s, how did I switch it’s very simple just change the URL in ThingHTTP and you’ll get the country’s numbers.
Categories
Yassine View All
Automation and Electrical Engineer, Electronics amateur trying to share my little projects.