T³: Connected Chess Boards

Today we're demonstrating chess boards that talk over Phant!

Favorited Favorite 2

In this week's Tech Talk Tuesday, it's also time for another installment of The Fellowship of the Things! In this episode I have made two chess boards that talk over Phant so you can play chess with anyone over WiFi on a physical board.

Check out the video:

Photo of both connected chess boards lit up

The electronic parts in the board are fairly simple and pretty straightforward. There is a SparkFun Thing Dev Board running as the brains; this board also connects to WiFi, so it does everything we need.

Photo of both connected chess boards without the top board on

Each tile in each board has a WS2812 LED under it, as well as a reed switch. This is so each tile can light up independently, as well as sense if there is a piece on it.

Photo of the inside of the connected chess board

To be able to read all of the reed switches and buttons, I used nine shift-in registers per board. This allowed me to only need four pins for up to 72 inputs, since the shift registers can be daisy-chained. The nice thing about the WS2812 LEDs is that they only need one data pin to run all of them, as they can also be daisy-chained. Whats left is what you see on the front: each board has a serial LCD display, two 10mm green LEDs for indicators, three toggle switches, four buttons, and a small slide switch.

Photo of connected chess board

Here is a wishlist of all the parts you would need for both boards:

The board itself is made out of 1/4-inch boards cut into an interlocking 8x8 grid. Each tile is 2.25x2.25 inches – regulation size for chess competitions (also the larger the tiles, the easier it is to fit all the electronics in). The front of the board was laser cut to fit all the switches and LCD screen in. The top of the board is made out of two different colors of acrylic, laser cut to 2.25-inch squares and "welded" together with WELD-ON, which is made of acids and alcohols that melt the acrylic on both sides and then evaporate, leaving the two pieces stuck together. I then sanded the acrylic down to make it disperse the light a little better. A small frame was made around the board with laser cut numbers and letters to show you the naming convention of the tiles on the board. Neodymium magnets were glued to the bottom of every piece so they trigger the reed switch when placed on a tile.

The reason that I was able to keep the electronics so simple is because the beginning positions in chess are known. I was able to write code to keep track of where everything started, and since (in most cases) a move consists of taking one piece off and putting that piece somewhere else, it was easy to keep track of where everything was on the board. I did not code in the full rules of chess, so these boards will allow you to make whatever move you want. There were a few things I did put in though: castling, since you have to take more than one piece off the board; pawn promotion, since a piece changes from a pawn to a queen (I know it can be anything, but it turns into a queen in my code); and an en passant capture, which is weird because the piece the pawn takes is not on the square it moves to. The code automatically knows if your pawn needs promoting or you make an en passant capture, but you have to press a button on the front to show that you want to castle, and a switch to show which way.

The pieces are color coded, which is how you know where your opponents pieces are on the board. To make it easier to remember the color codes, your pieces are also slightly colored underneath. Red for rooks, green for knights, blue for bishops, purple for queens, gold (yellow) for the king, and white for pawns.

Photo of connected chess board colors without top

When you start up the board, you can choose which side you want to be (black or white) with a switch. You can decide at any time if you want to turn off the color LEDs to play a half blind game, where you just get the last move displayed on the LCD screen.

Close up photo of the LCD screen on the connected chess board

Each board waits when it isn't its turn until the other posts to Phant. The post includes the last move and whose turn it is. The board reads this from Phant and parses it. It updates the internal board position, lights, and displays the last move and whose turn it is on the LCD screen. When it is your turn, the board waits for a move to be made, and then posts that info to Phant. There are internal delays set in the code, so you have five seconds to take back and change a move before it's set and data is sent out.

I hope you enjoyed this project and it inspires you to make something awesome – let me know what you think. This was super fun to make, because I love chess.

You can find all the code, Fritzing diagram of how the parts hook up, and laser cutter files for the board and the acrylic on GitHub.

Comments 8 comments

  • RBERLIA / about 8 years ago / 3

    This is awesome! :)

  • Eric15 / about 8 years ago / 3

    Neat project, but the $890 price tag for just the electronics exceeds my lifetime chess board budget.

  • what happens if the board gets bumped and several pieces fall over? Does it send to phant the first "move" detected and ignore the rest?

    • Sarah Al-Mutlaq / about 8 years ago / 1

      It would tell you that too many pieces are taken off the board, and to put them back the way they were befoe you can take your official move.

  • ME heat o nator / about 8 years ago / 1

    your phant link doesn't seem to work.

    • Sarah Al-Mutlaq / about 8 years ago / 1

      You are correct, it is Phant.io or data.sparkfun.com if you are going to be posting stuff to it. I have fixed it, Thanks! ^_^

      • ME heat o nator / about 8 years ago / 1

        What is the address to see the data from an actual game?

        • Sarah Al-Mutlaq / about 8 years ago / 1

          This (https://data.sparkfun.com/streams/2JYaxdVrEbsrL8maXZJL) was the stream I was using, but it was also for testing and stuff, so you're not going to see a full game on there.

Related Posts

Recent Posts


All Tags