Software apps and online services
This is a very simple project on fetching data from a particular website say, temperature and weather condition via the nodemcu and using an amazing IoT platform called ThingSpeak. In addition to this, instead of simply displaying the data in the serial monitor or LCD for instance, I am displaying the data in a mobile app via the Blynk platform. To connect to the blynk app, instead of using the web based approach I am using a bluetooth module for the communication.
Below I am listing the detailed steps:
First decide what data you want from a website...this maybe your location's weather conditions or current value of oil price or anything for instance. Here I have taken data for temperature and weather condition. So, first go to any website having the required information...select the information and right click then press inspect. A lot of code will pop up, but a line of code will be selected bearing your required data.Right click on it and select copy as XPath.
Now go to https://thingspeak.com/ and create your account if you don't have one already. Go to the APPS tab and select the last option i.e ThingHTTP. In that page click New ThingHTTP and fill up atleast the following details:
Name, url, Method, Http version, Parse string.
In url, give the website address from which you want to extract data
In method, set it to GET ;Keep Http version to 1.1 and lastly in Parse String paste the data that you copied as XPath.
After completing these steps you will get a url in the right side of the page. Feel free to navigate to your url in your browser and you will find your required data.
Next is setting up your blynk app. For this please have a look at their official documentation. After installing the necessary libraries and blynk app in your mobile, create a new project, select your board, select connection type to bluetooth. In widget tab select bluetooth and LCD in Advanced mode with virtual pin V1. Soon you will receive your authentication code in your email which will be required in your code.
Finally the results....
In the code one important thing is that.. using the Blynk LCD widget in loop can cause flood error so we use timer functions. But here since I have set the delay very long this error is easily avoided. Nevertheless, timer function is a better option.
One more thing, the data that you receive from the web contains a lot of unnecessary information which can be filtered by simple programming.