RPi Weather Station and Digital Clock

5,548

51

7

About: Hi, I love electronics, 3d printing and sharing what i make. I mostly try making useful things, but sometimes I also make some just for fun and for learning something new. And if you like what you see, foll...

This is a quick and easy project to make, and a nice display to show off. It displays both the time, weather condition and temperature. And if you like what you see, follow me on Instagram and Twitter (@Anders644PI) to keep up with what I make.

The code is based on StuffWithKirby's useful code on reading JSON weather data in python, and SteveAmor on Github's super cool SenseHat digital clock code.

You will need:

  • A Raspberry Pi 3(Any 40-pin Raspberry Pi will work)
  • A Raspberry Pi SenseHat(Or any other display, to display the weather data on)
  • A 5V 2.4A Power Supply for Raspberry Pi
  • A 8GB or higher Micro SD Card with the latest version of Raspian
  • A 3D printer and a spools of any color PLA (Optional)
  • This set of screws and standoffs (Optional: You only need this if you want to use the diffuser)

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Weather Data

We get the weather data from OpenWeatherMap.org, but you could of course add a termister or like to the Pi, and read data from that directly, if you really wanted to.

  1. Start by making a FREE account on OpenWeatherMap.org.
  2. Then copy your api-key to use later.
  3. Now download and open the city.list.json file, search for your city, and then copy the city-id for later.

Step 2: Setting Up the Pi

1. In the terminal on the Pi (with connetion to the internet) run this command, to get the Pi setup:

sudo apt-get update && sudo apt-get upgrade

2. Now download my GitHub repo and edit the script:

git clone https://github.com/Anders644PI/RPi-SenseHat-Digital-Clock-and-Weather-Station.git
cd RPi-SenseHat-Digital-Clock-and-Weather-Station nano RPi_Weather_Station.py

3. In the RPi_Weather_Station.py paste in your api-key and your city-id. You can also change the units to imperial (fahrenheit), if you want that over metric (degrees).

4. Now run it, and it should work great. But if you have issues, feel free to tell me in the comments, and I will be happy to help.

sudo python RPi_Weather_Station.py

Step 3: 3D Printed Accessories

This step is optional, by now you already have a functional weather station. But when i have access to a 3D-printer, I better use it.

1. First upgrade is a diffuser for the SenseHat, that can be screwed to the Hat with two screws and two standoffs for the Pi. I used some screws i had laying around, but some of these should work as well. Download file here: https://www.thingiverse.com/thing:2930576

2. Second upgrade is a vertical stand for the Pi. This one requires no screws, it just slides onto the USB-ports. This does make the USB- and Ethernetports not functional. Download file here: https://www.thingiverse.com/thing:2930597

Step 4: The Result

Congratulations, you're done!!! You should now have a nice RPi weather station to sit on your desk, and inform you with useful weather information.

I would love to see what you make with this project, so please tag me at @anders644pi, on Twitter or Instagram, if you do make it. And please, if you like this project, vote for me in the Microcontroller Contest: https://www.instructables.com/contest/microcontroller2018/.

Microcontroller Contest

Participated in the
Microcontroller Contest

Share

Recommendations

  • Indoor Lighting Contest

    Indoor Lighting Contest
  • Make It Fly Challenge

    Make It Fly Challenge
  • Growing Beyond Earth Maker Contest

    Growing Beyond Earth Maker Contest

7 Discussions

0
None
ToniFIN83

2 months ago

Getting this error:
pi@raspberrypi:~/RPi-SenseHat-Digital-Clock-and-Weather-Station $ sudo python RPi_Weather_Station.py
Traceback (most recent call last):
File "RPi_Weather_Station.py", line 20, in <module>
print (weather['main']['temp'])
KeyError: 'main'


Running on Pi 3+ and latest Raspian stretch full

Any hints?

0
None
Anders644PIkimalajoy

Reply 7 months ago

I didn't have that problem, but glad you got it to work.

0
None
btwebz

Question 7 months ago on Introduction

Hi there,
Really like your project. Thanks for publishing it. The project was just what I was looking for. I am having one small problem though. The weather data is not updating. I can make it update manually by stopping the program and then starting it again but would be great if I could get it to update on its own. The time and date are working fine. It is just the weather. Would appreciate any help you could give me. Thanks again and best regards, Mark

3 answers
0
None
btwebzAnders644PI

Reply 7 months ago

Hi Anders644Pi
Thank you posting that update. It made the weather update successfully once every 50 minutes. I changed this in the code to update once a minute. Thank you very much again for your help!! I am very happy with my Weather station and Digital clock. Cheers Mark