The majority of this library will need to be run as sudo in Debian and Ubuntu.
Installing the Adafruit-BeagleBone-IO-Python (phew!) library is fairly simple. Let's make sure we have a good foundation setup first.

The most important part here is that you are using a Linux distribution with the 3.8 kernel. This kernel version made some fairly significant changes with how GPIO, PWM and ADC are accessed.

Connecting to your BeagleBone Black (SSH)

Let's ssh into the system so we can execute commands. Open your favorite terminal, and SSH into your BeagleBone Black (BBB). Note, Ubuntu does not come with Avahi-Daemon pre-installed. This means you need to use the IP address to connect and not the hostname.
Enter the the password (default is 'temppwd' most likely). You should now have a prompt available to enter commands.

Commands to setup and install BBIO

Now that you're connected to the BBB, you'll want to start with setting the date and time so that it's accurate. Copy and paste the following into your terminal (you may want to make it execute this on startup in the future):
sudo ntpdate pool.ntp.org
Next install the dependencies:
sudo apt-get update
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus -y
Depending on which version of Debian or Ubuntu you have installed, you may need a patched version of dtc.
The patched version of dtc (device-tree-compiler) includes the ability to compile overlays. The Adafruit_BBIO library compiles a set of overlays for SPI and UART. If you have no use for SPI or UART, you can skip this step of upgrading and patching dtc.

You can test dtc by following this guide. If you're not comfortable following the guide, it shouldn't cause any issues to just install the patched version of dtc.

You can view the overlays in our Github repository.

You can find the patched version of dtc with instructions here.
Once you've determined if you need the patched version of dtc, and installed it, execute the command to install BBIO:
sudo pip install Adafruit_BBIO

Test your Installation (optional)

You can optionally test if your installation was successful by simply trying to load one of the modules. Execute the following command from the console (not from within the python interpretor), it shouldn't throw any errors, but return one line:
sudo python -c "import Adafruit_BBIO.GPIO as GPIO; print GPIO"

#you should see this or similar:
<module 'Adafruit_BBIO.GPIO' from '/usr/local/lib/python2.7/dist-packages/Adafruit_BBIO/GPIO.so'>
You can also validate by executing the 'python' command to enable the interpreter, and run the following code (you can tell you're in the right place when you see the ">>>" in your terminal):
import Adafruit_BBIO.GPIO as GPIO; print GPIO

#you should see this or similar:
<module 'Adafruit_BBIO.GPIO' from '/usr/local/lib/python2.7/dist-packages/Adafruit_BBIO/GPIO.so'>

Manual Installation (optional)

You can also install BBIO by cloning the git repository. The following commands should get it installed as well:
sudo ntpdate pool.ntp.org
sudo apt-get update
sudo apt-get install build-essential python-dev python-pip python-smbus -y
git clone https://github.com/adafruit/adafruit-beaglebone-io-python.git
cd adafruit-beaglebone-io-python
sudo python setup.py install
cd ..
sudo rm -rf adafruit-beaglebone-io-python

This guide was first published on Jun 13, 2013. It was last updated on Mar 08, 2024.

This page (Installation on Debian and Ubuntu) was last updated on Mar 08, 2024.

Text editor powered by tinymce.