Please make sure that you succeeded in all the steps described here before you continue with the following instructions.
Installing all the libraries
Since the first version of this tutorial I have changed some parts of the code and turned it into a library. As a matter of fact not one library but three! But don’t get discouraged, it is easy enough to install them.Go to Sketch > Inlcude Library… > Manage Libraries… and install these three libraries:
Make sure that you always have the latest version of the libraries installed. Users have reported many issues which could be reduced to updating the library. Also make sure that you only have one version of each of the libraries installed.
Open the Weather Station Example
Save the new sketch with a good name in a location you will remember;-), but leave it open.
Wunderground API Key
In order to display up-to-date weather information we’ll need to call a service. I recently switched from Forecast.io to wunderground.com. To get the Wunderground API key go to https://www.wunderground.com/weather/api/d/pricing.html and pick the “Stratus Developer” plan. Then get your API key from this page:
If you should forget your key you can always come back and get it here. Or re-generate it just as I did after creating this screenshot;-)
Configuring the Weather Station
- Let’s start with the Wifi Settings. Replace yourssid with the name of your Wifi network and yourpassw0rd with its password. I had problems with a network that contained a dash (“-“) in the SSID. If you’re having problems consider this hint…
- Next is the update interval. In the default it is set to 600 seconds or 10 minutes in other words. In my experience this is a good value, because you don’t have unlimited requests in your free Wunderground API account…
- Now to the display settings. If you attach the display as I show on the next page you don’t have to change anything here. D3 and D4 are the pin names of the NodeMCU module. If you get compilation errors about them make sure that you have set your board to NodeMCU V1.0. If you have one of course;-). If you have another board just replace them with the proper pin number, e.g. “5” or “6”.
- Use Time Client Settings section to adjust your local time zone offset compared to UTC time zone. It allows also half an hour offset, thanks to the user who made me implement that… (Ignorance is a bliss until you get confronted with it…)
- In the Wunderground section you can now use the API key you received in the previous section. Also set the country and city of the place you want to show. To figure out which values work you can modify this URL: http://api.wunderground.com/api/3APIKEY/conditions/q/CA/San_Francisco.json and replace APIKEY with yours and “CA” and “San_Francisco” with your state or country and city.
- For the moment ignore the ThingSpeak settings. We will use them for a later extension…
Now we are almost ready to get the weather station running on the ESP8266 for the first time. But we need to wire the display to the NodeMCU first… Read the next chapter after the break…
[maxbutton id=”2″] [maxbutton id=”3″]
A ridiculous amount of coffee was consumed in the process of building this post/project. Add some fuel if you'd like to keep me going!