# ESP8266 WiFi Weather Station with Color TFT Display

## Overview

https://www.youtube.com/watch?v=ImEp7kB_nrs

![](https://cdn-learn.adafruit.com/assets/assets/000/037/782/medium800/weather_hero-wparts.jpg?1480967445)

Warning: 

## Weather Station

In this project, we'll learn how to make a DIY fully featured weather station using an ESP8266 and a 2.4" TFT touchscreen display. This project pulls weather data using the Wunderground API. It displays the date, time, current weather conditionals, 4-day forecast and even moon phases.

[This great code is by Daniel Eichhorn - we just made a lovely case for it!](https://github.com/squix78/esp8266-weather-station-color)

![](https://cdn-learn.adafruit.com/assets/assets/000/037/783/medium800/weather_hero-coffee.jpg?1480967687)

## Prerequisite Guides

We recommend walking through the guides listed here to get a better understanding of the components used in this project.

- [Adafruit Feather HUZZAH with ESP8266](../../../../adafruit-feather-huzzah-esp8266/)
- [Adafruit 2.4" TFT Feather Wing](../../../../adafruit-2-4-tft-touch-screen-featherwing/)
- [Collin's Lab: Soldering](../../../../collins-lab-soldering/)

![](https://cdn-learn.adafruit.com/assets/assets/000/037/780/medium800/weather_parts.jpg?1480964404)

## Parts

You'll need the following parts to build this project.

- [2.4" TFT Feather Wing 320x240 Touchscreen](https://www.adafruit.com/product/3315)
- [Adafruit Feather HUZZAH with ESP8266 WiFi](https://adafruit.com/products/2821)
- [2000mAh Rechargeable Battery](https://adafruit.com/products/2011)&nbsp;(Optional)
- [Slide Switch](https://adafruit.com/products/805)&nbsp;(Optional)

![](https://cdn-learn.adafruit.com/assets/assets/000/037/785/medium800/weather_hero-fridge.jpg?1480967832)

## Tools & Supplies

- Soldering Iron & Solder
- 3D Printer & Filament
- microUSB Data Cable
- 30AWG Silicone Coated Stranded Wire

![](https://cdn-learn.adafruit.com/assets/assets/000/037/779/medium800/weather_hero-desk.jpg?1480964317)

# ESP8266 WiFi Weather Station with Color TFT Display

## Software

Warning: 

## Adafruit Feather HUZZAH with ESP8266 Arduino Libraries

If you're new to the Adafruit Feather HUZZAH ESP8266, you'll need to install the board and libraries in order to compile and upload code to it using the Arduino IDE. Follow the guide below to install the board and libraries, then come back here once&nbsp;you've&nbsp;successfully installed it.

The guide walks you through installing the Arduino IDE as well.

[Follow Adafruit HUZZAH EPS8266 Arduino Guide](https://learn.adafruit.com/adafruit-feather-huzzah-esp8266/using-arduino-ide)
## Download & Install Arduino Libraries

You'll need to&nbsp;download and install a few libraries in order to&nbsp;compile&nbsp;the sketch.

The Adafruit libraries are in the library manager so use that to install them:

- [Adafruit GFX Library](https://github.com/adafruit/Adafruit-GFX-Library)

![](https://cdn-learn.adafruit.com/assets/assets/000/061/973/medium800/weather_image.png?1537157073)

If using an earlier version of the Arduino IDE (pre-1.8.10), locate and install [Adafruit\_BusIO](https://github.com/adafruit/Adafruit_BusIO) (newer versions handle this prerequisite automatically).

Then back to…

- [Adafruit ILI9341 Library](https://github.com/adafruit/Adafruit_ILI9341)

![](https://cdn-learn.adafruit.com/assets/assets/000/061/974/medium800/weather_image.png?1537157107)

- [Adafruit STMPE610](https://github.com/adafruit/Adafruit_STMPE610)

![](https://cdn-learn.adafruit.com/assets/assets/000/061/975/medium800/weather_image.png?1537157142)

- [Mini Grafx by Daniel Eichhorn](https://github.com/ThingPulse/minigrafx)

![](https://cdn-learn.adafruit.com/assets/assets/000/061/976/medium800/weather_image.png?1537157471)

- [simpleDSTadjust by neptune2](https://github.com/neptune2/simpleDSTadjust)

![](https://cdn-learn.adafruit.com/assets/assets/000/061/977/medium800/weather_image.png?1537157523)

- [ESP8266 Weather Station Library by ThingPulse](https://github.com/squix78/esp8266-weather-station)

![](https://cdn-learn.adafruit.com/assets/assets/000/061/978/medium800/weather_image.png?1537157618)

- [JSON Streaming Parser by Daniel Eichhorn (not Bartosz)](https://github.com/squix78/json-streaming-parser)

![](https://cdn-learn.adafruit.com/assets/assets/000/061/979/medium800/weather_image.png?1537157677)

- [WiFiManager for ESP8266 by tzapu](https://github.com/tzapu/WiFiManager)

![](https://cdn-learn.adafruit.com/assets/assets/000/061/992/medium800/weather_image.png?1537196728)

## Arduino Sketch

Download the Arduino Sketch by clicking the green button below.&nbsp;

Info: 

[Latest Weather Station Color code for Adafruit Feather HUZZAH](https://github.com/adafruit/esp8266-weather-station-color/archive/master.zip)
## Settings&nbsp;

You'll need to manually adjust a few settings in order to properly display weather conditions from&nbsp;your area. In the **settings.h** file, look for the " **WIFI SSID**" section. Here, you'll need to enter your **WiFi SSID & Password**

```auto
// Setup
#define WIFI_SSID "yourssid"
#define WIFI_PASS "yourpassw0rd"
#define WIFI_HOSTNAME "ThingPulse-weather-station-color"

```

Then, lower down find

`String OPEN_WEATHER_MAP_LOCATION = "Zurich,CH";`

and change it to say

`String OPEN_WEATHER_MAP_LOCATION = "New York,US";`

Finally, you can set your timezone at this section by adjusting the UTC offset for your location - if you have to deal with DST, there's also code to set that as well!

```auto
#define UTC_OFFSET +1
struct dstRule StartRule = {"CEST", Last, Sun, Mar, 2, 3600}; // Central European Summer Time = UTC/GMT +2 hours
struct dstRule EndRule = {"CET", Last, Sun, Oct, 2, 0};       // Central European Time = UTC/GMT +1 hour

// Settings for Boston
// #define UTC_OFFSET -5
// struct dstRule StartRule = {"EDT", Second, Sun, Mar, 2, 3600}; // Eastern Daylight time = UTC/GMT -4 hours
// struct dstRule EndRule = {"EST", First, Sun, Nov, 1, 0};       // Eastern Standard time = UTC/GMT -5 hour
```

## Uploading Sketch to Adafruit HUZZAH with ESP8266

Once your adjustments have been made, you can upload the sketch to the board. Before you do, goto **Tools** \> **Board** and select **Adafruit HUZZAH ESP8266**. Then, check the varies options below:

- CPU Frequency: 80 MHz
- **Flash&nbsp;Size: 4M (3M SPIFFS) - this is not default!**  
- Upload Speed: 115200

Plug in a microUSB data cable into the board and connect it to a USB port on your computer. Under the **Port** &nbsp;section, in the **Tools** menu, you should see the board listed. (If you're on a Mac, it will be listed as **/dev/cu.SLAB\_USBtoUART**.)

With those options selection, you can now upload the code to the board by clicking the upload button. You'll see the status of the upload in the black window on the&nbsp;bottom of the Arduino IDE.

## Connected ESP8266 WiFi

The ESP8266 will then automatically download the assets (weather condition icons) to the board. Once it's finished, it'll automatically display the date, time, weather, and moon phases. Pretty cool, huh? :-)

# ESP8266 WiFi Weather Station with Color TFT Display

## 3D Printing

![](https://cdn-learn.adafruit.com/assets/assets/000/037/781/medium800/weather_3d-parts.jpg?1480964632)

## &nbsp;Design Files

&nbsp;You can download the files below.

[Download STLs on Thingiverse](http://www.thingiverse.com/thing:1944905)
[Download STLs on Pinshape](https://pinshape.com/items/29715-3d-printed-esp8266-wifi-weather-station-with-color-tft-display)
[Download STLs on YouMagine](https://www.youmagine.com/designs/esp8266-wifi-weather-station-with-color-tft-display)
## Slice Settings

Depending on your 3D printer, you may need to&nbsp;adjust the slice settings. We tested the enclosure &nbsp;on a Sigma BCN3D, Deltaprintr Go and a Printrbot Play. They do not require any support material and are oriented to print "as is".

- Nozzle: 0.4mm
- Extrusion Multiplier: 1.0
- Extrusion Width: 0.48mm
- Layer Height: 0.2mm
- Nozzle Temperature: 220c

## Fusion 360&nbsp;Design Archive

You can remix the design if you'd like to make any adjustments or reuse components.&nbsp;

[Download F360 Archive](http://a360.co/2h23P5R)
# ESP8266 WiFi Weather Station with Color TFT Display

## Assembly

## Solder Headers onto Adafruit Feather HUZZAH

First, we'll need to solder on plain male headers onto the pins of the Adafruit Feather HUZZAH. You can follow the detailed instructions on the [Adafruit Feather HUZZAH guide](../../../../adafruit-feather-huzzah-esp8266/assembly#soldering-in-plain-headers).

![weather_feather_solder4.jpg](https://cdn-learn.adafruit.com/assets/assets/000/037/800/medium640/weather_feather_solder4.jpg?1481040797)

![](https://cdn-learn.adafruit.com/assets/assets/000/037/801/medium800thumb/weather_parts-assembly.jpg?1481041116)

## Mount 2.4" TFT Display to Adafruit Feather HUZZAH ESP8266

With the male headers now soldered to the Adafruit Feather HUZZAH, we can mount it to the back of 2.4" TFT&nbsp;FeatherWing.&nbsp;Line up the pins with the header and press them together until they're fully seated.&nbsp;

## Turn on TFT Display

You'll need to set the slide switch on the back of the display to ON.

![](https://cdn-learn.adafruit.com/assets/assets/000/037/802/medium800thumb/weather_battery-install.jpg?1481041276)

## Connect Battery (Optional)

If you'd like the Weather Station to be portable, you can connect a battery. Here, we have a 2000mAh lithium ion&nbsp;battery. Plug in the male JST connector to the female JST port on the Adafruit Feather HUZZAH.

## Connect Slide Switch (Optional)

If you'd like to turn off the circuit without having to remove the display from the case, you can break out the slide switch. You'll need to wire up a a slide switch. It will need to connect to the **EN** and **GND** labeled pins on the&nbsp;2.4" TFT FeatherWing. Here, we connected the terminals of slide switch to jumper cables. The jumpers can plug into the female headers on the 2.4" display.

I used the tips from male jump cables to create a "slim" version by removing the plastic housing and trimming it short. Then, I soldered the tips to pieces of wire – This way, I can easily plug into the female header on the TFT display.

![weather_switch-header-wire.jpg](https://cdn-learn.adafruit.com/assets/assets/000/038/842/medium640/weather_switch-header-wire.jpg?1485810989)

![weather_switch-mounted.jpg](https://cdn-learn.adafruit.com/assets/assets/000/038/843/medium640/weather_switch-mounted.jpg?1485811010)

![weather_switch-en-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/038/844/medium640/weather_switch-en-wired.jpg?1485811029)

![weather_switch-gnd-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/038/845/medium640/weather_switch-gnd-wired.jpg?1485811048)

![](https://cdn-learn.adafruit.com/assets/assets/000/037/803/medium800thumb/weather_tft-install-cover.jpg?1481041526)

## Install TFT DIsplay to Enclosure Cover

The enclosure cover has four standoffs that match up with the mounting holes on the 2.4" display. Orient the display and the cover so the side with black strip lines up with the opening in the lip.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/037/804/medium800thumb/weather_install-enclosure.jpg?1481041820)

## Install Cover to Case

If you added a battery, place it in the enclosure. Notice the two openings in the enclosure. They're for the microUSB port and the &nbsp;microSD card. Orient the Adafruit Feather HUZZAH so the ports line up with the openings on enclosure. Lay the cover over the enclosure and press the two together. The case has two little nubs on the edge that will click&nbsp;into the dimples on the lip&nbsp;of the cover.

## Finished Assembly!

And thats it! You can mount the case in all sorts of ways. For example, you can attach a magnet to the back&nbsp;to stick it on metal surfaces such as your refridgerator.


## Related Guides

- [Adafruit Feather HUZZAH ESP8266](https://learn.adafruit.com/adafruit-feather-huzzah-esp8266.md)
- [Adafruit 2.4" TFT FeatherWing](https://learn.adafruit.com/adafruit-2-4-tft-touch-screen-featherwing.md)
- [Arcade Machine/Console Emulator for ESP32 Handheld](https://learn.adafruit.com/handheld-esp32-arcade-machine-ports.md)
- [File Glider](https://learn.adafruit.com/file-glider.md)
- [Circuit Playground Seashell Pendant](https://learn.adafruit.com/circuit-playground-seashell-pendant.md)
- [Creating Custom Symbol Fonts for Adafruit GFX Library](https://learn.adafruit.com/creating-custom-symbol-font-for-adafruit-gfx-library.md)
- [LED Snowboard with Motion-Reactive Animation](https://learn.adafruit.com/led-snowboard-with-motion-reactive-animation.md)
- [Camera LED Ring Light](https://learn.adafruit.com/camera-ring-led-light.md)
- [Mario Magic Wand](https://learn.adafruit.com/mario-magic-wand.md)
- [Rezz-Inspired NeoPixel Glasses](https://learn.adafruit.com/rezz-inspired-neopixel-glasses.md)
- [Adabot Toy Robot Friend](https://learn.adafruit.com/adabot-rp2040.md)
- [CircuitPython Painter](https://learn.adafruit.com/circuitpython-painter.md)
- [Boomy Pi Airplay Boombox](https://learn.adafruit.com/boomy-pi-airplay.md)
- [Soundbox RP2040](https://learn.adafruit.com/soundbox-rp2040.md)
- [Glowing Scale Armor](https://learn.adafruit.com/glowing-scale-armor.md)
- [LO-LA59 Droid](https://learn.adafruit.com/lola-droid.md)
- [NeoPixel LED Mickey Ears](https://learn.adafruit.com/neopixel-led-mickey-ears.md)
