Pi Co-op – #RaspberryPi / #Arduino add-on board review & a lie detector

The Pi Co-op is an expansion board that plugs straight onto the GPIO header and gives you immediate access to an Atmega328p microcontroller chip. Essentially, it gives you an onboard Arduino! It’s also pre-soldered which means you don’t need to know how to solder in order to get going.

Alan over at Dawn Robotics sent me one of these boards in the post and after a few days I finally found time to use it. This is a bit of a rambling review because of what I use to test it out, by the way.

Here’s a list of the features:

  • Atmega328p microcontroller preprogrammed with the Arduino Uno bootloader.
  • 10bit 8 channel Analog to Digital Converter (ADC).
  • Can be programmed directly from the Raspberry Pi using the free Arduino IDE.
  • Level shifted UART for fast communication between the Pi and Pi Co-op at a baud rate of up to 115200bps.
  • Atmega328p pins broken out to female headers for easy prototyping, just plug in wires or connect to a breadboard.
  • Power line incorporates the same type of fuse used on the Pi MicroUSB connector (700mA hold current, 1100mA trip current). This allows the Pi to be safely powered from an external 5V supply attached to the Pi Co-op.
  • Standard spacing of 2.54mm between all headers allows expansion boards to be created easily using copper stripboards.

If you don’t understand any of the next part of this review because you are not familiar with Arduinos and microcontrollers, suffice to say this is a brilliant way of getting started with analog (i.e. non-digital) sensors.

It’s fair to say that this is the easiest way I’ve found to use an Arduino with the Pi. Dawn Robotics give you a set of instructions to get up and running (which involves installing a fair bit of software) and soon I had the traditional ‘blink’ example script running. (For those of you who don’t know what this is – most Arduinos have an LED onboard connected to pin 13. The ‘blink’ script essentially just makes the LED flash. It’s the Arduino equivalent of ‘Hello World’). I should say at this point that the instructions given are simple, clear and they do work. All of this took me about 3/4 of an hour, most of which was spent waiting for software to install. This is acceptable because after you’ve got Git and some Python bits and pieces installed, you’re going to be controlling the Arduino from Python on the Pi anyway. Part of the software install puts something called Firmata onto the Arduino chip. This allows you to communicate with, and control, the chip via the serial line.

The next thing I did was to plug in an analog sensor to try and get some readings.  For this, I chose a GSR (Galvanic Skin Response) sensor that I’d got from Phenoptix. The GSR sensor measures the electrical conductiveness of your skin from two metal finger pads. They use GSR sensors in lie detectors because when you sweat your skin becomes more conductive – the same goes for any strong emotional response. They’re also used in sleep studies to record dream states. Anyway! So, after a bit of fiddling about with various wires, I plugged the 5V and Ground lines in and then plugged the signal line into analog 0. I then created the following script on the Pi:

import time

from PyMata.pymata import PyMata

# Sensor connected to analog pin 0
SENSOR=0

# Create an instance of PyMata.
SERIAL_PORT = "/dev/ttyS0"
firmata = PyMata( SERIAL_PORT, max_wait_time=5 )

# initialize the digital pin as an output.
firmata.set_pin_mode( SENSOR, firmata.INPUT, firmata.ANALOG )

time.sleep(1)

try:
  # run in a loop over and over again forever:
  while True:

    reading = firmata.analog_read(SENSOR)
    print (reading)
    time.sleep( 0.05 ) # wait for a second

except KeyboardInterrupt:
  # Catch exception raised by using Ctrl+C to quit
  pass

# close the interface down cleanly
firmata.close()

To start with I received readings in the mid-500s and then I put the finger sensors on and the readings dropped to the mid-400s. I tried it out on a couple of people, with varying sweaty hands and sweatier the hands the lower the reading. I also tried touching the metal pads to each other and got a reading of zero. I deduced that the more heightened the emotional response, and therefore the more sweaty the hands, the lower the reading. If you’re using it as a lie detector, you should ask some control questions to begin with to establish a ‘normal’ level and then move on to more emotional questions, or questions that might elicit a lie! You should find that the readings reduce during lies.

Anyway, back to the Pi Co-op. It took me all of 30 minutes to connect the GSR up and write the script – it was really that simple to go from the blink example to reading an analog sensors.

So, to sum up. It’s a very effective, very simple way of adding inputs, especially analog inputs, to your Pi. At under £20 delivered, it’s also cheaper than most of the alternatives out there. There are a few downsides, however, which in an effort to be balanced, I’ll tell you about. The Co-op doesn’t come with a lot of documentation, just enough to get you going (and it certainly beats the Gertduino for ease-of-reading-and-understanding). There are example scripts included with the code you download/install, but they aren’t specific to the Co-op so it can be a bit confusing. The Co-op also doesn’t come with an extended GPIO header which means that you can’t use the GPIO pins for anything else. This is a shame, really, as the only pins that are used are the TX/RX pins. By including an extended GPIO header, this would have increased the usability tremendously. The other minus note is that the broken out pins don’t correspond to the form factor of Arduino shields, but then again there might be compatibility issues with that and this is offset by making the Co-op smaller.

In terms of a score, I’ll have to rate it a 9/10 (it loses one point for hogging the GPIO but I can’t bring myself to dock another point for documentation as there is enough here to get you going and I’m sure the community can provide more examples as time goes by.)

You can buy a Co-op for £16.99 (+£2 delivery) from Dawn Robotics.

Oh, here’s a pretty good video about the Co-op!

2 comments for “Pi Co-op – #RaspberryPi / #Arduino add-on board review & a lie detector

  1. I love the concept but feel a trick was missed by not making it Arduino shield compatible but maybe it would be possible for to make a low-cost adapter plate to standardise it

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.