🛠 Connected Weather Station with M5Stack PaperDIY
Objectives
This tutorial aims to configure the M5Stack PaperDIY Complete Kit as a connected weather station. You will learn to initialize the ED047TC1 e-paper display, establish a stable WiFi connection, and retrieve weather data via a web API to display it on the grayscale screen. This project demonstrates power management and network communication on the ESP32-S3.
Materials Needed
- M5Stack PaperDIY Complete Kit (pre-assembled)
- USB-C cable for power and debugging
- Computer with Arduino IDE installed
- M5GFX and M5Unified libraries (via Library Manager)
- Account on a weather API service (e.g., OpenWeatherMap) for the API key
Steps
- Environment Setup : Open Arduino IDE, go to Library Manager, and install “M5Unified” and “M5GFX”. Select “M5Stack-ATOMS3” or “ESP32-S3 Dev Module” as the board model, with 16MB Flash and Octal PSRAM enabled.
- Display Initialization : The ED047TC1 screen uses an 8-bit parallel interface. Use the M5GFX library to initialize the display. Note that e-paper updates are slow; avoid frequent full refreshes to preserve the 140mAh battery.
#include <M5GFX.h>
M5GFX display;
void setup() {
display.begin();
display.setRotation(0);
display.fillScreen(GRAY4_0);
}
- WiFi Connection : Use the
WiFi.hlibrary to connect the ESP32-S3 to the network. The M5PM1 chip manages power, but ensure deep sleep is disabled during connection. Handle connection errors with multiple retries.
#include <WiFi.h>
const char* ssid = "YourSSID";
const char* pass = "YourPassword";
void connectWiFi() {
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
}
- Data Retrieval : Use
HTTPClientto query the weather API. Parse the JSON response to extract temperature and conditions. The integrated PCB antenna provides adequate range for home use.
- Data Display : Convert data into simple text or graphics. The screen offers 16 grayscale levels; use shades to create readable weather icons without color.
Verification
Open the serial monitor at 115200 bauds. You should see WiFi connection messages and received JSON data. On the screen, weather information must appear clearly. Ensure the screen does not remain active permanently to save battery.
Further Learning
Integrate a Deep Sleep mode between updates to extend the 140mAh battery life. You can also add a physical button to force an immediate update or use the MicroSD card to log temperature history locally.
Other tutorials for this board
Code examples for this board
gpio_led_button_control.inoC++ (Arduino)epaper_hello_world.inoC++ (Arduino)wifi_scanner.inoC++ (Arduino)sd_card_logger.inoC++ (Arduino)ble_beacon.inoC++ (Arduino)gpio-button-led.inoC++ (Arduino)