Code examples to power your SMARS creations

How to get the Python Library

Our SMARS Python library is available from github:

Log into your Raspberry pi and type the command below to get the library:

git clone

How to use the Python Library

The code you have downloaded contains several files: The SMARS Python library The Scratch listener, used to send messages to and from Scratch Used to set the servos to the correct position when attaching the servo horn Shows the pinout connections for the Raspberry Pi to PCA9685 Servo Driver A simple test program, use this to test you have built the quad robot correctly

The library uses the Adafruit PCA9685 servo driver board module, id you haven’t already install this, install it by typing the following from the raspberry pi command line:

sudo apt-get install git build-essential python-dev

cd ~

git clone

cd Adafruit_Python_PCA9685 sudo python install

if you have python3 installed:

sudo python3 install

You will need to install the following python libraries for this to work:

sudo apt-get install python-smbus sudo apt-get install i2c-tools

You will also need to enable the I2C interface using the raspberry pi configuration tool (raspi-config)

If you have Raspbian, not Occidentalis check /etc/modprobe.d/raspi-blacklist.conf and comment blacklist i2c-bcm2708 by running sudo nano /etc/modprobe.d/raspi-blacklist.conf and adding a # (if its not there).

If you’re running Wheezy or something-other-than-Occidentalis, you will need to add the following lines to /etc/modules



We'll never share your email with anyone else
Please let us know how to improve this page