Aug 29 2015 0

Raspberry Pi Sense HAT

The [Sense HAT] 1 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.

Raspberry Pi Sense HATRaspberry Pi Sense HAT

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

Setting it up

  1. Create new SD Card with Raspbian
  2. Connect a keyboard, mouse, network and HDMI cable and the Sense HAT module to the Raspberry Pi and boot it up
  3. Install the Python library which providing easy access to everything on the board

The installation of the Python library can be performed by executing the following command

wget -O - http://www.raspberrypi.org/files/astro-pi/astro-pi-install.sh --no-check-certificate | bash

On my Raspberry Pi 2 it took approximately 3 minutes (including the reboot) to get the libraries installed.

Examples

On the page Getting started with Astro Pi (part of a collection of guides) provides an easy guide how to code for the Sense HAT and make use of its capabilities.

The GitHub repository python-sense-hat provides several example Python scripts that will have you up and running in no time. You can install these examples easily by cloning the GitHub repository

pi@astropi ~ $ git clone https://github.com/RPi-Distro/python-sense-hat.git
Cloning into 'python-sense-hat'...
remote: Counting objects: 470, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 470 (delta 5), reused 0 (delta 0), pack-reused 447
Receiving objects: 100% (470/470), 91.20 KiB, done.
Resolving deltas: 100% (232/232), done.

The example rainbow.py gives a good demonstration of the colour spectrum of the 8×8 RGB LED matrix. You can execute the script by entering the following commands

pi@astropi ~/python-sense-hat/examples $ cd
pi@astropi ~ $ cd python-sense-hat/examples/
pi@astropi ~/python-sense-hat/examples $ python rainbow.py

When you are done staring at the 8×8 RGB LED matrix press Ctrl+C to kill/stop the script.

You will be left with the last state of the rainbow, so to clear the 8×8 RGB LED matrix execute the text_scroll.py script. It will scroll the text One small step for Pi!” and leave it blank when it’s done.

pi@astropi ~/python-sense-hat/examples $ python text_scroll.py

Time to dust of the old’ data logging project… But that’s for another time


Previous post
Improving Wi-Fi at home I live in an apartment which has a lot of square feet. The modem of my ISP is located in the Closet/Metering cupboard, meaning the Wi-Fi
Next post
Simple web server Sometimes you just need a simple web server to quickly test a piece of HTML or CSS before uploading it to its final location. Both Python and PHP
This blog is powered by Blot