At the latest BuildBrighton meeting, (Thursday nights at the Skiff) we managed to get a working prototype of our cube and a tray/reader.

Each cube contains a 16F628A PIC microcontroller and is programmed to read two bytes from eeprom (internal memory) as a unique identifier (two bytes gives us 65,535 possible IDs to play with) and then broadcasts a message over serial in the following format:

<255, unique ID high byte, unique ID low byte, pin used to enable to cube/facing>

This message repeats over and over again.
The cube has three pins, one slightly longer than the others, so that when the cube is in place, in the reader, it pulls one of the input pins on the tray to ground. This is how the tray detects the presence of a cube.

The cube also looks at which of it’s own PORTB pins has been pulled low (the input pins have internal pull-ups on them, so be default the input on all PORTB pins will be high). From this, the cube knows which face is face-down in the cube.

The reader has four trays and is connected to an 18F4550 PIC microcontroller. If a cube is present in tray1, one of the first four pins on PORTD will be pulled low (by the larger pin on the cube, bridging the contact between input pin and ground).
The tray/reader then knows to start reading serial data on the tray one serial RX pin (there are four serial RX pins, one for each tray, and all serial pins in tray one are connected, all serial pins in tray two are connected, and so on).

When in place, the cube draws its power from the tray/reader and starts broadcasting.
The reader checks for the presence of a cube and reads the serial data from it. Using the information from the cube, and by knowing which input pin the cube has pulled low, the tray can calculate

  • Which cube is in which tray
  • Which cube face is pointing down (and therefore infer which face is upwards)
  • Which way around in the tray the cube is (N,S,E,W)

By the end of the BuildBrighton evening we managed to acheive all of this, using a mixture of home-made PCBs and some breadboarded circuits. Although not exactly cube-shaped, the principle was tested and proved to work!