Labyrinth is a game where the goal is to navigate a steel ball through a maze without falling through any of the holes in the game board. The desktop version of the game consists of a box with a tilting game board which is controlled by two knobs.
Some labyrinth games offer the ability to swap out game boards allowing the user to select the level of difficulty. The game I purchased, as illustrated above, did not offer this ability. It shipped with a 60 hole board and playing it manually was quite challenging.
The original idea for this experiment was to demonstrate the use of the ObjC PhoenixClient. This client library facilitates streaming connections between iOS devices and PhoenixFramework based applications using the Phoenix Channel abstraction. At a simple level, the project maps the pitch and roll axis data of the iPhone gyro to a servo connected to the corresponding axis on the game board. The entire system is powered by a BeagleBone Black which boots directly to our Phoenix App using the Nerves Framework. The source for both the Phoenix app and the iPhone app are available on github
To create this project you will need a few things.
- A BeagleBone Black
- 2 Standard Servo motors
- 5 VDC Power Adapter
- Breadboard and jumpers
It is highly recommended to get an AC -> 5V DC power adapter that has a high amperage rating. Do no attempt to run the BeagleBone off USB power or even through the URB port powered by an iPhone charger or something. With two servo motors the current draw is too high and will either brown out the BeagleBone or damage your power supply / computer. Additionally, If you would like to have the ability to connect directly to the BeagleBone to see whats going on and maybe type commands directly into IEX, purchase an FTDI Cable. You can connect this cable to the serial debug interface pins. Make sure to connect the cable to the header in the correct orientation, Notice the ground pin side.
Wiring the system is fairly basic. We can derrive power from the 5VDC adapter to power both our servo motors and our BeagleBone Black. Follow the layout below for information on how to wire the power and signal pins.
You can edit and open the breadboard and schematic in fritzig direcly. labyrinth-fritzig
In the next article we will Deploy the nerves app onto the board, and control the servos.