in , , , ,

Cam Chess

- Werbung -
Reading Time: 3 minutes

Playing against an on-screen computer opponent just isn’t the same, says Geoff. “It loses the social aspect.” Furthermore, it takes time to adapt from on-screen diagrams to playing with a physical board and pieces – something he imagines more people doing now that the TV show has given chess a moment in the spotlight. “The ideal practice is to train with the same board and pieces as you would use at the local club,” he says, but it’s prohibitively expensive for schools and many clubs, which is where his CamChess project fits in. “I wanted to build a system that would work with standard plastic pieces on a standard vinyl board,” and also record the moves.

A canny move

CamChess combines the best elements of an electronic board with the ability to record moves, but costs only around £50 ($70) excluding Raspberry Pi 4.

- Werbung -
- Werbung -

 A Raspberry Pi Zero with ZeroCam is fixed to the ceiling above

After retiring 20 years ago from his job as a consultant for large-scale computing systems, Geoff has racked up experience of building small-scale projects. Despite a 30-year break from it, he can still write code. “Python was a bit of a culture shock,” he reveals, “but I soon adapted.” Geoff made full use of standard Python modules, along with OpenCV and NumPy for image processing, and Stockfish as the chess engine.

A Raspberry Pi Zero with an attached ZeroCam worked well for capturing images of the chess board. Mounting the ZeroCam on a door frame using some sticky tape high above the centre of the chess board helped minimise lens distortion. Raspberry Pi Zero takes pictures on command and sends them back to another computer for analysis. Geoff used a Raspberry Pi 4 to do this, but says any ‘non-antique’ Linux, Windows, or Mac computer would work.

Match ready

Due to congested WiFi channels where he lives, he opted for Ethernet to connect Raspberry Pi 4 and Raspberry Pi Zero and send images using the USB cable that also powers the latter. These images tell the computer the latest chess move that has been made, which Python-chess then replicates on-screen. Having experimented with the image comparison method used by Realtime OpenCV Chess, Geoff thrashed out a method that determines whether each chess square is empty or occupied and whether it’s a white piece or a black piece.

- Werbung -

 The ZeroCam picks up moves on the board and displays them on screen

It was a challenge to get the board to configure itself automatically but Geoff eventually worked out how to do so using standard threshold optimisation techniques. CamChess now only needs to be shown the start position, and works out its internal settings from there. CamChess’s difficulty level can be set to engage the hobbyist player and they can make moves for both sides until they reach a position that is of interest to them.

While he’s largely happy with the existing build, Geoff hopes others will make their own versions of CamChess and let him know how they get on. We did ask him about his own next move, but he’s keeping mum. 

- Werbung -

Report

- Werbung -

What do you think?

Schreibe einen Kommentar