Raspberry Pi weather display using Waveshare e-paper display and Open Weather Map API

AbnormalDistributions, updated 🕥 2022-11-14 14:50:25

E-paper Weather Display


Raspberry Pi weather display using Waveshare e-paper 7.5 inch display, Open Weather Map API, and Python.

If you like what you see, consider buying me a coffee.

Versions

Version 1.0

  • Initial Commit.

Version 1.1

  • Switched to more legible icons.

Version 1.2

  • Added support for connection errors.
  • Added support for HTTP errors.
  • Added "dispay_error" fuction to display respective errors if present.

Version 1.3

  • Added option to store retreived weather data in CSV file.

Version 1.4

  • Updated to use all 480 vertical pixels instead of just 450.

Version 1.5

  • Fixed error where "TAKEOUT TRASH TODAY!" was writing in incorrect font size.

Version 1.6

  • Increased size of fonts for "Humidity" and "Wind" for better legibility.

Version 1.7

  • Added clear screen function to reduce possibility of burn-in.
  • Changed refresh time from 300 to 600 seconds.

Setup

  1. The first thing you need is a free API key from https://home.openweathermap.org/users/sign_up.
  2. Open 'weather.py' and replace **Key Here** with your API key.
  3. **Location** can be left as it is unless you want to add it to your display.
  4. Get your **longitude** and **lattitude** using I used https://www.latlong.net and put that in as well.
  5. Set CSV_OPTION to False if you would not like weather data appended to 'records.csv' after every refresh.
  6. There is also a reminder for taking out the trash near the end of the script that you will want to change if your trash pickup doesn't come on Monday and Thursday like mine. :)

That's about it. Run the python file and you should see output on the display. # Note If you are not using a 7.5 inch Version 2 display, you will want to replace 'epd7in5_V2.py' in the 'lib' folder with whichever one you have from https://github.com/waveshare/e-Paper/tree/master/RaspberryPi_JetsonNano/python/lib/waveshare_epd
Fairly extensive adjustments will have to be made for other sized screens. # Parts
  • https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT
  • Raspberry Pi 3, but this will run on any of them except the Pi Zero that doesn't have soldered headers.
  • SD card for the Pi at least 8 GB.
  • Power supply for the Pi.
  • 5 x 7 inch photo frame from a thrift store.

Credit

Icon designs are originally by [Erik Flowers] (https://erikflowers.github.io/weather-icons/). Some icons have been modified.

Licensing

  • Weather Icons licensed under [SIL OFL 1.1](http://scripts.sil.org/OFL)
  • Code licensed under [MIT License](http://opensource.org/licenses/mit-license.html)
  • Documentation licensed under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0)
    • Issues

      Stops Updating

      opened on 2023-03-17 18:15:06 by pjockey

      The display stops updating and it does not appear to be at any specific time. The code is still running, but the display as stopped getting the information. A quick ctrl+c and then the up arrow, enter and the code starts all over again and the display updates.

      Do you have any idea what might be happening? Thanks

      Touch input

      opened on 2022-01-02 22:35:47 by freekeys

      Hello, love this - thank you for sharing and documenting. Have you explored the touch functionality of the display at all - for user input? I'm interested in using this but struggling to find any docs. Thanks!

      Stops Updating at 0300

      opened on 2021-11-15 20:22:59 by pjockey

      I started anew with Bullseye and reinstalled the program using Git. Updated all of the required info in weather.py and have been running the script for a bout 4 days and every morning, the last update is just before 0300. Terminal states

      Attempting to connect to OWM. Connection to OWM successful. Connection to Open Weather successful. Weather data appended to CSV. Clearning screen to avoid burn-in. (I just see there is a spelling mistake)

      I stop the script and and restart and off it goes.

      Is there something I should be looking at to see why the script stops at 0300?

      FileNotFoundError

      opened on 2021-11-03 14:59:59 by Henry-277

      Hi!

      I keep getting those Errors:

      Traceback (most recent call last): File "/home/pi/Downloads/e_paper_weather_display-master/weather.py", line 12, in from waveshare_epd import epd7in5_V2 File "lib/waveshare_epd/epd7in5_V2.py", line 32, in from . import epdconfig File "lib/waveshare_epd/epdconfig.py", line 146, in implementation = RaspberryPi() File "lib/waveshare_epd/epdconfig.py", line 50, in init self.SPI = spidev.SpiDev(0, 0) FileNotFoundError: [Errno 2] No such file or directory

      Can someone help? I am a bit lost :(

      I made a 2.9-inch screen adaptation

      opened on 2021-05-25 14:26:07 by qqqys

      I like this project very much, but I only have a 2.9-inch screen, so I re-adjusted the relevant coordinates inside so that it can also be used on this small screen.

      Error with CSV and Changing units to Metric

      opened on 2021-02-15 08:15:51 by wt9bind

      Hi,

      Thanks so much for building this code. I have purchased the e-Paper HAT and installed the code, but I am getting two issues:

      1. Traceback (most recent call last): File "weater.py", Line 145, in with open('records.csv', 'a', newline='') as csv_file: TypeError: 'newline' is an invalid keyword argument for this function and;
      2. If I change line 80 to 'Metric' it still shows Fahrenheit. Do I need to change this to Metric, then go through and change all references to 'F' to 'C'?

      Thank you!

      Releases

      v1.7 2020-10-08 04:06:39

      Added clear screen function to reduce possibility of burn-in. Changed refresh time from 300 to 600 seconds.

      v1.6 2020-09-28 20:14:25

      Increased size of fonts for Humidity and Wind for better legibility.

      v1.5 2020-09-28 14:05:15

      Fixed error where "TAKE OUT TRASH TODAY!" was writing the wrong font size.

      v1.4 2020-09-26 03:58:46

      Updated to use full 480 pixels of the screen instead of just 450.

      v1.3 2020-09-23 05:27:54

      Added more legible weather icons, error outputs to display for HTTP and connection errors, and option to append new weather data to CSV file.

James Steele Howard

Physician and Public Health Data Scientist

GitHub Repository

weather waveshare python raspberry-pi raspberrypi epaper eink e-ink e-paper