
In this article we have discovered the Sense HAT. Now let’s see how we can program it. In this article, we will see how to get data from the environmental sensors (temperature, pressure, humidity) to create a simple weather station.
The Sense HAT comes with a Python library developed by the Raspberry Pi team. This Python library, called sense_hat, is available HERE. The API reference guide is available HERE.
The weather station is based on the reading of the environmental sensors. Fetching the value of environmental sensors is very simple. Just create a sense HAT object and get the value of sensors as follows:
from sense_hat import SenseHat sense = SenseHat() temperature = sense.get_temperature_from_humidity() humidity = sense.get_humidity() pressure = sense.get_pressure()
The temperature is in degrees celcius, the humidity is in percent and the pressure in millibars.
I coded a simple weather station demo with GeeXLab. The standalone demo can be downloaded here:
Weather Station 0.1.0 – OpenGL 2.1 (Raspbian Jessie)
Weather Station 0.1.0 – OpenGL ES 2.0
A thread is available HERE for any feedback or bug-report.
To launch the weather station, unzip the archive and start GeeXLab. The weather station demo will be automatically loaded. The source code (Python) of the weather station can be found in the weather_station_src/ folder.

The weather station demo is also available in the gl-21/rpi/sense_hat_python/weather_station_src/ folder of GeeXLab’s code sample pack.

The temperature / humidity sensor is located on the Sense HAT board and will display an higher value than the real one if the Sense HAT is directly connected to the GPIO connector of the Raspberry Pi.

For example, in my lab, the temperature is around 20°C and the temperature sensor value is around 30°C…
This wrong value is caused by the heat produced by the Raspberry Pi board. To fix this issue, I separated the Sense HAT from the RPi with cables (40-pin connector + 40-pin male-male 300mm jumper):


With that patch, the temperature is correct.

This project creates a simple DIY Weather Station, thanks for your helpful information.
One more question:
Can I use Sense HAT and PI to track weather in a different room, this method seems like can only track weather for current room, and is hard to monitor than other budgets La Crosse weather stations.
This LEDs are absolutely useless, if this shield is intended as a weather station. What can be displayed on 8×8 matrix? OLED or TFT will be there much better.
I was looking for nice weather shield for RPi, and there is nothing on the marker.