Raspberry Pi Sense Hat, Locating and using the sense-hat.py module

Raspberry pi sense hat modules

In my last post I introduced the Raspberry Pi sense hat, a hardware module for the Raspberry pi development board that contains the following hardware.

Raspberry Pi Sense hat

8×8 RGB LED matrix,
five-button joystick,
40 pin pass-through GPIO connector

Along with the following environmental sensors:

Barometric pressure

I also included instructions on how to install the supporting drivers and software, this software includes python 2 and 3 modules along with examples and documentation.

If your not use to developing on a Linux system such as the Raspberry pi then you can easily become lost very early in the cycle, at the point where you need to know what objects/files where installed during the installation process and where these objects have been placed.

This knowledge is not made any easier with with the raspberry pi’s default distribution of Linux “Raspbian” because no software package database management application is installed as default.

In order to find more details for any of your installed packages along with installing new software packages you require, I find the synaptic package manager very good for the Debian Linux package format.

To install synaptic open a command terminal and type the following command :

sudo apt-get install synaptic

Because the aptitude and apt-get applications both allow you to install and maintain Debian linux software packages they are fully integrated with the standard Debian package management datadase.

Synaptic is a GUI based front end to this same package management database system and as such can perform the same functions as the command line based utilities. Synaptic however wins over using the command line in two main areas, these being the ability to search the online package repository database for any given Linux distribution, along with the ability to graphically display information about currently installed packages including (applications, drivers and system/development libraries).

So then in order to find out any details on the installed Sensor-Hat objects including the Python modules you will use, you use the Synaptic package manager to search for any packages installed on your system by firstly clicking on the package “Status” button at the bottom left of the synaptic application window , then by highlighting the status of “installed”.

To search for any installed package objects and files that relate to “senyouse-hat” packages you click on the “Search” icon on the toolbar and enter the text of “sense-hat”. After a few seconds/mins the following package objests will be returned, if you correctly installed the sense-hat packages to support the raspberry pi sense-hat.

you should see the following packages listed :


as you can see from the images below , in the package listing window you will also get details of each packages ( Name, Installed Version, Latest Version and a Description ).


To find out more details for a package you simple right click on the package name and then click on the details menu option in the drop down menu.

As you can see in the image above, this presents you with a info window with the heading of ( Common, Dependencies, Installed files, Versions and Description ), you can go read these details for yourself in order to get familiar with the details they show, here I am only interested in finding the installed files so have show this window only.

You can see from the listing of the files that it is a full list of any related object to the packages installed and that it contains files in the “usr/lib/Python3/dist-packages/*” path.

If you have coded using Python then you will be familiar with the concept of importing python modules into your code, these modules most likely contain pre-writing python objects that can be used within your own program. This is not any different with the support code provided with hardware devices like the Raspberry pi sense hat.

The Python module that you import for your sense-hat related code is called “sense-hat.py” and you can see this file listed in the images above. It is a standard python program and can be edited and viewed by any standard python IDE or even by command line editors like VIM or EMACS.


Here I am using and IDE called Geany which has a great interface when related to Python code as it can show all ( Imported modules, defined functions and objects you have defined ), you can see above that it is also fully aware of Pythons syntax needs such as indention.

By both locating you Python modules such as “Sense-hat.py” you can see exactly what functions it has and hopefully if the coder has used good comments – exactly what each function does.


In the case of the sense-hat.py module, it has also been documented online here , however it is still well worth following what I have done above, as there is nothing as good as reading through the python code to get the feel of what your program will actually be doing when it both imports the module “sense-hat.py” and then calls on its objects and functions.

This entry was posted in Linux Software Repositories, Programming skills, Python, Raspberry pi and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s