Requirements

Hardware:

  • 16×2 I2C LCD Display
  • NodeMCU Board
  • 4 Female to Female Jumper Wires
  • USB to Micro USB Cable

Software:

  • Arduino IDE (Latest version)
  • Liquid Crystal Display I2C Library
  • Thingspeak Account

Circuit Connections

Connect the LCD Display with NodeMCU according to the circuit diagram shown below:

Connections:

                     LCD GND to GND of NodeMCU
                    LCD VCC to 3V of NodeMCU
                    LCD SCL to D1 of NodeMCU
                    LCD SDA to D2 of NodeMCU

Create an API using Thingspeak

Steps:

  1. Open the Website you want to get the data from in chrome or Firefox. For India, I’ll use www.mohfw.gov.in
  2. Select the part of the data you want and right-click on it, click on ‘Inspect’ after right-clicking.
  3. Now in the HTML layout window, you will find the selected part highlighted. Now right click on the highlighted part and go to ‘Copy’ and click on “COPY XPATH”.
  4. Login to your Thingspeak account under the name “Apps” select “ThingHTTP” you will arrive at the following page.
  5. Now create a new ThingHTTP by clicking on the button in Green.
  6. Give it a name. I’ll give it as “COVID19 Cases India” in the name field.
  7. Now paste the XPath copied in Step 3 in the “Parse String” field at the end of the page. Then to the same URL append “/text()” at the end.
  8. Now paste the website URL in the “URL” field that you had opened in Step 1. In my case, it is “www.mohfw.gov.in” .
  9. Save the ThingHTTP by clicking the button at the end of the page.
  10. you will get the API as shown in above Video.
  11. copy the API you have received and paste it in new tab. You must get the data as shown video

Flashing Arduino code to NodeMCU

Steps:

  1. Include the following Libraries:
  2. In the following code replace “SSID” and “Password” values with your WIFI and Password.
  3. now copy the 16 digit API key from ThingHTTP site and paste it in the “XXXXXXXXXXXXXX” part. Generate a different API key for different data and paste it in their respective section. Like I’ve done there for cases, death and recovered.
  4. Now connect your NodeMCU to your PC and select the board as NodeMCU 1.0 (Tools -> Board “NodeMCU 1.0 (ESP-12E Module)” -> NodeMCU 1.0 ).
  5. Now select the Right Port for your NodeMCU and upload the code by clicking the upload button.

Results

Bitnami