At this stage of the blog, we’ve already explored a few ideas and have a decided on a method for reading the position of up to four cubes at a time, which will be explained in more detail later.

The basic idea is that each cube will be relatively low cost and simple.
It is important that each cube does not require batteries or similar power source – the cubes will draw their power (where needed) from the tray.
Although we’re working on a specific task for the BuildBrighton/element14 Global Challenge, we’ve decided to make the tray and cubes into a generic input device, so that they can be used for a number of other projects in future.

To this end, we’ve decided that each cube should be uniquely identifiable – so we’re going to use a PIC16F628A inside each cube, and on the face of each cube, in one corner, have a set of four pins:

  • power
  • ground
  • serial data
  • another ground

When powered, the cube will look at which of the six power pins on each of the faces has been used to power the microcontroller, and from here decide which face is face-down in the reader (from here, inferring which face is face up and being shown to the user). The cube will then broadcast a message over serial comms, containing a 4-byte unique ID (ok, not globally unique, but like an IP address, there are 255^4 = 4,228,250,625 – more than 4228 million – possible id numbers) and a single byte to tell the tray which face is lying in the tray.

That takes care of which cube is in which “slot” in the tray/reader, and which face is up/down. The last thing to work out is the orientation of the cube (how it is twisted in the tray – whether it’s top edge is facing north, south, east or west). To do this, we’re going to use four groups of four pins arranged in a square.

When the a cube is placed into the tray, one of the four pins gets pulled to ground while the other power, ground and serial pins make contact to the corresponding pins on the cube. This allows us to transfer data from the cube to the tray (over serial) AND depending on which pin has been pulled low, to work out which way around in the tray the cube is sitting.

A diagram will probably explain this a little better.
Here’s the PCB layout of the version attempt at a tray reader (drawn with ExpressPCB):