# eInk / ePaper Weather Station

## Overview

> So happy together  
> How is the weather?
> 
> _The Turtles, "Happy Together"_

In this project, the Adafruit Metro M4 Express Airlift and the Tri-Color ePaper Shield work happily together to create a weather station with the current weather conditions and forecast for your area.

A wonderful thing happened when the Metro M4 Express AirLift was released. It opened Arduino sketches to the Internet, freeing them from the confines of their closed environment. It is now officially a "thing" in a world of the Internet of Things (IoT). In this project, the Metro M4 Express AirLift will grab weather data for your local area from the internet and display it on an easy to read ePaper display

The Adafruit Tri-Color ePaper Shield used with this project is a 2.7" ePaper shield that displays black, white and red pixels. It easily connects to the Metro with no soldering needed since the headers are already assembled on both the Metro and the ePaper shield.&nbsp;

## Features

This DIY weather station displays weather information for your local area in either Celsius or Fahrenheit units on an ePaper display. The displayed information includes:

- Current date
- Current temperature
- Current weather conditions
- Forecast data for the next 12 hours in 6 hour increments
- Weather icons for weather conditions and forecasts
- City name
- Display current and forecasted hot temperatures in red
- Sunrise and sunset times
- Description and icon of current moon phase

## Parts

Building this project requires no soldering and uses just two parts: the Adafruit Metro M4 Express AirLift Lite and the Adafruit 2.7" Tri-Color eInk / ePaper Shield with SRAM.&nbsp; To make this project portable, you could add&nbsp;[a USB battery pack](https://www.adafruit.com/product/1959)&nbsp;or the&nbsp;[Adafruit PowerBoost 500 Shield](https://www.adafruit.com/product/2078)&nbsp;and a Li-Po battery and insert it between the Metro and the ePaper shield.

If you are interested in ePaper displays for other projects, check out the entire line of&nbsp;[Adafruit's ePaper displays](https://www.adafruit.com/category/150).

Featured
### Adafruit Metro M4 Express AirLift (WiFi) - Lite

[Adafruit Metro M4 Express AirLift (WiFi) - Lite](https://www.adafruit.com/product/4000)
Give your next project a lift with _AirLift_ - our witty name for the ESP32 co-processor that graces this Metro M4. You already know about the&nbsp; **Adafruit Metro M4** &nbsp;featuring the&nbsp; **Microchip ATSAMD51** , with it's 120MHz Cortex M4 with...

In Stock
[Buy Now](https://www.adafruit.com/product/4000)
[Related Guides to the Product](https://learn.adafruit.com/products/4000/guides)
![Adafruit Metro M4 Airlift Lite dev board with SAMD51 an ESP32 Wifi Co-processor.](https://cdn-shop.adafruit.com/640x480/4000-08.jpg)

Featured
### Adafruit 2.7" Tri-Color eInk / ePaper Shield with SRAM

[Adafruit 2.7" Tri-Color eInk / ePaper Shield with SRAM](https://www.adafruit.com/product/4229)
Easy e-paper finally comes to microcontrollers, with this breakout that's designed to make it a breeze to add a tri-color eInk display. Chances are you've seen one of those new-fangled 'e-readers' like the Kindle or Nook. They have gigantic electronic paper 'static'...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4229)
[Related Guides to the Product](https://learn.adafruit.com/products/4229/guides)
![Top down view of a Adafruit 2.7" Tri-Color eInk / ePaper Shield with SRAM - Red Black White. ](https://cdn-shop.adafruit.com/640x480/4229-05.jpg)

Featured
### USB cable - USB A to Micro-B

[USB cable - USB A to Micro-B](https://www.adafruit.com/product/592)
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or microcontroller

Approximately 3 feet / 1 meter long

In Stock
[Buy Now](https://www.adafruit.com/product/592)
[Related Guides to the Product](https://learn.adafruit.com/products/592/guides)
![USB cable - USB A to Micro-B - 3 foot long](https://cdn-shop.adafruit.com/640x480/592-01.jpg)

# eInk / ePaper Weather Station

## How it Works

![](https://cdn-learn.adafruit.com/assets/assets/000/076/548/medium800/adafruit_metro_Untitled.png?1559931598)

WIth the AirLift coprocessor board, this Metro M4 Express is going places! Well, at least for this sketch, it is going to get your local weather and display it on the ePaper shield.&nbsp; There are a number of sites with weather APIs that can get your local area's current conditions and upcoming forecast. A smaller number of these sites offer this data for free for non-commercial purposes. We went with the OpenWeatherMap.com API, which offers free weather data for current conditions and forecasts.

For weather and moon icons, we are taking advantage of the Adafruit GFX Library's support for custom fonts. A font is ideal for this type of display, as we need simple, line drawn icons in different point sizes that look nice on a monochrome ePaper display. For weather icons, we chose the [Meteocon](http://www.alessioatzeni.com/meteocons/) font set, a free font containing over 40 weather icons. For the moon phase font, we went with the [Moon Phases](http://www.mockfont.com) font by Curtis Clark, which is free for non-commercial use. The font files need to be converted for use with the GFX Library, but don't worry, we have done that already in various point sizes so you can use these fonts for this and other projects.

Speaking of moon phases, the OpenWeatherMap does not include moon phases in their API. That is not a problem, however, as we used math to calculate the current moon phase. We know there is, on average, a new moon every 29.5305882 days. Grabbing the current date and time from OpenWeatherMap, and if we have a known point in time when a new moon occurred, we can calculate the moon phase for the current date.

The weather data from OpenWeatherMap includes the current time and times of future forecasts, like the weather forecast 3 hours from now. This time is in UTC format. We need to convert it to local time so the times will display accurately. Fortunately, OpenWeatherMap recently added the local timezone offset to the data (actually, as we were writing this guide!) so the local time can now be easily determined by taking the current time in UTC and adding the local timezone offset.

![](https://cdn-learn.adafruit.com/assets/assets/000/075/818/medium800/adafruit_metro_meteoicons.png?1558440852 The Meteoicon Font contains over 40 weather related fonts.)

The next step is to put it all together: getting the weather data and formatting the display. We modified a portion of the code from the excellent&nbsp;[Weather Station Project](https://github.com/ThingPulse/esp8266-weather-station) by Daniel Eichhorn so it was not exclusive for any particular microcontroller. This allows other processors, including the Airlift coprocessor, to retrieve the weather data from the Internet.

# eInk / ePaper Weather Station

## Arduino Setup

If you don't have it already, you will need the Arduino IDE installed on your computer to upload this sketch to the Metro M4 Express AirLift.&nbsp;[You will find information on installing Arduino in this learning guide](https://learn.adafruit.com/lesson-0-getting-started/overview). You will also need to configure the Metro M4 Express AirLift board to work with the Arduino IDE. There is [a great article on setting up this board](https://learn.adafruit.com/adafruit-metro-m4-express-airlift-wifi) with Arduino and other environments in the [Adafruit Learning Guides site](https://learn.adafruit.com/).

## Installing The Libraries

For this sketch, you will need to install these libraries:

- Adafruit EPD (ePaper display) library
- Adafruit GFX library
- Adafruit BusIO
- Adafruit NeoPixel library
- Arduino JSON library
- Adafruit variant of the WiFiNINA library

These libraries should be in the Arduino Library Manager in the latest Arduino IDE (1.8.7 and above).

Open up the Arduino library manager:

![](https://cdn-learn.adafruit.com/assets/assets/000/084/222/medium800/wireless_library_manager_menu.png?1573776005)

Search for the&nbsp; **Adafruit EPD** library and install it

![](https://cdn-learn.adafruit.com/assets/assets/000/084/223/medium800/wireless_epd.png?1573776193)

Search for the&nbsp; **Adafruit GFX&nbsp;** library and install it

![](https://cdn-learn.adafruit.com/assets/assets/000/084/224/medium800/wireless_gfx.png?1573776198)

If using an earlier version of the Arduino IDE (prior to 1.8.10), also locate and install **Adafruit\_BusIO** (newer versions will install this dependency automatically).

Search for the&nbsp; **Adafruit NeoPixel&nbsp;** library and install it

![](https://cdn-learn.adafruit.com/assets/assets/000/084/225/medium800/wireless_neopixel.png?1573776208)

Search for the&nbsp; **ArduinoJSON** library and install it

![](https://cdn-learn.adafruit.com/assets/assets/000/084/226/medium800/wireless_json.png?1573776268)

You'll have to install WiFiNina manually with the link below

[Download Adafruit's version of WiFiNina](https://github.com/adafruit/WiFiNINA/archive/master.zip)
## Signup For An OpenWeatherMap API key

You will need an API key from OpenWeatherMap in order to download weather data from their site.&nbsp; You can signup for free at [OpenWeatherMap.org](OpenWeatherMap.org) . A free account allows access to the current weather and 5 day / 3 hour weather API's.

## Download the Code and Modify The secrets.h File

The download is available on GitHub. It contains code and font files for the weather and moon phase icons.

The **secrets.h** must be modified to include your WiFi settings, your OpenWeatherMap API key, and the city where you want the weather data. You may need to include your 2 letter country code if your city name occurs in more than one country, like Venice, Italy and Venice, Florida. So, for example, Venice, Florida would be entered as "Venice, US".

Other options available in this file include the choice of metric or English units for temperature and the language for the weather descriptions.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/EInk_Weather_Station/adafruit_epd_weather/secrets.h

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/EInk_Weather_Station/adafruit_epd_weather/adafruit_epd_weather.ino

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/EInk_Weather_Station/adafruit_epd_weather/OpenWeatherMap.h

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/EInk_Weather_Station/adafruit_epd_weather/OpenWeatherMap.cpp

The font files can be found in the GitHub repository [here](https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/EInk_Weather_Station/adafruit_epd_weather/Fonts).

# eInk / ePaper Weather Station

## Use

The shield includes 4 programmable buttons, labeled "A" to "D", and a reset button. These buttons have been programmed show different weather displays. When first booting up the device, the display shows the current and forecast weather. You can also view this display by pressing the "A" or reset button. Button "B" shows the current weather conditions, and button "C" shows the current lunar phase and sunrise and sunset times for the day. The "D" button will retrieve the latest weather data from the Internet and display it using the last display mode. This is particularly useful if you have a long update interval and you want to update the display with the latest weather data.

![](https://cdn-learn.adafruit.com/assets/assets/000/075/922/medium800/adafruit_metro_weather5.jpg?1558644892 Use the buttons to display different weather views.)

## Status LED

The&nbsp;Metro M4 Express Airlift also comes with a single NeoPixel. This project uses the NeoPixel as a project status indicator.

A&nbsp; **blue** &nbsp;NeoPixel status means the sketch is currently accessing the Internet, either connecting to the WiFi hotspot or grabbing the date and time.

A&nbsp; **green** &nbsp;NeoPixel status means the sketch is currently updating the display and will turn off when it is completed. This can take a few seconds since ePaper displays are not very speedy at refreshing their screens.

A&nbsp; **red** &nbsp;NeoPixel status means there is a network communication issue. Pressing the buttons will have no effect if the NeoPixel is showing one of these status colors. Wait for the NeoPixel to turn off before pressing one of the buttons.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/075/923/medium800/adafruit_metro_weather4.jpg?1558644968 The NeoPixel acts as a status indicator. Green shown here means the display is being updated.)

![](https://cdn-learn.adafruit.com/assets/assets/000/075/918/medium800/adafruit_metro_weather1.jpg?1558644455 Pressing button A or booting the device displays the current and forecast weather.)

![](https://cdn-learn.adafruit.com/assets/assets/000/075/919/medium800/adafruit_metro_weather2.jpg?1558644546 Pressing button B shows the current weather conditions.)

![](https://cdn-learn.adafruit.com/assets/assets/000/075/920/medium800/adafruit_metro_weather3.jpg?1558644586 Pressing button C shows the current moon phase and sunrise and sunset times.)


## Guide Products

### Adafruit Metro M4 Express AirLift (WiFi) - Lite

[Adafruit Metro M4 Express AirLift (WiFi) - Lite](https://www.adafruit.com/product/4000)
Give your next project a lift with _AirLift_ - our witty name for the ESP32 co-processor that graces this Metro M4. You already know about the&nbsp; **Adafruit Metro M4** &nbsp;featuring the&nbsp; **Microchip ATSAMD51** , with it's 120MHz Cortex M4 with...

In Stock
[Buy Now](https://www.adafruit.com/product/4000)
[Related Guides to the Product](https://learn.adafruit.com/products/4000/guides)
### Adafruit 2.7" Tri-Color eInk / ePaper Shield with SRAM

[Adafruit 2.7" Tri-Color eInk / ePaper Shield with SRAM](https://www.adafruit.com/product/4229)
Easy e-paper finally comes to microcontrollers, with this breakout that's designed to make it a breeze to add a tri-color eInk display. Chances are you've seen one of those new-fangled 'e-readers' like the Kindle or Nook. They have gigantic electronic paper 'static'...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4229)
[Related Guides to the Product](https://learn.adafruit.com/products/4229/guides)
### USB cable - USB A to Micro-B

[USB cable - USB A to Micro-B](https://www.adafruit.com/product/592)
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or microcontroller

Approximately 3 feet / 1 meter long

In Stock
[Buy Now](https://www.adafruit.com/product/592)
[Related Guides to the Product](https://learn.adafruit.com/products/592/guides)

## Related Guides

- [Adafruit Metro M4 Express AirLift (WiFi)](https://learn.adafruit.com/adafruit-metro-m4-express-airlift-wifi.md)
- [Adafruit 2.7" eInk Display Breakouts and Shields](https://learn.adafruit.com/adafruit-2-7-eink-display-breakouts-and-shields.md)
- [Network Connected RGB Matrix Clock](https://learn.adafruit.com/network-connected-metro-rgb-matrix-clock.md)
- [Capturing Camera Images with CircuitPython](https://learn.adafruit.com/capturing-camera-images-with-circuitpython.md)
- [Making a PyPortal User Interface with DisplayIO](https://learn.adafruit.com/making-a-pyportal-user-interface-displayio.md)
- [Make It Shake, Rattle, and Roll: Accelerometer Use](https://learn.adafruit.com/make-it-shake-rattle-and-roll.md)
- [UART Communication Between Two CircuitPython Boards](https://learn.adafruit.com/uart-communication-between-two-circuitpython-boards.md)
- [Hello World of Robotics with Crickit](https://learn.adafruit.com/hello-world-of-robotics-with-crickit.md)
- [LED Emerald with Circuit Playground Bluefruit](https://learn.adafruit.com/led-emerald-with-circuit-playground.md)
- [Ocean Epoxy Resin Lightbox with RGB LED Matrix Image Scroller](https://learn.adafruit.com/ocean-epoxy-resin-lightbox-with-rgb-led-matrix-image-scroller.md)
- [Piper Make With the Raspberry Pi Pico](https://learn.adafruit.com/piper-make-with-the-raspberry-pi-pico.md)
- [Introduction to the Mastodon API using CircuitPython](https://learn.adafruit.com/intro-to-mastodon-api-circuitpython.md)
- [How to Use micro:bit classroom to Manage Programming Lessons](https://learn.adafruit.com/how-to-use-micro-bit-classroom-to-manage-programming-lessons.md)
- [Data Logging IoT Weight Scale](https://learn.adafruit.com/data-logging-iot-weight-scale.md)
- [PyPortal Philips Hue Lighting Controller](https://learn.adafruit.com/pyportal-philips-hue-lighting-controller.md)
- [Circuit Playground Express: Piano de Limones](https://learn.adafruit.com/circuit-playground-express-piano-de-limones.md)
- [Cardboard Circuit Playground Express Inchworm Robot](https://learn.adafruit.com/cardboard-robot-inchworm.md)
