Inspiration

Ever since Queen’s gambit, the Netflix show, chess has revived in popular culture! It is also a great game to play to develop foresight and challenge yourself. In fact, chess has proven to have many positive impacts on your brain, especially at a younger age! There has to be some reason why it is one of the oldest games still existing today right? Although, with an increasingly online world chess has also moved online but that is so boring and 2D. That is why we wanted to create a solution to help chess enthusiasts actually enjoy the game and still have the safety (COVID SMH) and convenience of playing the game remotely.

What it does

Wizard’s chess or IoT-enabled chess board is a solution to enjoy the game in an increasingly online world. We attempt to seamlessly create a physical chess-playing experience with another human being by leveraging the power of electronics. Assume that you are white and I am black. You move first, just pick up and place a chess piece like you normally would and that information will be relayed to another chessboard sitting across the world or just across the room to me. The white piece that you moved will be automatically moved on my board as well. I will then evaluate the move you have made and play my turn. This will go back and forth where each chess board is updated in real-time!

How we built it

Our first function was to detect the movement of a chess piece. For this, the board underneath had a matrix of reed switches (multiplexing is as hard as learning a levitating charm!). When any chess piece moves, the reading for any two reed switches will change. This change was read by the matrix in very little time and we relayed the information to the other board via nodeMCU. Please note the matrix was interfaced with Arduino and the communication between Arduino and nodeMCU was done using UART,

The correct information was relayed to the second nodeMCU. This particular nodeMCU was connected to another Arduino and the communication between them was also using UART. The information triggered the XY table to move to the point where the chess piece is to be moved from. The electromagnet was then turned on keeping the coil energized which causes the magnetic chess piece to get stuck to it and move along. When the XY table reaches the desired position, the coil is turned off and the XY table goes back to its origin. And this is how we made our own magic. Figure 1 is the block diagram of our system works

Algorithm to read from switch matrix: The connection of the switches is in “pull down” configuration. Hence it gives 0 when the switch is open and 1 when the switch is closed. Two arrays by the name of state and previous state are declared in the module. The columns of the matrix are declared as output and rows are declared as input. The columns are turned on one by one. Since the switches are in pull down configuration, other columns are declared as input pins (because if a magnet is placed in the other column, and when we are reading from rows, just giving 0 would essentially be tying logic 1 and logic 0 and that can cause damage., we learnt it when one of our reed switches got damaged. ) When the column is turned on, the rows are read one by one and the state of the pin is stored in the variable. If the state does not matches the previous state, serial communication is triggered with the ESP. If the chess piece/magnet is placed, lower case alphabet corresponding to the position is sent and if its removed upper case alphabet is sent. The logic is to send an uppercase letter and a lowercase letter. Uppercase letter tells from where the piece is to be picked up from and lowercase letter tells where the piece has to be placed.

Algorithm for XY-Table actuation: Once we get the data from the reed switch side, we calculate where we need to take our XY Table from and where to!? For example, from A to f. We have set the position A (or a) as home. The total length of the XY-Table on both the axes are 500 steps and thus moving 250 steps in both directions clockwise get’s us to the middle. Similarly for all the other capital letter positions. (A function is created that passes an argument for the number of steps). Now once we reach our initial position a series of if statements gauge how many steps and in which direction we need to move for the final position (small case letters). The electromagnet is turned on and the piece is magnetically attracted and moved where desired.

Challenges we ran into

We had one sensor (reed matrix switch) and one actuator(motors for X-Y Table) and interfacing them proved to be very challenging. The reed matrix switch was made using multiplexing but the correct positioning of the reed switch mattered a lot. If the switch is not placed correctly, the chess piece in one position can trigger the reed switch on another position. The interference between different positions is a challenge we still don't know how to mitigate. Interfacing XY table motors was also an issue due to the lack of proper documentation and motors being a little old. A lot many times, the code was absolutely right, the mechanical structure of the XY caused issues in the smoothness of the movement of chess pieces. When we first thought of the project, we thought that we would use Blynk's “bridge” widget to communicate between two ESPs but unfortunately in the latest version of Blynk, this feature has been turned off. We had to go through the old way of making an HTTPS server to communicate between two ESPs. A better way is to communicate with the MQTT server which can be changed in the next version of the project.

Accomplishments that we're proud of

1) Working of multiplexed reed switch matrix and correct readings 2) Interfacing Stepper motors with no possible documentation and making the XY table move in every possible direction 3) Using https server client architecture to communicate between Arduino and ESP 4) Chess piece moving itself on the board

What we learned

This project was a great learning experience. We also learnt teamwork as we realized we made a good team and were able to catch up with each other and work efficiently and effectively. Sumiran was always afraid to work with motors and Aaraddhya was always afraid to use multiplexing but fortunately both of us had good experience with opposite things and we made the other person remove their respective fears. Our project had high software and hardware complexity. Being electrical engineers, we were at least able to overcome all the hardware challenges. We will be continuing to work on this project to make it better and have fully functioning two 8*8 chess boards.

What's next for Wizard’s Chess

As of now, we have a 3*3 reed switch matrix which should extend to a full chessboard size and we are still struggling to reduce the interference between the reed switches due to other chess pieces. One possible solution is to make small cardboard compartments around the reed switches so interference is not affected. The next step for the project is to integrate the two different sides together and make one more exactly the same. Right now the different paths are hardcoded, but we can integrate raspberry pi to calculate the trajectory for the XY table to be moved using complex graph theory algorithms such as Dijkstra's algorithm. Still, we will possible bottleneck as which can be solved by using a raspberry pi and using graph algorithms to find the optimum path

1) Horse says neigh: A horse moves 2 ½ steps or in other words 2 blocks straight and one block across. There is a possibility that there is some other piece in that path and there is basically no other way to move that following piece other than by picking it up and dropping it down.

We will surely continue this project in ESE 516!! :)

Built With

Share this project:

Updates