Installing Software

We have a Python library you can use to control DC and stepper motors, its probably the easiest way to get started, and python has support for multithreading which can be really handy when running multiple stepper motors at onces!

Before you start, you'll need to have the python smbus library installed as well as 'git', run apt-get install python-smbus git

Downloading the Code from Github

The easiest way to get the code onto your Pi is to hook up an Ethernet cable or with a WiFi setup, and clone it directly using 'git', which is installed by default on most distros.

Simply run the following commands from an appropriate location (ex. "/home/pi"):

git clone
cd Adafruit-Motor-HAT-Python-Library

Install python-dev if you havent already:

sudo apt-get update
sudo apt-get install build-essential python-dev python-pip

Now install it with the setup install command:

sudo python install

That's it! Now you can get started with testing. Run

cd examples

from within the Motor HAT library folder, we have a couple examples to demonstrate the different types of motors and configurations. The next few pages will explain them

This guide was first published on Jan 27, 2015. It was last updated on Oct 22, 2018. This page (Installing Software) was last updated on Apr 24, 2018.