Make a Mini Weather Station With a Raspberry Pi

Hardware components:
R8326274 01
Raspberry Pi 2 Model B
× 1
Front 1024x1024
Raspberry Pi Sense HAT
× 1

Make a Mini Weather Station With a Raspberry Pi


Today I’m going to show you how to make sort of a mini weather station with a Raspberry Pi. This is an ongoing project of mine that I’ve been tinkering with so I’ll share my learning with you.

A core part of the “Internet of Things” movement is the idea of devices that gather data and send it to the Internet. That data is then acted on or observed for later. It’s a simple concept and has been going on for a while but lately it’s been getting cheaper and easier to do. This project is a great example of that.

Once you complete this your Raspberry Pi will measure:

  • Temperature
  • Humidity
  • Barometric pressure

You can send your results to:

  • Google Spreadsheet on your Google Drive

What you’ll need

For this project you will need:

  • Raspberry Pi 3, 2 or Model B+, Zero
  • Sense HAT

The Sense Hat

The Sense HAT is an add-on board for Raspberry Pi, made especially for the Astro Pi mission – it’s going to the International Space Station in December 2015 – and is now available to buy…

The Sense HAT has an 8×8 RGB LED matrix, a five-button joystick and includes the following sensors:

  • Gyroscope
  • Accelerometer
  • Magnetometer
  • Temperature
  • Barometric pressure
  • Humidity

Technical Specification

  • Gyroscope – angular rate sensor: +/-245/500/2000dps
  • Accelerometer – Linear acceleration sensor: +/-2/4/8/16 g
  • Magnetometer – Magnetic Sensor: +/- 4/8/12/16 gauss
  • Barometer: 260 – 1260 hPa absolute range (accuracy depends on the temperature and pressure, +/- 0.1 hPa under normal conditions)
  • Temperature sensor (Temperature accurate to +/- 2 degC in the 0-65 degC range)
  • Relative Humidity sensor (accurate to +/- 4.5% in the 20-80%rH range, accurate to +/- 0.5 degC in 15-40 degC range)
  • 8×8 LED matrix display
  • Small 5 button joystick

Installing the software

Install the Sense HAT software by opening a Terminal window and entering the following commands (while connected to the Internet):

sudo apt-get update

sudo apt-get install sense-hat

sudo pip-3.2 install pillow


Hello world example:

from sense_hat import SenseHat

sense = SenseHat()

sense.show_message("Hello world!")

Gather data from all the sensors

Here we will gather the data from all the sensors using an application I wrote. This reader will gather all the information and display it on 8×8 RGB LED matrix, or send it out to the internet.

Google Spreadsheets

You can output data to a Google Spreadsheet using my application. You will need to setup OAuth with Google, and create a JSON file. Instructions are here:

You will want to store the generated JSON file in the MiniWeatherStation.pyfolder.

One thing you will need to is open up that OAuth JSON file and look for “client_email”. It should look like this:

“client_email”: “[email protected]”,

Take note of that email address value and go to your Google spreadsheet in a web browser. Using the File -> Share… menu item share the spreadsheet with read and write access to the email address found above. Make sure to share your spreadsheet or you will not be able to update it with the script!

 Sharing settings of Make a Mini Weather Station With a Raspberry Pi

Next, open up the file and edit:


Replace the GDOCS_OOAUTH_JSON value with the name of your JSON file you downloaded. Set the GDOCS_SPREADSHEET_NAME with the name of your sheet. Save it. Type in :

sudo python

If all your information is correct, it will start running and adding rows to your spreadsheet every 30 seconds:

Read More: Make a Mini Weather Station With a Raspberry Pi


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top