ESP8266 Weather Widget

242,773

1,022

187

Introduction: ESP8266 Weather Widget

About: I am a DIY hobbyist by passion and Power Engineer by profession. Most of my works are related to Solar Energy and Arduino. Apart from Electronics I love 3D printing, Woodworking and to make crafts from used …

[ Play Video ]

Welcome to my new Weather Widget Project.

You can find all of my projects on : https://www.opengreenenergy.com/

A weather widget is a application that can be downloaded on your PC, laptop or a mobile device and perform the job of providing easy access to weather information.But I was always trying to make something different.So I go through the internet to get some ideas.After few days of my work, finally I made it.I am sharing this so that any one can make it easily.

This is an ESP8266 based Weather Display unit which retrieve localized weather information from http://www.wunderground.com/ by WLAN and display it on a 128x64 OLED Display.

The Widget display following things

1. Current Time with Date

2. Current Day Weather Information like Temperature,Pressure,Humidity and Rain fall.

3. Future forecasting for 3 days

I would like to give credit to my friend Dani Eichhorn who did all of the programming parts.He is updating the software on his Github page regularly with new features.You can visit SquixTechBlog to see more projects on ESP8266.

Step 1: Parts and Tools Required

AmazonParts Required :

1. ESP8266 -01 ( Amazon )

2. Optional NodeMCU ESP8266-12 ( Amazon )

3. OLED Display ( Amazon )

4. Voltage Regulator AMS1117 ( Amazon )

5.Tactile Switch ( Amazon )

6.Slide Switch ( Amazon )

7.Resistors ( 10K and 330R )

8.Female Double Row Straight Pin Header ( Amazon )

9. Male Right Angle Pin Header ( Amazon )

9.Jumper Wires ( Amazon )

10.Prototype Board ( Amazon)

Tools Required :

1. Soldering Iron ( Amazon )

2.Wire Cutter ( Amazon )

3.Wire Stripper ( Amazon )

Step 2: Making the Circuit

Make the circuit on a prototype board as per the schematic shown above.

Important thing is that this Board can be used for programming the ESP8266 -01 module from Arduino IDE. You can use it for any of your project.

The whole Circuit is consists of ESP8266-01 module, OLED Display and few other components

1. AMS1117 : This is a voltage regulator which convert 5V to 3.3V required for ESP8266 module.

2. Tactile Switch ( S1) : Used for Resetting the ESP8266

3.Slide Switch (S2) : Used for changing the mode of ESP8266. There are two modes Normal and Program Mode.

4. Resistors : R1 is a pull up resistor and R2 is current limiting resistor.

5. Header CP2102 : Used for programming

6.Header Power : Provide power from a LiPo Battery.This is optional, because you can use the programming port's two pin for power.

7. Header OLED : Connection for OLED Display

Update as on 13/03/2016 : New PCB files

Thanks to my friend spilz who put his effort to make this nice PCB.Now you can make it by downloading the gerber files attached below.

PCB Components :

1. AMS : AMS1117-3.3

2. C1 : 100nF

3. C2 : 10uF

4. C3 : 100nF

5. C4 : 10uF

6. C5 : 100nF

Note : An additional resistor R2 is added in PCB to protect ESP8266 .

For any improvement please suggest .

Step 3: Download and Installed the Softwares

1. Arduino Code

ESP8266 Weather Station

2. Libraries :

Json Streaming Parser

ESP8266 Oled Driver for SSD1306 display

After downloading the library unzip it and installed it with your Arduino Library Manager in

Sketch > Include Library > Manage Libraries...

3. ESP8266 board on Arduino IDE :

To installed the ESP8266 board on your arduino IDE follow the following link.

https://github.com/esp8266/Arduino

Update on 2/1/2016 :

As per the feedback, lot of people facing problem in compiling the code.So I think it is better to share the code what I have used.You can download the .zip file attached below.

Step 4: Get Weather API Key

The Weather Station real-time data obtained from the Weather Underground (http://www.wunderground.com) website. So you have to get the Wunderground API Key. There is no cost to apply for a basic key, which is more than sufficient for our requirements.

Follow the steps below:


1. Go to http://www.wunderground.com/weather/api/d/login.h... a free Weather Underground account.

2.Enter your email address, a password , and a handle (a username), then click the “Sign Up” button.

3.Weather Underground will immediately send you an email with an activation link. You must click this link within the email to activate your account (you’ll be brought back to the login screen).

4. Login to Weather Underground using the account you just created and activated.

5.Click on the “Explore My Options” button.Click the “Purchase Key” button at the top or bottom of the page (you will not be asked for a method of payment).

6.Weather Underground will ask you to fill out a simple form in order to complete your request.

When asked where the API will be used, answer “Other”.

When asked if the API is for commercial use, answer “No”.

When asked if the API is for chip processing, answer “No”.

Step 5: Set Up the Software

After downloading the Arduino Code, you have to change the following things

1.Open the sketch in the Arduino IDE

2.Enter the Wunderground API Key

3.Enter your Wifi credentials

4.Adjust the location according to Wunderground API, e.g. India,Kolkata

5. Adjust UTC offset

Step 6: Upload the Code

Connect the FTDI Programmer as follows

ESP8266 --> CP2102

Vcc --> Vcc

GND--> GND

Tx --> Rx

Rx --> Tx

Slide the switch toward the Programming Mode

In Arduino IDE ,select the board as " Generic ESP8266 Module "

Then upload the code.

Step 7: Testing

Now remove the programmer and its connection.

Slide the switch to its normal position

Connect the Power Supply.I used a LiPo battery for it.

After few seconds the OLED will display all the weather parametrs.

Step 8: Make With Node MCU

If you are a not interested to make the circuit by using an ESP8266-01 module,then this is an alternative for you.You can make the same Weather Widget by using a Node MCU board. NodeMCU is an open source IoT platform.It includes firmware which runs on the ESP8266 Wi-Fi SoC, and hardware which is based on the ESP-12 module.You can still use your favourite Arduino IDE and Arduino code to program it.Another advantage is that you do not need a separate FTDI programmer to program it.A micro USB cable is enough for it.You can use your smart phone/tablet charger cable for it.

Follow the steps :

First update the NodeMCU to latest version firmware .You can see the video made by TornTech for reference.

1. Make the circuit on a bread board

Node MCU --> OLED

3.3V --->Vcc

GND -->GND

D5----> SDA

D6----> SCL

2. Connect the micro USB cable

3.Plug in to your laptop/PC USB port.

4.Set up the Software as stated in the earlier steps.

5.Set the board to " NodeMCU 1.0 (ESP-12E Module)"

6.Upload the code

You are done !!!

Step 9: Make the Enclosure

You can make your enclosure yourself with your own choice.

But I will suggest to look in to the beautiful 3D printed enclosure designed by smily77.I have printed my enclosure but still few works is left.I will update it once completed.Stay tuned...

Download the .STL files from Thingiverse.

Follow the instruction to print the Enclosure.

Then insert all the components inside.Now the Weather Widget is ready !!!

If you enjoyed this article, don’t forget to pass it along!

Follow me for more DIY projects and ideas. Thank you !!!

Arduino All The Things! Contest

Participated in the
Arduino All The Things! Contest

Tech Contest

Participated in the
Tech Contest

Make It Glow! Contest

Participated in the
Make It Glow! Contest

30 People Made This Project!

Recommendations

  • Pi Day Speed Challenge

    Pi Day Speed Challenge
  • Trash to Treasure Contest

    Trash to Treasure Contest
  • Microcontroller Contest

    Microcontroller Contest

187 Comments

1
gregabramov
gregabramov

3 years ago

hi!

i'm getting " 'drawFrame1' was not declared in this scope"

0
f_koca5055
f_koca5055

Reply 3 years ago

I changed line 54 location and it worked ,you can find it here https://www.dropbox.com/s/u7scny7dwoj9n2t/esp8266-weather-station.rar?dl=0

0
ccms.chemistry
ccms.chemistry

Reply 1 year ago

Hello. I have the same issue and the link doesn't exists anymore. Got a 404 error.

0
kekinash
kekinash

Reply 27 days ago

Check my new post about how to solve the errors.

0
giecuk
giecuk

Reply 3 years ago

Works like a charms, thanks

1
chandansur131
chandansur131

11 months ago

C:\Program Files (x86)\Arduino\libraries\esp8266-weather-station-master\TimeClient.cpp: In member function 'long int TimeClient::getCurrentEpochWithUtcOffset()':
C:\Program Files (x86)\Arduino\libraries\esp8266-weather-station-master\TimeClient.cpp:117:67: error: invalid operands of types 'double' and 'long int' to binary 'operator%'
return round(getCurrentEpoch() + 3600 * myUtcOffset + 86400L) % 86400L;
^
Multiple libraries were found for "JsonListener.h"
Used: C:\Program Files (x86)\Arduino\libraries\JsonListener
Not used: C:\Users\Chandan Sur\Documents\Arduino\libraries\Json_Streaming_Parser
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

how to solve

Untitled.jpg
0
kekinash
kekinash

Reply 27 days ago

Check my post for a modification on the code to make that error go away.

0
kekinash
kekinash

27 days ago

Note: The Weather Underground API doesn't work since 2019, so this project is useless.
Code is working but you need to make a couple of changes if you used the zip code file here.
ESP8266 Weather Widget.zip

First in the .ino file (Arduino file) on line 54 remove the equal signe so the line is as follows:

void (*frameCallbacks[])(int x, int y) {drawFrame1, drawFrame2, drawFrame3, drawFrame4};

Next open the TimeClient.cpp file in notepad or TextEdit and modify the last line of code before the closing } as follows:

return fmod(round(getCurrentEpoch() + 3600 * myUtcOffset + 86400L), 86400L);

pay attention that there isn't a % which is only for integers.

Be sure to include all libraries in the zip file into the Arduino library files (Better yet, copy all sketch folder including the libraries inside the Arduino libraries folder).

Good Luck!

0
JessG714
JessG714

Question 2 months ago

code is out dated. Not working

1
mubeenzahid
mubeenzahid

8 months ago

Multiple libraries were found for "SSD1306.h"
In file included from C:\Users\Usman Arham\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.cpp:15:0:
Used: C:\Users\Usman Arham\Documents\Arduino\libraries\esp8266-oled-ssd1306-master
C:\Users\Usman Arham\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.h:36:29: fatal error: Adafruit_Sensor.h: No such file or directory
Not used: C:\Users\Usman Arham\Documents\Arduino\libraries\ESP8266_and_ESP32_OLED_driver_for_SSD1306_displays
#include <Adafruit_Sensor.h>
^
compilation terminated.
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
Error downloading http://arduino.esp8266.com/stable/package_esp8266com_index.json

0
MichalV26
MichalV26

1 year ago

Mám tento problém při kompilaci, prosím konzultujte.

"\ users \ user \ Arduino \ library \ esp8266-weather-station-master \ TimeClient.cpp: 27: 46: chyba: no 'void TimeClient :: setUtcOffset (float)' členská funkce deklarovaná ve třídě 'TimeClient'
void TimeClient: : setUtcOffset (float utcOffset) {"

Díky

0
parisa2000
parisa2000

Question 1 year ago

hi, can you launched sensor fluxgate flc100 magnetometr with ardunio and conected to pc wiht bleuthos? thack you very much

0
parisa2000
parisa2000

1 year ago

hi, can you launched sensor fluxgate flc100 magnetometr with ardunio and conected to pc wiht bleuthos? thack you very much

2
grantKendrick
grantKendrick

1 year ago

Pease im not trying to be rude but the code doesnt work anymore, the api is down forever so the code/library will never work again. I spent hours trying to get it to work and just made a big mess lol.
So please do the community a solid and fix the code or remove the post cause no offense but i just wasted half a day on this and got nothing and i dont think anyone else will be able to figure it out either.

After finding all the .h files online(took forever) i have now realized that sense the wunderground api is gone and it is scattered around the code you cant just replace the link you have to have a whole separate library for using another weather api service. which means changing a lot of code. which is over my head honestly.

Thank you for all your work on this!! i can tell you worked hard on it, if you could just redo the code to use OpenWeather or something similar, this would be an amazing project.
-grant-

0
HùngI1
HùngI1

2 years ago

C:\Users\Hung IOT\Documents\Arduino\libraries\wifibroadcast_osd-master\graphengine.c:31:22: fatal error: bcm_host.h: No such file or directory
#include <bcm_host.h>

1
AparnaA5
AparnaA5

2 years ago

Doesn't work anymore "we will no longer provide free weather API keys"

Did u find any other option?

2
Daniel AugustoG
Daniel AugustoG

Question 2 years ago

wunderground doesnt provide free API anymore. Any other solution?

0
AldrinS10
AldrinS10

Question 2 years ago on Step 9

Hello, I've got error message when uploading...

Arduino: 1.8.5 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (1M SPIFFS), v2 Prebuilt (MSS=536), Disabled, None, 115200"

WARNING: Category '' in library XPT2046 is not valid. Setting to 'Uncategorized'
C:\Users\Aldrin\Documents\Arduino\libraries\ssd1306_i2c-master\ssd1306_i2c.c:32:25: fatal error: wiringPiI2C.h: No such file or directory

#include <wiringPiI2C.h>

^

compilation terminated.

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Pls. help...Thanks

0
SpikePlayz.
SpikePlayz.

3 years ago

Hey all, I'm still learning how to use my ESP8266MOD, so was wondering could I use this code to test its WiFi capabilities without the OLED display and simply display the data on the serial monitor?

0
giecuk
giecuk

3 years ago

why my oled not displaying ???
what should i change at sketch ?