Raspberry Pi Add-On Board: LEDs, Button, ADC

If you thought that Raspberry Pi’s were cool, just wait till you see all of the things you can add to them to expand their functionality.  And if you already knew about all of the things you can add to them, just wait till you see this one!
raspberry pi add-on, pi-plate ppdaqc board

Pi-Plates are stackable Raspberry Pi add-on circuit boards that come with all sorts of goodies.  The one I have pictures of here is the ppDAQC board, and it comes with 7 digital outputs, 8 analog to digital inputs, 8 digital inputs, 2 analog outputs and 7 indicator LEDs.  My other favorite features are the programmable pushbutton and bicolor LED (but that’s just because I’m easily entertained).

raspberry pi add-on board, pi-plates ppdaqc



To show you how easy it is to set this bad boy up, I’m going to tell you how right now.  The Pi-Plate just stacks on top of the Pi’s GPIO pins.  It makes use of the Pi’s SPI feature, so make sure that it’s enabled by entering:

sudo nano /etc/modprobe.d/raspi-blacklist.conf

And commenting out blacklist spi-bcm2708.

If you had to comment it out, reboot your Pi (sudo reboot). spi_bcm2708 should now be listed if you enter lsmod in the command line.

If you don’t already have the SPI and GPIO libraries, you’ll need to update and install them:

sudo apt-get update
sudo apt-get install python-dev
sudo apt-get install python-rpi.gpio

And now we want to make the ports accessible in Python:

mkdir python-spi
cd python-spi
wget https://raw.github.com/doceme/py-spidev/master/setup.py
wget https://raw.github.com/doceme/py-spidev/master/spidev_module.c
sudo python setup.py install

Finally, the ppDAQC module needs to be installed. It uses pip, so if you don’t already have that, be sure to run the first line:

sudo apt-get install python-pip
sudo pip install http://pi-plates.com/downloads/pi-plates.tar.gz

Now let’s run a Hello World!  The guys at Pi-Plates provide a nice beginner script that outputs “Hello World” in ASCII through the built-in LEDs.  I thought this was pretty neat, so I also inserted some streamer statements so I could see the ASCII values of each letter.  Want to try out Initial State’s data streamer?  See how to install it below.

data streaming icon
The script is very simple – we just import the ppDAQC module, the ISStreamer module and time.  Then we set up the streamer and a while loop that converts each letter in “Hello World” into an ASCII value that is output to the Pi-Plate’s LEDs.
## Import the Pi-Plates ppDAQC module
import piplates.ppDAQC as ppDAQC
## Import time for delays
import time
## Import the ISStreamer module
from ISStreamer.Streamer import Streamer

## Streamer constructor, this will create a bucket called Computer Performance
## you'll be able to see this name in your list of logs on initialstate.com
## your access_key is a secret and is specific to you, don't share it!
streamer = Streamer(bucket_name="Pi-Plates Hello World",access_key="[Your Access Key]")

msg='Hello World'
msgLen = len(msg)

## This will run until you interrupt it (Ctrl-C)
    for i in range(0,msgLen):
        streamer.log("ASCII value", value)


The while loop will run until you interrupt it with Ctrl-C.

raspberry pi add-on, pi-plates ppdaqc board, initial state streamer, hello world test
You can see the Pi-Plate’s built-in LEDs lit up in the top left corner of the board. On the right you can see how ASCII value changes with each letter inside of Initial State.

Now you’ve made your board light up!  Let’s use my other favorite built-in feature – the programmable button.  The Pi-Plate makes it very very easy to turn this button into the one thing I always wish my Raspberry Pi had – a shutdown button!

First you need to install a program that runs in the background of your Pi called ppPower.  This is easy to do with these commands:

wget http://pi-plates.com/downloads/ppPower-1.00.tar.gz
tar -xzf ppPower-1.00.tar.gz
cd ppPower-1.00
sudo ./install-ppPower

Now you just need to reboot your Pi (sudo reboot), and associate the button with this program. Enter Python with sudo python and enter the following lines:

import piplates.ppDAQC as ppDAQC
Aaaaaaaand it was that easy to set up a functioning shutdown button!  It will work every time you turn on your Pi with the Pi-Plate attached from here on out.  The Pi-Plate even provides a convenient LED indicator that turns orange while the Pi is shutting down and red when it is safe to remove the power.
raspberry pi add-on, pi-plates ppdaqc board, programmable button
Here you can see the magical blue button
To read more about the button and what this particular Pi-Plate can do, be sure to visit this users guide.
That’s all for now on the Pi-Plate, but be on the lookout for future tutorials – this little guy is waaaaaay more powerful than what I’ve shown!

3 comments On Raspberry Pi Add-On Board: LEDs, Button, ADC

Leave a reply:

Your email address will not be published.

Site Footer