In this post, I’ll explore a project that leverages the Raspberry Pi Pico W to display the daily schedule and other relevant messages on an e-ink (e-paper) display. I created this project to provide a quick and easy way to view my daily schedule, make announcements, and provide other important information to students who visit my office.
Project Overview
The project revolves around a Raspberry Pi Pico W, a low-cost microcontroller with built-in Wi-Fi capabilities, paired with a 7.5-inch e-ink display. The Pico W fetches the schedule and other messages from a remote server, processes the data, and displays it on the e-ink screen. The e-ink display is ideal for this use case because it consumes very little power and maintains the displayed information even when the device is powered off.
Key Features
Wi-Fi Connectivity with AP Mode Fallback: The Pico W connects to a Wi-Fi network using stored credentials. If no credentials are available or the connection fails, it switches to AP mode, allowing users to configure the Wi-Fi settings via a web interface.
E-Ink Display: The 7.5-inch e-ink display is used to show the daily schedule, room information, and any override or permanent messages. The display is updated only when there are changes in the data, ensuring minimal power consumption.
Automatic Time Sync: The Pico W syncs its internal clock with an NTP (Network Time Protocol) server to ensure accurate timekeeping. This is crucial for displaying the correct schedule and for scheduling future updates.
Deep Sleep Mode: To conserve power, the Pico W enters a deep sleep mode after updating the display. It wakes up periodically (every 15 minutes by default) to check for updates and refresh the display if necessary.
Error Handling: The project includes robust error handling for Wi-Fi connectivity and server communication. If the device fails to connect to Wi-Fi or fetch data from the server, it displays basic information (Room number and occupant’s Name and an error message) then enters deep sleep .
Local Data Storage: The last known schedule and messages are stored locally in a JSON file. This allows the device to update display only when received data from the remote server changes.
How the Pico W Works?
Initialization: When the device powers on, it loads the last known data from a local JSON file and attempts to connect to the configured Wi-Fi network.
Data Fetching: Once connected to Wi-Fi, the device syncs its time with an NTP server and fetches the latest schedule and messages from a remote server using an HTTP GET request.
Display Update: If the fetched data differs from the previously stored data, the e-ink display is updated with the new information. The display shows the room number, room occupant’s name, schedule, and other messages.
Deep Sleep: After updating the display, the device calculates the time until the next scheduled wake-up and enters deep sleep mode to conserve power.
Error Handling: If the device fails to connect to Wi-Fi or fetch data from the server, it displays basic information and error message on the e-ink screen and enters deep sleep mode.
Server Overview
The server is built using FastAPI, a modern, fast (high-performance) web framework for building APIs with Python. It provides a RESTful API that the Raspberry Pi Pico W can interact with to fetch the schedule and other messages. The server also handles logging, data validation, and error handling.
Key Features of the Server
API Key Authentication: The server uses an API key for authentication. The API key is passed in the request headers, and the server validates it before processing any requests. This ensures that only authorized clients (like the Raspberry Pi Pico W) can access the API.
Data Storage: The server stores the daily schedule and other messages in memory. The schedule is stored as a list of events, each with a date, event name, start time, and end time. The server also handles the deletion of older events that are no longer relevant.
Data Validation: The server includes helper functions to validate the date and time of events. For example, it ensures that the start time of an event is before the end time and that the date of an event is not in the past.
Logging: The server logs important events, such as when a new message is received, when the schedule is updated, or when an event is deleted. This helps with debugging and monitoring the server’s activity.
Endpoints: The server provides several endpoints to interact with the data:
- Schedule Management: Endpoints to add, replace, or delete events in the schedule.
- Message Management: Endpoints to update or other types of messages.
- Data Retrieval: Endpoints to fetch the current date, today’s schedule, and all data (including messages and schedule).
- Acknowledgment: An endpoint to receive acknowledgments from the client (e.g., the Raspberry Pi Pico W).
Static File Serving: The server can serve a static GUI (e.g., a web interface). This could be used to provide a user-friendly interface for managing the schedule and messages.
How the Server Works with the Raspberry Pi Pico W
Fetching Data: The Raspberry Pi Pico W periodically wakes up, connects to the server, and fetches the latest data. This data includes the current date, today’s schedule, and any other messages.
Updating the Display: If the fetched data differs from the previously stored data, the Pico W updates the e-ink display with the new information. The display shows the professor’s name, room number, schedule, and any messages.
Sending Acknowledgments: After successfully updating the display, the Pico W sends an (optional) acknowledgment to the server. This allows the server to log that the client has successfully processed the data.
Error Handling: If the Pico W fails to connect to the server or fetch data, it displays an error message on the e-ink screen and enters deep sleep mode to try again later.
Conclusion
This project is a perfect blend of hardware and software innovation, designed to provide timely and useful information to student and colleagues.
The project demonstrates how a small, low-cost microcontroller like the Raspberry Pi Pico W can be used to create a practical, energy-efficient solution for everyday challenges. Whether it’s for academic settings, office environments, or even personal use, the combination of e-ink technology, Wi-Fi connectivity, and a user-friendly interface makes this project a valuable tool for keeping schedules and messages visible and up to date.