I've built my own electronic chess board based on reed switches, similar to this project https://sites.google.com/site/bergersprojects/home
However compared to his solution, I am using an ATmega32u4 based Microcontroller (i.e. Arduino Leonardo, Micro or other clones) and my source code is freely available @ https://github.com/asdfjkl/ArdEBoard
So for those who are into such kind of projects this might or might not be useful; hence this announcement.
Electronic Chess Board: Arduino Source-Code
Moderator: Ras
-
- Posts: 28
- Joined: Wed Jan 14, 2015 5:55 pm
Electronic Chess Board: Arduino Source-Code
Not Fritz, it's Jerry! Free Chess GUI - https://github.com/asdfjkl/jerry
Free Book about Neural Networks for Chess - https://github.com/asdfjkl/neural_network_chess
Free Book about Neural Networks for Chess - https://github.com/asdfjkl/neural_network_chess
-
- Posts: 912
- Joined: Sun Dec 27, 2020 2:40 am
- Location: Bremen, Germany
- Full name: Thomas Jahn
Re: Electronic Chess Board: Arduino Source-Code
Wow, that's awesome! I want something like that!
Stupid question: do you need to connect it to a computer and it's just working as an input device or do you run the engine on the Microcontroller?
Edit: I found the video. So it's more more or less an input device and the engine runs on a PC, right? Have you considered making it a stand-alone chess computer? If yes: why didn't you?

Stupid question: do you need to connect it to a computer and it's just working as an input device or do you run the engine on the Microcontroller?
Edit: I found the video. So it's more more or less an input device and the engine runs on a PC, right? Have you considered making it a stand-alone chess computer? If yes: why didn't you?

-
- Posts: 1784
- Joined: Wed Jul 03, 2019 4:42 pm
- Location: Netherlands
- Full name: Marcel Vanthoor
Re: Electronic Chess Board: Arduino Source-Code
Me too. I actually do have the programming and electronic skills to build something like that... but not the woodworking skills. That'd become one ugly chess computer.
-
- Posts: 28
- Joined: Wed Jan 14, 2015 5:55 pm
Re: Electronic Chess Board: Arduino Source-Code
lithander wrote: ↑Fri Feb 12, 2021 12:57 pm Wow, that's awesome! I want something like that!![]()
Stupid question: do you need to connect it to a computer and it's just working as an input device or do you run the engine on the Microcontroller?
Edit: I found the video. So it's more more or less an input device and the engine runs on a PC, right? Have you considered making it a stand-alone chess computer? If yes: why didn't you?![]()
I've designed it as "just" an input board. Simply to reduce the workload for myself. For example, it can be connected to Art Bik's "Chess for Android" to a mobile phone via an OTG adapter and then is pretty similar to the experience of playing with a chess computer.
However it would be easy to extend it to a full chess computer. Just get a Raspberry Pi (Zero) + a touch display or connect some display/control buttons to it. Then connect the board via USB to the Raspberry and communicate to and from the board via the built-in USB to serial bridge (e.g. python-serial). The "computer" part is then on the raspberry, and the board acts as the input device (but can also receive commands from the raspberry). Then, using some library like python-chess it should be easy to extend this into a "full" chess computer with arbitrary chess engines. One could even go so far as replace the whole Arduino with the raspberry, and use the GPIO pins on the raspberry to read out the reed switches. I think this is what they do with the Pewatronic Grandmaster....
Due to time constraints I skipped that part, though.
Last edited by dkl on Fri Feb 12, 2021 1:20 pm, edited 3 times in total.
Not Fritz, it's Jerry! Free Chess GUI - https://github.com/asdfjkl/jerry
Free Book about Neural Networks for Chess - https://github.com/asdfjkl/neural_network_chess
Free Book about Neural Networks for Chess - https://github.com/asdfjkl/neural_network_chess
-
- Posts: 28
- Joined: Wed Jan 14, 2015 5:55 pm
Re: Electronic Chess Board: Arduino Source-Code
I had the same problem, and therefore I am not really satisfied with the result. I envy those who have such woodworking skills, especially working with veneer to create nice looking boards... Still, this is better than paying 160 Euro for a plastic Chess Genius Pro, I think.
Not Fritz, it's Jerry! Free Chess GUI - https://github.com/asdfjkl/jerry
Free Book about Neural Networks for Chess - https://github.com/asdfjkl/neural_network_chess
Free Book about Neural Networks for Chess - https://github.com/asdfjkl/neural_network_chess
-
- Posts: 28
- Joined: Wed Jan 14, 2015 5:55 pm
Re: Electronic Chess Board: Arduino Source-Code
I am bumping this: In the meantime I've simplified the design and cost (~50 Euro will do), using tactile switches. Similar designs have been proposed before (DIY USB Chessboard, "Sish"-Board), but not based on an Arduino. Source-Code is freely available again (but this time, dead simple).
If anybody is curious, an image and source code is available @ https://github.com/asdfjkl/ArdEBoard. There is also a video available @ of playing against the excellent "Chess for Android" by Aart Bik.
If anybody is curious, an image and source code is available @ https://github.com/asdfjkl/ArdEBoard. There is also a video available @ of playing against the excellent "Chess for Android" by Aart Bik.
Not Fritz, it's Jerry! Free Chess GUI - https://github.com/asdfjkl/jerry
Free Book about Neural Networks for Chess - https://github.com/asdfjkl/neural_network_chess
Free Book about Neural Networks for Chess - https://github.com/asdfjkl/neural_network_chess
-
- Posts: 2694
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Electronic Chess Board: Arduino Source-Code
Are you interested in a way how to decounce them while still staying insanely responsive?
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net
-
- Posts: 28
- Joined: Wed Jan 14, 2015 5:55 pm
Re: Electronic Chess Board: Arduino Source-Code
I guess it's a typo and you mean debouncing the switches? Always interested to improve the code! But of course, one needs to make sure that if a user presses a switch accidentally for too long, that the field information is send only once (otherwise the GUI will be confused if it receives, say a2a2a2)
btw extending the CT800 to a board-version should be straight forward with this approach. Just extend the current input buttons to the tactile switches on the board...
btw extending the CT800 to a board-version should be straight forward with this approach. Just extend the current input buttons to the tactile switches on the board...
Not Fritz, it's Jerry! Free Chess GUI - https://github.com/asdfjkl/jerry
Free Book about Neural Networks for Chess - https://github.com/asdfjkl/neural_network_chess
Free Book about Neural Networks for Chess - https://github.com/asdfjkl/neural_network_chess
-
- Posts: 2694
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Electronic Chess Board: Arduino Source-Code
Oh, yes, that's what I meant. What I found works much better than the classic "three times the same state when sampled every 10ms" approach: You can cample much faster than that. I'm using a matrix keypad approach where I switch rows/columns in a 1ms raster, hence there is a reading every 2ms. That's done right from the timer interrupt.
If a key is "pressed", I increment the "active" counter, else I decrement it, while clipping it to a max value of 8 and min value of 0. Now, if the keystate has been "not pressed", and it is pressed, I recognise it as pressed if the counter reaches 6. Or, when it has been pressed and goes down, I recognise it as "not pressed" when the counter goes down to 2. That way, the keypad is already responsive even before the bouncing is over.
In fact, it is so fast that I'm limiting it to one input on the same key every 100ms by bumping up the active counter to 50 if a key has gone from inactive to active. That's meant for people with limited motor control in their hands, and it would make even more sense for a chess board because there's little reason why you would want to tap the same square twice in a row.
On top of that, I have a small keypad queue where the timer interrupt puts in pressed keys, and the main application can read it so that no key press will be lost even if there should be some occasional delay in processing.
Sure, it only triggers when a key state changes from inactive to active.But of course, one needs to make sure that if a user presses a switch accidentally for too long, that the field information is send only once (otherwise the GUI will be confused if it receives, say a2a2a2)
That would need 16 IO pins for the board, and my H405 mainboard doesn't have that many pins left over.btw extending the CT800 to a board-version should be straight forward with this approach. Just extend the current input buttons to the tactile switches on the board...
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net
-
- Posts: 28
- Joined: Wed Jan 14, 2015 5:55 pm
Re: Electronic Chess Board: Arduino Source-Code
That's a really neat approach and so easy to implement. Updated my code, and it works like a charm!Ras wrote: ↑Thu Apr 01, 2021 2:57 pm
If a key is "pressed", I increment the "active" counter, else I decrement it, while clipping it to a max value of 8 and min value of 0. Now, if the keystate has been "not pressed", and it is pressed, I recognise it as pressed if the counter reaches 6. Or, when it has been pressed and goes down, I recognise it as "not pressed" when the counter goes down to 2. That way, the keypad is already responsive even before the bouncing is over.
That's something I did not include. The style of the switches that I used are such that even someone very clumsy would not accidantly press a button twice if only one field should be activated. On the other hand, it is sometimes a need to quickly press a field twice in a row. Think of the Ruy, where White plays against a computer, plays Bf1-b5 (press on b5), then very quickly moves a6 (computer move, no press), and then presses b5 again for Bb5-a4. Actually happened to me in a test gameIn fact, it is so fast that I'm limiting it to one input on the same key every 100ms by bumping up the active counter to 50 if a key has gone from inactive to active. That's meant for people with limited motor control in their hands, and it would make even more sense for a chess board because there's little reason why you would want to tap the same square twice in a row.
ah, that's a pitty.That would need 16 IO pins for the board, and my H405 mainboard doesn't have that many pins left over.btw extending the CT800 to a board-version should be straight forward with this approach. Just extend the current input buttons to the tactile switches on the board...
Is your code portable? In particular, would it potentially run on an Arduino Due (that's a Atmel SAM3X8E ARM Cortex-M3). Not an STM32, but with 84 Mhz should have enough power. And lot's of ports...
Not Fritz, it's Jerry! Free Chess GUI - https://github.com/asdfjkl/jerry
Free Book about Neural Networks for Chess - https://github.com/asdfjkl/neural_network_chess
Free Book about Neural Networks for Chess - https://github.com/asdfjkl/neural_network_chess