It has been a few weeks since my last post on my PComp final so I wanted to give a quick update on my progress. After a lot of help sessions, user testing, and conversations it is really starting to take shape.
The Playing Pieces
I found the perfect acrylic discs to act as playing pieces. Traditionally, Othello pieces are black one side and white on the other, with each player assigned to a color. As a player conquers their opponents pieces, they flip over the captured pieces to their respective color. However, this is a very difficult move for a computer to do so I’m using LEDs to simulate the flipping of pieces. Anywhere a piece is suppose to be flipped over, I simply change the color of the disc’s corresponding LED. The only problem was shining a LED through these pieces was a little lack-luster.
Someone gave me the idea to sand one side to diffuse the light and this resulted in much more aesthetically pleasing results.
I’m using hall effect sensors to tell the computer when a piece has been placed on the board, so I also needed a way to add a magnet to my discs. I braved the laser cutter for the first time and etched a small hole for a very tiny (yet powerful) magnet and rubber cemented the magnet in. The magnet isn’t quite center, but for a first try I was very pleased with the results.
Muliplexing – LEDs
The next issue I needed to tackle was how to turn on and off 64 Red/Green LEDs with one Arduino Uno. This is when I realized I needed to incorporate multiplexing into my project. I’m using a Adafruit Matrix Driver Backpack, which turned out to be the perfect component because it can control two sets of 64 LEDs. It also operates on a 8×8 matrix, just like an Othello board. After several frustrating days, I was finally able to control several LEDs with multiplexing.
To ensure I wouldn’t mess up my wiring and solder the wrong LED to a pin, I created an 8×8 grid and wrote down the pin for every green anode, red anode, and common cathode for each square.
Multiplexing – Hall Effect Sensors
After figuring out how to the handle the LEDs, I turned my attention to how to deal with 64 Hall Effect sensors. It was at this point that I started thinking about all the other board games that didn’t have so many pieces/squares. But anyway, I found a couple CD4067BEs in the shop and started to test them out. It took many tries, but eventually I got a Hall Effect sensor wired to one and could read it from Arduino’s Serial monitor. I also created a chart for this so that for each square, I would know which MUX to connect to (there will be four), and which pin the wire will go to.
The Code and Putting it all Together
Now that I knew how all my electrical components would be working, I turned my attention back to my code. I incorporated writing to my LEDs through the backpack based on my reinforcement learning algorithm, and then read in the hall effect sensor values to inform the computer where the human player had moved.
Here’s the github repo: https://github.com/katsully/Othello. The master branch is the main Othello board game with a reinforcement learning player and GUI. The add_serial branch has serial communication with my Arduino.
For proof of concept I wired four LEDs which represented the center four squares, and one hall effect sensors, which I could manipulate by moving its input wire. Here is a short video of that:
Hope you enjoyed!