Displays
E-ink weather board
Today's weather on a paper-like screen you can read in bright sun. It keeps showing the last report even with the power off.
- Hard
- about 70 min
- ESP32-S3
- 5 parts
- 8 wires
- 111 lines of code
- Uses Wi-Fi
ESP32 packs are built on real parts: the simulator runs Arduino Uno circuits only.
Idea
E-ink moves tiny black and white particles and then needs no power to hold them. It is slow to change, so the board draws a whole page at once and then lets the screen sleep.
What you learn
Driving an e-paper panel, page-based drawing, and choosing a refresh rate that suits the screen.
How it works
input
Weather from the internet
decides
ESP32-S3 · Wi-Fi
output
E-paper 4.2 in
Powered with 5 V through the board's USB-C port.
It joins your home Wi-Fi. You type the network name and password into the sketch before uploading; they stay on the board.
A reference design. The sketch is compiled with the real ESP32 toolchain, and its pins are checked against the wiring table automatically. It has not yet been built and tested on real parts by us, so wire it on the bench and run the checks before you build it into a case. Real modules vary: follow the labels printed on yours, not their position in the picture.
Parts
0 of 5 ready
No prices here: they change by shop and by week. Buy each part by its name and the note beside it.
You also need
A computer with Arduino IDE 2 installed (free)
3D wiring
One jumper per step, with the USB cable unplugged. Several wires may share 3V3, 5V or GND: the expansion board or breadboard gives each its own pin.
Step 0 of 8
Lay out the parts
Seat the board on its expansion board or breadboard and lay the modules out round it. Nothing is connected yet.
All connections
eink-weather.ino
// E-ink weather board
// Today's weather on paper-like e-ink. It refreshes every 30 minutes and
// keeps showing the last picture even if the power goes.
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
#include <SPI.h>
#include <GxEPD2_BW.h>
#include <Fonts/FreeSansBold24pt7b.h>
#include <Fonts/FreeSans12pt7b.h>
const char* WIFI_SSID = "YOUR_WIFI_NAME";
const char* WIFI_PASS = "YOUR_WIFI_PASSWORD";
// Your town. These are for Ho Chi Minh City.
const float LATITUDE = 10.82;
const float LONGITUDE = 106.63;
const char* TOWN = "Ho Chi Minh City";
const unsigned long REFRESH_MS = 30UL * 60UL * 1000UL;
const int PIN_PAPER_DIN = 11;
const int PIN_PAPER_CLK = 12;
const int PIN_PAPER_CS = 10;
const int PIN_PAPER_DC = 13;
const int PIN_PAPER_RST = 14;
const int PIN_PAPER_BUSY = 4;
// The driver class must match your panel. GDEY042T81 is the current 4.2 in
// black-and-white panel; older ones use GxEPD2_420 or GxEPD2_420_M01.
GxEPD2_BW<GxEPD2_420_GDEY042T81, GxEPD2_420_GDEY042T81::HEIGHT> paper(
GxEPD2_420_GDEY042T81(PIN_PAPER_CS, PIN_PAPER_DC, PIN_PAPER_RST, PIN_PAPER_BUSY));
unsigned long lastFetch = 0;
bool haveData = false;
const char* skyName(int code) {
if (code == 0) return "Clear sky";
if (code <= 3) return "Cloudy";
if (code <= 48) return "Fog";
if (code <= 67) return "Rain";
if (code <= 77) return "Snow";
if (code <= 82) return "Showers";
return "Thunderstorm";
}
void drawBoard(float now, float high, float low, int humidity, float rainMm, int code) {
paper.setFullWindow();
paper.firstPage();
do {
paper.fillScreen(GxEPD_WHITE);
paper.setTextColor(GxEPD_BLACK);
paper.setFont(&FreeSans12pt7b);
paper.setCursor(16, 34);
paper.print(TOWN);
paper.drawFastHLine(16, 46, 368, GxEPD_BLACK);
paper.setFont(&FreeSansBold24pt7b);
paper.setCursor(16, 120);
paper.print(now, 1);
paper.print(" C");
paper.setCursor(16, 180);
paper.print(skyName(code));
paper.setFont(&FreeSans12pt7b);
paper.setCursor(16, 226);
paper.printf("High %.0f C Low %.0f C", high, low);
paper.setCursor(16, 256);
paper.printf("Humidity %d%% Rain today %.1f mm", humidity, rainMm);
} while (paper.nextPage());
paper.hibernate();
}
bool fetchWeather() {
WiFiClientSecure client;
client.setInsecure();
HTTPClient http;
String url = "https://api.open-meteo.com/v1/forecast?latitude=" + String(LATITUDE, 2) + "&longitude=" + String(LONGITUDE, 2) +
"¤t=temperature_2m,relative_humidity_2m,weather_code"
"&daily=temperature_2m_max,temperature_2m_min,precipitation_sum&forecast_days=1&timezone=auto";
if (!http.begin(client, url)) return false;
bool ok = false;
if (http.GET() == 200) {
JsonDocument doc;
if (!deserializeJson(doc, http.getString())) {
drawBoard(doc["current"]["temperature_2m"], doc["daily"]["temperature_2m_max"][0], doc["daily"]["temperature_2m_min"][0],
doc["current"]["relative_humidity_2m"], doc["daily"]["precipitation_sum"][0], doc["current"]["weather_code"]);
ok = true;
}
}
http.end();
return ok;
}
void setup() {
SPI.begin(PIN_PAPER_CLK, -1, PIN_PAPER_DIN, PIN_PAPER_CS);
paper.init(115200, true, 2, false);
paper.setRotation(0);
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) delay(250);
}
void loop() {
if (!haveData || millis() - lastFetch > REFRESH_MS) {
if (fetchWeather()) haveData = true;
lastFetch = millis();
if (!haveData) delay(10000);
}
delay(1000);
}
Libraries
- ArduinoJson: install it from Sketch > Include Library > Manage Libraries.
- GxEPD2: install it from Sketch > Include Library > Manage Libraries.
Uploading
First time with an ESP32: in Arduino IDE open Boards Manager, search “esp32” and install “esp32 by Espressif Systems”.
- Before uploading, type your Wi-Fi name and password into WIFI_SSID and WIFI_PASS at the top of the sketch.
- Open the sketch in Arduino IDE.
- Plug the board in with the USB-C cable.
- Tools > Board > ESP32S3 Dev Module, then Tools > Port and choose the board's port.
- Press Upload (the arrow). Wait for “Done uploading”.