Installing the software

Now that we have our OLED display wired up we can get on and install the necessary software we will need to program it. As I have said before the tools we need to do so aren't included in the default Raspbian image so we are going to need to install them.

The Python library that we will be using to communicate with our display is called py-gaugette and it was created by Guy Carpenter, who has kindly given me permission to use it. The process of installing py-gaugette is quite complicated because it has a lot of dependencies (ie: software that it depends on)... Because it is complicated I have made a simple script to automate the entire process for us. But before we can download and install it we will need to do a few simple commands and modifications. Lets get going.

1) Boot up your Raspberry Pi and login. There will be no need to start up the desktop - all of the stuff we need to do can be accomplished in the terminal!
2) The first thing that we are going to need to install is a piece of software called 'git-core'. This will allow us to download my script and example Python programs. Most of you will already have it but for those that don't simply download it with the command below. If yours is already up to date you will see something like this, however if you need to install it then when it prompts you if you want to continue hit 'y' and then enter!
Download: file
sudo apt-get install git-core
3) Now we need to unblock the SPI pins on the Pi. Sadly these are unusable by default and if we don't unblock them then we will not be able to communicate with our OLED display!

In order to make our SPI pins usable we need to edit the blacklist text file so that it doesn't turn them off when the Pi starts up. This is really easy to do!

To access the text file we will need to use this command:
Download: file
sudo nano /etc/modprobe.d/raspi-blacklist.conf
You should see ^ this appear on your screen. What we are going to do is change this line:
Download: file
blacklist spi-bcm2708
And here is what we are going to change it to... Simply add a hash in front of that line:
Download: file
# blacklist spi-bcm2708
So it should now look like this:

Now exit and save by pressing ctrl+x and when it prompts you whether you want to save press y and then enter...

Finally there's one last step to make sure the I2C kernel modules are loaded at boot.  In the nano text editor open the following file as root with sudo:

sudo nano /etc/modules

Make sure the following two lines are listed in the file, add them if they are not:

i2c-bcm2708
i2c-dev

Then save and exit the editor just like you did for the previous file.


4) The Pi needs to reboot for these additions to take effect so you can do with this command:

Download: file
sudo reboot
5) So now that your Pi has rebooted login again. Remember that you do not need to start up the desktop!

We can now grab that all-in-one script that I mentioned earlier! It is available in my GitHub repository and so you can download it on to your Pi with this command:
Download: file
git clone https://github.com/the-raspberry-pi-guy/OLED
6) Now that we have downloaded my script and my Python examples we can run the installation process. First change into the OLED directory with the command:
Download: file
cd OLED
If we list the contents of that directory we will see a brief README, my python-examples folder and the installation script.
7) Now let's run the installation script, named 'OLEDinstall.sh'... This will download py-gaugette and all its dependencies. It will take around 7 minutes to download and install everything. Run it with this command:
Download: file
sh OLEDinstall.sh


And that is it! Everything we need should now be installed - including the Python examples that I have included. Lets have a look at those and actually get our display to do something!
This guide was first published on Jan 03, 2014. It was last updated on Jan 03, 2014. This page (Installing the software) was last updated on Jul 16, 2019.