A photo of the robot arm playing connect four

I wanted a project to make good use of my robot arm. After a bunch of talking with friends and with an upcoming show held by Purdue Hackers, I ended up deciding to turn the robot in to a connect four player!

I spent a lot of time trying to find ways to have an external computer tell the robot where to move, but all of the normal methods were locked behind proprietary licenses I couldn’t afford. After a lot of thinking, I ended up coming up with a horrible idea: storing all the valid positions in a big table and streaming an index in to that table in by using the end effector GPIO as a poor-mans serial port.

After this, I needed a game board the robot could control. I bought a folding table off of Amazon and 3D printed a full connect four board, as well as dispensers that would allow the computer to dispense individual game pieces for both the robot the human player. I also needed game piece that the robot could easily grab. I ended up 3d printing game pieces that each had a metal core, and then attaching an electromagnet to the robot that it could use to pick up game pieces.

Finally, I needed some software to control it all. I wrote a simplistic connect 4 solver in Rust that could generally match the skill of the average person, providing a fun challenge while not taking an excessive amount of time to run. Next, I made a state machine that linked up the solver to the serial ports for the game board and the robot command sender. I then needed a way to get the state of the game board, so I wrote an application for my phone that could take pictures of the game board and pick out where pieces were.

With that, everything was ready and the inaugural test at the show worked perfectly!

gullible