Wednesday 29 January 2014

Installing Adafruit-BeagleBone-IO-Python on Ubuntu - Created by Justin Cooper

Installation of  Adafruit-BeagleBone-IO-Python on Ubuntu - Created by Justin Cooper

http://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/installation-on-ubuntu

The majority of this library will need to be run as sudo in 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.

Copy Code

ssh ubuntu@your.bbb.ip.address

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):

Copy Code

sudo ntpdate pool.ntp.org

Next install the dependencies:

Copy Code

sudo apt-get update
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus -y

Now, execute the command to install BBIO:

Copy Code

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:

Copy Code

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):

Copy Code

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:

Copy Code

sudo ntpdate pool.ntp.org
sudo apt-get update
sudo apt-get install build-essential python-dev python-pip python-smbus -y
git clone git://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

.END

No comments:

Post a Comment