This project is a weather station built using MicroPython on a Raspberry Pi Pico W and a Waveshare 5.65-inch ePaper display. It fetches and displays weather data for a specified location.
The device shows the weather data for Now, +4 hours, +8 hours, and tomorrow at 12:00. The small images are loaded from flash, the big image is fetched from my personal API. The reason the big images are in the API is because there is not enough storage on the flash. Feel free to use the api as is if you dont want to host your own.
I have made a wallmount for the weatherstation, that can be 3D-printed.
The wallmount can be downloaded here: fran on MakerWorld
- Weather Data: Retrieves weather data from the MET Weather API.
- ePaper Display: Utilizes a Waveshare 5.65-inch ePaper display to display weather updates.
- Wi-Fi Connectivity: Connects to Wi-Fi to fetch the latest weather information.
- Real-Time Updates: Updates weather data and display in real-time.
- Customizable Location: Easily set your location to get accurate weather data.
- MicroPython: The project is written in MicroPython.
- Raspberry Pi Pico 2 W: The microcontroller used for this project.
- Waveshare 5.65-inch ePaper Display: The display used to show weather data.
- Raspberry Pi Pico 2 W
- Waveshare 5.65-inch ePaper display
- MicroPython firmware installed on the Pico W
- Wi-Fi network
-
Clone the Repository:
git clone https://github.com/frederik-andersen/micropython-ePaperWeatherStation.git
-
Set Up Wi-Fi Credentials:
Open datafetcher.py and replace the placeholders with your actual Wi-Fi SSID and password:_SSID = "WIFI_SSID_PLACEHOLDER" _WIFI_TOKEN = "WIFI_PASSWORD_PLACEHOLDER" -
Change header for MET API:
Open datafetcher.py and replace the placeholder with your email. This is required by MET API.self.USER_AGENT_HEADER = {'User-Agent': 'pico-ePaper-weather-station v.1.0.0 PLACEHOLDER@PLACEHOLDER.com'} -
Add your location:
- Default location is "drammen".
- Go get the latitude, longitude and altitude for the place you want weather data.
- Add your location to the locations dictionary in DataFetcher.
self.locations = { 'drammen': {'latitude': 59.7396, 'longitude': 10.2046, 'altitude': 3}, 'oslo': {'latitude': 59.9108, 'longitude': 10.7577, 'altitude': 4} }
-
Input correct location in main.py:
In main.py input the new location to DataFetcher.data = DataFetcher('drammen')
-
Optional: Translate to your language:
The code is in English, but in ScreenManager the text is in Norwegian. Text to be translated:
- "Nå" -> "Now"
- "i morgen" -> "tomorrow"
- "Sist oppdatert" -> "Last update"
- Optional: Run your own api:
- The code uses my API to store large images.
- If you want other images than mine, you should run your own API. See the flask_api folder and run it on pythonanywhere.com.
- Upload the Code to Pico W:
- Use a tool like Thonny or rshell to upload the code to your Raspberry Pi Pico 2 W.
- Do not upload the screenshots and flask_api directories.
-
Power On the Pico W:
- Connect your Raspberry Pi Pico W to a power source.
-
View Weather Data:
- The ePaper display will show the current weather data for your specified location. The data is updated every hour, and the screen is cleared once every 24 hours at 02:00 UTC to prevent ghosting.
- Handling wintertime and summertime. Wintertime is now hardcoded in TimeManager.
-
The ePaper driver is changed so border color can be changed, and the buffer is allocated outside the class. This is to prevent memory leaks that happend with the original driver.
-
EasyWriter is a library written by me to make it easier to add text and binary images to the screen.
-
Image to byte array is used to convert ditered png files to binaries.
-
New epaper driver is used to set the border color
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Peter Hinch: For the writer class used for text rendering and font_to_py for fonts.
- Waveshare: For the ePaper display and driver.
- Christopher Arndt: For mrequests. A better requests library.
- MET Weather API: The weather api used for all data.
- MET Weather API icons: For the weather images.
- Pythonanywhere: For free python flask hosting.
