Introduction: Mini Mancala
In this tutorial we decribe how to create a mini version (with small modification of the game play) of the boardgame Mancala. The project is a result from the course Physical Interaction Design and Realization (DH2400) which took part in the autumn of 2016 at Royal Institute of Technology (KTH).
Step 1: Getting the Components
- 6 photoresistors (18-50 kOhm)
- 6 clear LED RGB 5mm WS2812 (Neopixel)
- Experiment circut board
- Bread board (only used for prototyping)
- Arduino UNO
- Plexi glass
- Laser cutter (or cutting tool for the plastic game pieces)
- Solder + soldering epquipment
- 9V battery + connector
- Electrical switch (One that can be turned on/off, and that will stay on/off until it is interacted with.)
Step 2: Creating the Board
To create the board you will . We got ours at a second hand store, and the quality of the wood was pretty bad, as is with all ply-wood-like materials.
Cut out a piece of wood large enough for your board game. You want to measure out the size you need for your "bowls" so that they fit on the board, and make sure to leave some space for the LED that will be placed above each bowl.
Find a way to create the square "bowls" in your board, which will be where the game pieces are put. We used a drill to drill a large amount of holes in the board, which were joined into a single hole with a bit of force. If you use the same method you will need to sandpaper the sides of the bowl to reduce the risk of splintering, and sandpaper the sides of the bowl as they will be sharp.
Make sure to make one score bowl for each player, and two (or more) score bowls on each side in-between the "player bowls".
Step 3: Creating the Game Pieces
These game pieces have been created using a laser cutter available at our university. To create these you will need to create a blueprint that will be printed on the sheet of material of your choice that you are able to cut in the laser cutter. The laser printer used here allowed users to create blueprints in Adobe Illustrator, which allows you to measure the size of blueprints you create.
Make sure to choose a material that you CAN cut with the laser cutter of your choice without breaking it. Also make sure to choose a transparent-ish material, since we want most of the light hitting the game pieces to come through them, but not all.
Make sure to create the blueprint so that it fits ALL holes you have drilled in the board. Making handles on the game pieces that can be grabbed from the side of the board is really handy.
The pieces that were cut for this projects have been sandpapered a little bit since they were too transparent. Sandpapering a little makes the surface scratched, making less light shine through the piece making them have a bigger impact on the light sensor values that we will use as input for the game.
Step 4: Making a Light Sensor
To make our light sensor we put a light sensitive resistance in series with a constant resistance, making sure to leave space for a wire in-between them. Over these two we put a constant voltage by connecting the circuit to the five volt and GND pins on the Arduino, making sure to have the V5 pin connected to the light sensitive resistance, and the GND pin connected to the constant resistance. Between the two resistances a wire is placed, which is connected to one of the analogue pins on the Arduino. This is where we read from our sensor.
If the light sensitive resistance is placed close to the high voltage side, and the constant resistance is put closer to the ground, the Arduino will read brighter light values as higher sensor values. If the order of the resistances are flipped, the Arduino will read lower sensor values for brighter light values.
The light sensitive resistance consists of two legs and a resistor chunk. The surface of this chunk is the part of the sensor that is "sensing" the light, which is what you would need to shine the light on that you want to sense. In our first image we have hidden the circuits below a cardboard, only showing the "sensing" part of our sensors. (We've also programmed some simple game logic on the Arduino utilising the sensor values as user input.)
Step 5: Soldering and Putting Things Together
And so the soldering starts.
We will provide the user feedback using NeoPixel LED lights. These components have four legs, 5V, GND, DataIn and DataOut. You can connect NeoPixels in serial by connecting the DataOut pin with the DataIn pin of the next LED, and address them through indexing in your software. This means that you can put a chain of the six LEDs needed in this project on a single Arduino digital pin.
Solder wires onto the legs of the GND, 5V and DataIn legs of the LED lights you want to attach to the board. Make sure to colour code the wires, and to make your solders small enough for them to be put through the holes you drilled for the component. Put the components in the board, pulling the wires and legs through the holes made for the LEDs. Now you connect the DataIn wires from all LEDs apart from the first one to the DataOut leg of the previous sensor, connecting them to each other. Since you don't want your components short-circuiting, and your soldered wires probably are, cover every other leg in non-conductive tape. (DataIn and GND, or DataOut and 5V.) This should make the legs of the component not short-circuit.
The bread board circuit has two kinds of "rows" that are all connected. The top and bottom rows are horizontally connected together, and the middle rows are connected vertically, split up along the equator of the chip. Solder a wire that you will connect to the 5V port on the Arduino to one of the larger Horizontal rows, and a wire that you will pull to the GND to the Horizontal row on the Other side of your circuit board. (Note that you get two separate rows of connections on both the top and the bottom of the circuit board, and that they are not connected all along the circuit board, but there is a disjointing in the middle.)
Solder your six resistances so that they connect between the GND-connected horizontal stripe and individual vertical stripes. Solder a wire to each vertical stripe "above" the resistance, which will act as your sensor reader.
Solder wires to the legs of the light sensitive resistances, and pull them through the holes made for the legs of the light sensitive resistances. Solder these wires onto your bread board circuit so that they connect to the 5V vertical stripe, and just above the sensor wires on their vertical stripes. Now you should have 6 light sensors.
Solder the "5V wires" of your LEDs to the 5V vertical stripe on the circuit board, and the "GND wires" to the GND vertical stripe on the circuit board.
Solder a switch to one of the wires of the battery connector, and solder nice plug-in wires on the other wire and the switch.
Step 6: Adding the Software
Now you will want to connect all the components to the Arduino, and add the software. You will need one digital pin (one marked with a squiggly line) for the NeoPixel LED lights, and all your 6 analogue pins for the light sensors.
(If you want more light sensors on your board you would want to add a Multiplexer and control it through digital pins on your Arduino, connecting your light sensors to the input on the multiplexer and the output of it to one of your analogue pins.)
Now you add the software that actually plays the game. Here is the code we have used in our board. Now, the code provided by us is far from perfect, but it is playable. Ish.
The code provided will assume that the board is in a given start state when you start the Arduino. It assumes three pieces have been placed in each of the middle bowls, and none in the score bowls.
The code will light up the LEDs of the middle bowls the player may pick up, and repeatedly check these bowls to see if they are significantly brighter than the last reading. If that is the case, we assume that bowl in particular has had its pieces lifted by the user.
The program will now light up the bowls that the user is to put their pieces in. It will read light sensor from the "next" bowl that the user has to put a piece in, and if there is a change to a significantly darker value, it will assume that a piece has been placed in the bowl, and light that LED down.
When all pieces have been successfully played, its the next players turn, who gets to see which bowls they are allowed to distribute. This happens until a player has reached a turn in which they are unable to pick anything up and redistribute, a point in which the game is over.
Note that the "significant" change to the sensor values are value changes within certain intervals. If a sensor sees a too large change in light value it will not trigger a state change, just like small changes won't. The values of these intervals have been chosen after testing, but could certainly be improved.