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).
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.
Turn on your device and make sure you have an internet connection.
Type this command into the command line:
\curl -sSL https://get.initialstate.com/python -o - | sudo bash
Follow the prompts – if you say “Y” to the “Create an example script?” prompt, then you can designate where you’d like the script and what you’d like to name it. Your Initial State username and password will also be requested so that it can autofill your Access Key. If you say “n” then a script won’t be created, but the streamer will be ready for use.
Either use your example script to get your Access Key or create one from scratch and start streaming!
## 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) while(1): for i in range(0,msgLen): value=ord(msg[i]) streamer.log("Letter",msg[i]) ppDAQC.setDOUTall(0,value) streamer.log("ASCII value", value) time.sleep(.5) streamer.close()
The while loop will run until you interrupt it with Ctrl-C.
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 ppDAQC.enableSWpower(0)