New Top

All Products By Category
lop3

Using the Lots of Pots Board for Raspberry Pi

lop3

Here’s how to use the Lots of Pots Board for the Raspberry Pi. The daughterboard (or shield; what are we calling Raspberry Pi add ons these days?) sits on top of the Raspberry Pi and breaks out the various GPIO pins in a useful and labeled manner. It also has an 8 channel MCP3008 analog to digital converter on board, which is hooked up to the hardware SPI pins on the GPIO header. This tutorial will describe the features of the board and cover how to read analog inputs from the ADC.

Using the Analog Inputs

Note that these instructions assume that you are running a stock Raspbian distribution. Some steps may not apply in other distributions; for example SPI is already enabled in Adafruit’s Occidentalis distro.

In Raspbian, hardware SPI and I2C are disabled by default. To enable it, edit the file:

This is a configuration file for modprobe, which is the program that loads kernel modules. The blacklist is a list of modules to skip loading on startup. Comment out the line:

Now call modprobe to load the kernel module that supports SPI (you can load the i2c module as well, since that header is pulled out on the LOP Board as well):

Spidev is a set of Python bindings that allow you to access the SPI port using the spidev kernel driver. The easiest way to install spidev is to use the Pip package manager, which you really should have if you haven’t installed it already. To install Pip, use the following commands (it’s always a good idea to update your package list to minimize problems):

And then install the spidev module:

That’s all there is to it. Here’s a sample test program that will read all 8 channels from the ADC on the LOP Board:

Now execute the program as superuser; you need root privileges to access the GPIO pins, which kind of makes sense if you think about it:

I originally created this board to serve as an interface for some work I’ve been doing with Pure Data. With a couple of friends (Shawn Greenlee and Elliot Clapp), we’ve made some iOS apps using Pure Data and libPd. The apps are all based on fictional historical synthesizers; we thought it would be fun to make actual hardware versions of them as well. The Lots of Pots Board will make it easy to replicate the DROM synthesizer; more on that to come.