In many countries that I visited and lived, the parks have tables with chessboards. The visitors are used to play chess there, not rarely with casual unknown opponents.
As a chess lover, I was impressed by this use the first time I saw a couple of players enjoying the outdoor fresh air, a sunny day in the park, and a nice chess challenge.
Where you see two players playing you see also a small group of chess passionates following the game and commenting on the moves.
Playing Chess With Casual OpponentsNowadays due to the social distancing rules, this practice is no longer possible or it is very difficult. This is the reason that I decided to think about how it is possible to find a low cost and reliable way to solve this problem. And the "Distanced Pawn" project born.
Playing in the Post-COVID Era
To keep it possible to play chess everywhere with an opponent keeping the social distancing every player will use a separate checkerboard.
Every chessboard square has a sensor able to detect the pick and place move of the pieces keeping track of both the player pieces; as a player makes its move on his chessboard, the same move is sent to the opponent board that will pace the piece in the right position and makes his own.
And so on until the game ends.
The Solution ApproachThe solution is based on two MKR WiFi 1010 and some extra hardware.
Note: due to the difficulty to find in a reasonable time the Hall effect sensors I planned to be used in the original design I changed the chess pieces move detection using sub-miniature micro-switches by Omron. The board square reading approach remains the same.
(1) From prototype to production - According to the design of the whole system the potential product version will use Hall effect sensors for the chess pieces detection. This has the advantage to simplify the hardware design without impacting the design. The pieces detection with the method can be obtained with a small magnet inside of the base of the pieces (tested with a Neodymium 3 mm diameter with a satisfying effect) or directly using metal pieces.
The Game Workflow
- As a piece is placed or removed during the game it is detected.
- The Arduino MKR1010 detects the position of all the pieces and validates the move or generates an error message and does not accept the move.
- The RGB LED shows in different colors the state of the game, e.g. waiting for a move (green), waiting for an opponent move (red), system starting (blue), link enabled (cyan), etc.
- The game follows the standard rules. When a piece is moved (if it is not a wrong move) the player is obliged to make the move with that piece.
- The Arduino MKR1010 validates the moves and updates the display of both players.
- The Arduino MKR1010 takes into account the state of the two players and the position of the pieces of the game after every move, on the chessboard; it also works as the game validator for every move and other features usually present in the classic chess timers.
- The two Arduino MKR1010 are connected together through a peer-to-peer WiFi connection: one of the two devices is set as an AP (access point) while the other can connect to it.
IMPORTANT NOTE: THE OFFICIAL PROTOTYPE TEST WILL BE ON THE SECOND MID OF THE MONTH OF SEPTEMBER 2020 IN A SMALL TOURNAMENT OUTDOOR – RESPECTING THE SOCIAL DISTANCE.
THE EVENT WILL BE DOCUMENTED AND FILMED.
TO READ MORE IN-DEPTH THE STORY BEHIND THIS PROJECT, UPDATES AND MORE HOW-TO MATERIAL, AS WELL AS THE LAST UPDATES, FOLLOW THE DETAILS ON THE PROJECT WEBSITE
WE-ARE-BORG.COM
As I got the micro-switches, based on the above sketch I designed the square module for the game board with Fusion360, embedding the micro-switch, as shown in the images below:
Then the squares have been printed with the Elegoo Saturn 3D printer.
In the image below, the first prototype of a board with the microswitch inside.
The prototype of the two chessboards has been done 3D printing the 128 squares, painting them, then gluing together with cyanoacrylate glue. This part of the job required a huge amount of time and has been a strong performance test for the Elegoo Saturn LCD 3D printer, as well as about 2, 5 L of photosensitive resin.
The above images show how I have assembled and glued he painted squares together.
To make the connection grid of the microswitch I should thank Baldengineer, a friend of the Element14 community that published a nice article on how to manage a grid of switches with Arduino (credits: Arduino Keyboard Matrix Code).
(2) From prototype to production - The making of the chessboard with the methodology illustrated above is perfect for prototyping but not reliable for the production. If prototyping with a 3D printer leaves a lot of possibilities to modify the design, conduct experiments, and find the best way to approach the solution if this game will go in production a more efficient and fast way should be chosen to create the chessboards. Indeed, most depend on the number of units; for a market test preproduction making the chessboard laser cut can be a good option. I have already evaluated how to ake an efficient way to create a base of the chessboard with one of the two colors with insets for the alternate color squares.Making the Chess Pieces
Below, a gallery of the first series (two opponents) of the chess pieces 3D printed with the Elegoo Saturn LCD printer and painted.
These pieces come from Thingiverse thanks to the author FunFunBoy who licensed the STL files under CC license.
The Hardware Game ControllerAssembling the hardware has been pretty simple. Considering the form-factor of the Arduino MKR1010 I have done a small custom shield to host both the Oled 128x64 I2C display and the RGB LED for alerts.
Chained to the I2C Oled display I have also connected two small boards (fixed on the bottom side of the chessboard) based on the 8 pins bi-directional GPIO expander PCF8574.
I have used the two pre-built boards to save time instead of making a (simple) board using the IC component, as I was worried about potential problems in the data transfer of the bus protocol.
Before proceeding to make the MKR1010 shield I have tested the two GPIO expander and nothing worked :( Not only but as I tried to change the board jumper settings of the I2C address the whole Arduino board was short-circuited.
Weird!
Tests revealed that these boards work fine only when the default I2C address is set, corresponding to all the three jumpers connected to GND. Trying any other configuration the microcontroller short-circuits. So I decided to sacrifice one of the boards and cleaned the circuit (lucky, it is only two-sided PCB) to see the path of the wires. Result: regardless of the address jumper settings, the circuit always connects all the three pins to GND. If one of the jumpers is set to the VCC it generates a short-circuit.
I suppose that these "original" boards sold on Amazon are just fake ones; who cloned this pretty simple circuit totally failed. It has been very difficult to find this issue because every board when tested as-is works; only when changing the I2C address the I2C problem occurs.
Already having the boards on my desk and very few time, I hacked some of them breaking the PCB tracks between the setting jumper pins. And the boards finally worked with any address configuration!
There is a last potential issue I was seriously concerned about until it was not possible to test it. After assembling the shield as shown in the above image I was not sure if the quality of the I2C bus signals was sufficient – considering also the 20 cm wires connecting the two GPIO expanders to the other I2C component – so I checked with the oscilloscope; the results, as shown in the images below, was more than satisfactory and better than expected.
While building the hardware has been quite easy, the logic of the software is almost complex. It is divided into four main parts:
- The Oled display; Shows important messages, the last player move, and the game history. It is a messaging dedicated class including the methods to manage the RGB LED showing the game status.
- The chess game control logic; it is a dedicated class that keep track of the moves, validates the moves, and check the right position of the pieces.
- The WiFi connection; keeps open the connection between the two boards and exposes the current game through a browser to any device connected to the MKR1010 access point.
- The chessboard scanner; keeps updated the physical status of all the squares used by the program logic.
Then, there is a third part created for the development and testing that can be checked through the Tx/Rx UART pins of the MKR1010 (Serial1).
The current running version of the software, as well as the updates that will be released in the next couple of weeks, is available under the Open Source LGPL 3.0 license on the GitHub repository.
The full documentation of the software created with Doxygen, as well as more material related to the project, is available on the official project page we-are-borg.com
From Prototype to ProductionI put a couple of remarks on the aspect that must be changed or reviewed in the hypothesis of moving this project to a commercial product in the above story: my biggest concerns are related to the chessboard and game pieces parts. I have reviewed the whole project workflow and made some more considerations.
Hardware Controller
Arduino MKR1010, in my opinion, is definitely the solution: small form-factor and low power consumption. It can be powered by traditional batteries (discouraged) but it works fine with a non-replaceable LiIon polymer batter automatically recharged with a conventional USB charger, as well as powered while charging with an external USB battery pack. As far as I already verified, the battery power banks (most of them) stops charging if no output signal is generated by the hardware as they are designed for smartphone recharging. I have already modified this kind of potential issues with a simple code modification: a generated pulse on an unused pin (here we have a few) that keep alive the external battery charger.
As shown in the above image to make the Arduino MKR1010 and the shield compact and usable inside a case I have already cut the bottom breadboardable pins from the Arduino. A better distribution of the components, as well as making the controller with a lower profile, can be done making a custom PCB on which plug (or directly solder) the MKR 1010 provided without the pin connector array. the PCB will be at the same time the circuit and the support for the small Oled display with a properly designed case.
About the Oled display: I was concerned that a so small device was not the best solution for this implementation, designed for outdoor use most of the cases. Instead, seeing the display in place – and the possibility to manage it easily with different font sizes and styles – I saw that the solution has been the right choice.
About the I2C GPIO port extender: also, in this case, a small dedicated PCB should be designed (with a couple of low-profile connectors) replacing the pre-built boards I have used making the prototype.
Redesigning the Chessboard
Undoubtfully, the chessboard surface should be redesigned. Exploring several kinds of solutions I see two possible options:
1. Small Preproduction (about 50 pieces)
For this kind of production the microswitch solution or – better but a bit more expensive – Hall effect ICs can be still used. The base of the chessboard (a rectangle with the sensors holes) can be easily laser-cut from a 3 mm acrylic sheet with a PVC adhesive sheet glued on it with the two-color chess squares printed on it. The electronic bottom side design of the chessboard remains almost the same.
2. Average and Mass Production (100 pieces and more)
A keyboard controller I2C will replace the GPIO port expanders. It can be used I2C IC keeping the current software design with the advantage that most of the keypress work is done by the IC itself instead of the Arduino controller.
In this case, a two-layers touch keyboard will replace the sensors but a custom design should be developed, as well as building the physical keyboard.
Comments