|
|
Porcupines!This page describes building instructions for a sensing module, the porcupine, that can be taught to recognize motion and pose patterns. It has been designed to be as power-conserving as possible, so it should be ideal for a large variety of wearable and mobile applications. |
|
![]() |
![]() |
![]() |
The items in the green rows are for the battery board, those in blue are for the main porcupine board. Remember that the total cost at the bottom of the table does not include the time spent assembling it, nor the cost of the tools (like soldering stations, solder paste, etc.). Availability of all items was last checked at 15/07/2005.
| No | Order at | Order Code | Part No, Manufacturer | Description | Price (£) | Pack details |
| 1 | Farnell | 908654 | 3003, KEYSTON | RETAINER COIN CELL 20MM PK5; Diameter, cell max:20mm | 0.5 | 5 for £2.5 |
| 1 | PCBPool | X | PCBPool | Batttery Printed Circuit Board | 5 | 110.63€ for 14 |
| 1 | RS | 468-1805 | 53748-0208, Molex | 20 way SMT stacking plug connector,3mm | 2.16 | 1 |
| 9 | Active Switch and Sensor | AT407 | AT407, Active Switch and Sensor | Tilt & Tip-Over Switch, Ball Contact | 0.39 | 1 |
| 1 | Analog Devices | ADXL202JE | Analog Devices | ADXL202 - ±2 g Dual Axis Accelerometer | 7 | $8.50 |
| 1 | Farnell | 4243407 | MICROCHIP | PIC16F628A-I/ML | 1.52 | 1 |
| 1 | RS | 468-1855 | 52991-0208, Molex | 20 way SMT stacking receptacle conn,3mm | 1.68 | 1 |
| 9 | RS | 345-1827 | VISHAY | D11CRCW0603 minireel resistor,1M 1% | 0.01 | £8.27 for 1000 |
| 3 | RS | 220-7966 | GRM Series | SMT Y5V ceramic capacitor,100nF 50V | 0.02 | 1 |
| 1 | RS | 345-1704 | VISHAY | Resistor,1000 unit, Minireel, chip, SMT, 0603,1%, 300k | 0.01 | £8.27 for 1000 |
| 1 | PCBPool | X | PCBPool | Porcupine Printed Circuit Board | 5 | 110.63€ for 14 |
| 29 | 23.29 |
Note that you can click some of the descriptions for the datasheet links.




Note: these files were made using Eagle, a CAM software package that has a freely downloadable lite version that is limited to small, 2-layer boards (so the free version works perfectly for this board!), if you continue to use it you might want to order the full version. You obviously need Eagle to view these files. You can also just submit the brd file to a PCB manufacturer (such as PCBPool), for which you don't need Eagle of course.
There is a good reason for those 9 big cylindrical objects on top of the Porcupine: they cover a very crude sense of tilt for the board in three planes. The easiest way to visualise how this works is in one plane; the other two planes that are positioned orthogonally on this plane work the same, but only 9 instead of 12 switches are required since we have common tilt switches between the three planes.
|
|
There are two reasons for incorporating these switches, related to resources:
|
The problem with the tilt switches is that they don't give a very accurate output, and also give no information on acceleration on top of that. For things like basic gesture recognition, it is quite important therefore to have an accelerometer present for the fine-grained acceleration readings.
To keep everything efficient though, the accelerometers can be switched on and off by the microcontroller to keep power consumption down at times when only a vague notion of tilt is enough. When the tilt switches notice that more movement is going on, the accelerometer can be switched back on for heavier, more accurate, processing.
The accelerometer used for the Porcupine is the ADXL202JE: it is fairly sensitive (+- 2g) and outputs its information in Pulse Width Modulation (PWM), which is extremely nice since we don't need any ADC conversion.
The Microcontroller has specifically been chosen because of its build in circuits that determine it's processing speed. For the tilt switches, it runs at a low 32kHz, while for the accelerometers it will switch to 4 Mhz. If nothing is happening at all with the switches or accelerometers, the microcontroller can even go into an extremely low-power sleep mode. The speed at which any microcontroller runs affects its power consumption heavily (measured with a 3V coin cell battery attached):

It is best to order the PCBs with protective layers and silk screen, which helps in soldering the components in the right orientation and place.

The hardest components to solder to the PCB are the PIC (left) and the molex connector (right) - use solder paste. The three 100 nF capacitors and the 300kOhm resistor (left, top-right) as well as the 9 1MOhm resistors (right, bottom) should be easier.
![final top picture]](brd5.jpg)
| 1: MCLR | Master Clear (active low Reset) |
| 2: PGC | Program Clock (using pin B6) |
| 3: GND | Ground |
| 4: PGD | Program Data (using pin B7) |
| 5: PWR | Power, Vdd |

The battery board has connectors for the coin cell battery holder and the 20-way molex connector. There are two holes to connect an rs232 bus if required for serial communication.
The PIC microcontroller is programmed by erasing and uploading a hex file onto its flash program memory. There are many PIC programming devices available to do this, a cheap and pretty good one is the ICD-40 from CCS, which also produces an easy C compiler for PICs.
This first program collects data from all sensors (tilt switches and accelerometers), and sends their pre-processed information over rs232 to any attached board (or bus), at a rate of approximately 10 Hz. The output is in a fixed 15-byte format, and sent at 2400 baud:
| Pre-amble 0xFF | 0XXXXXXX | 0XX0[hamming] | [average x] | [average y] |
| [minimum x]* | [minimum y]* | [maximum x]* | [maximum y]* | [peak height x]* |
| [peak height y] | [peak length x]** | [peak length y]** | [peak size x] | [peak size y] |
where the 9 Xes are the (binary) states of the 9 switches, and [hamming] is a cumulative hamming distance between all readings taken since the last output (taking 4 bits).
*over a sliding window of size WBy changing the values of N and W in the source code, one can modify the features to be more (or less) responsive to high-frequent patterns in the acceleration signals.
[click here to download the c file]
[click here to download the hex file]
The stack connector layout has been adopted from the BSN nodes, designed by Benny Lo at Imperial College, London. The porcupine can therefore be used as an add-on board for a BSN node, giving it access to a wireless sensing network, as well as additional processing and memory. The battery board can for the exact same reasons be used to power both BSN node and porcupine. Below are a few pictures of the whole setup, plus the features of the BSN node.
![]() |
![]() |
BSN Node features:
|
![]() |
In this configuration it is used as a self-organising sensor network of porcupines that can be attached on the body (preferably arms and legs).

Some of the porcupines getting ready for action, with the first prototypes in the foreground.
To interface the Porcupine with the BSN nodes (or any Mote), you'll need to install TinyOS first. A guide on how to do this can be found here.
Page updated on 23/07/2005 by kristof