Pi Prep

Update Your Pi to the Latest Raspbian

Your Pi will need to be running the latest version of Raspbian. This tutorial was written using Raspbian Buster (July 2019). Checkout our guide for Preparing an SD Card for your Raspberry Pi if you have not done so already. After the installation is complete be sure and run the following commands to make confirm your installation packages are up to date. 

Download: file
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y

Install adafruit-blinka

Run the following command to install the adafruit_blinka CircuitPython Libraries.

Download: file
pip3 install adafruit-blinka

Enable 1-Wire Interface

You'll need to start by enabling support for the DS18B20 1-Wire subsystem.

Visit this page for instructions on using raspi-config to enable 1-Wire support.

Download: file
sudo raspi-config
<Interfacing Options>
<1-Wire> Enable/Disable
<Back>
<Finish>

Enable I2C Interface

Our clock and 7-segment display work using I2C bus which the Raspberry Pi supports, but it needs to be enabled. This page has step by step instructions. Enabling I2C is almost an identical process as enabling 1-Wire except that a reboot is required and we want to make sure to install the optional packages to scan the bus. 

Download: file
sudo raspi-config
<Interfacing Options>
<I2C> Enable/Disable
<Enable>
<Back>
<Finish>
sudo reboot

Test the I2C Bus

Download: file
lsmod | grep -i i2c

Now that our Pi has rebooted we can confirm that the correct I2C modules have loaded with the following command.

Download: file
sudo i2cdetect -y 1

This shows that two I2C addresses are in use – 0x68 and 0x70.

Note that if you are using one of the very first Raspberry Pis (a 256MB Raspberry Pi Model B) then you will need to change the last digit of the command port 1 to port 0. 

Install the HT16K33 Library

The software for this project uses the Adafruit code for driving the 7 segment display. 

Download: file
pip3 install adafruit-circuitpython-ht16k33
This guide was first published on Apr 03, 2013. It was last updated on Apr 03, 2013. This page (Pi Prep) was last updated on Sep 18, 2019.