Weather display project, featuring a Inky wHAT e-ink display and a Raspberry Pi.
- The Weather Report is meant to display the weather in a more visually pleasing layout, which will combine assets such as hourly readings, date and time, and whatever comes along.
Current weather information
- Temperature
- Highs and Lows
- Weather conditions (rainy, sunny, etc.)
- Humidity
- Wind
- Icon depicting weather conditions
Hourly Weather Forecast (Every two hours, total of eight hours ahead)
- Temperature
- Future time of forecast
- One word weather conditions
- Raspberry Pi Zero W (Headers)
- Inky
- wHAT Display (Pimoroni Link)
- Impression 7-Color (for impression-main.py) (Pimoroni Link)
- Micro SD Card (min. 8GB)
- OpenWeatherMaps API
- One can get free API licenses by going to this link
- Enable I2C and SPI under raspi-config
sudo raspi-config
- Get and install git
sudo apt update
sudo apt install git
- Install libraries for Inky wHAT/Impression displays:
curl https://get.pimoroni.com/inky | bash
- Install pyOWM. pyOWM is a python library that utilizes the OpenWeatherMaps APIs.
pip install pyowm
- Copy the git repo for this project
git clone https://github.com/Hothomir/weather-report.git
- Go to the weather-report directory
cd weather-report
- Access configfile.ini using nano
nano configfile.ini
- Change the values to what is preferred. Example for Philadelphia, PA:
[OWM_API]
api = 123456789abcdefg
[Location]
latitude = 39.952583
longitude = -75.165222
city = Philadelphia
country = US
- Run the program while in the weather-report directory
Inky wHAT: python main.py
Inky Impression: python impression-main.py
To get new weather information in timed intervals, I've used crontab. Crontab schedules when to run the main.py file and is flexible with how often it should be run.
I've set up the crontab job to run every 30 minutes, so the display will refresh every 30 minutes. Example:
- Open crontab in terminal
crontab -e
- At the bottom of the crontab file, provide the following line:
*/30 * * * * python /home/pi/weather-report/main.py
- To refresh the display every 60 mins (every hour):
*/60 * * * * python /home/pi/weather-report/main.py
- Where the weather condition prints "Clear" in the image, it would be better to print the detailed condition for the current weather. However, need to see how to wrap text, as the detailed conditions print as one line and get cut off by the edge of the display.
pyOWM https://pyowm.readthedocs.io/en/latest/#
Pimoroni Inky https://github.com/pimoroni/inky