RPi Chessboard

This is a stand-alone chess computer project using magnetic sensors, LEDs, and a Raspberry Pi Zero 2W. 

Hardware

This hardware is based on a magazine article "An Electronic Chessboard Using RGB Strips and Hall Effect Sensors", published in the January 2017 issue of "Nuts & Volts". The PCB was ordered from the ExpressPCB manufacturing service without any modifications.

Hardware changes made to the magazine article project:

Software

Teensy LC

The magazine article includes Teensy software appropriate for a chess game played between two human opponents. The LEDs indicates legal moves to help novice players. But I wanted a chessboard that lets a human compete against a computer opponent. The Teensy did not have enough resources to play a competant game of chess, hence the need for a Raspberry Pi running PicoChess software.

PicoChess can connect to a variety of commercial chessboards. To allow PicoChess to work with this chessboard, I wrote a sketch that implements the protocol used by the DGT Revelation II.

Here are the steps to load the sketch on the Teensy:

If you wish to connect the Teensy to your computer via USB while the Teensy is connected to the PCB, you should first cut a trace to disable USB power. On the bottom of the Teensy, look for two equal-sized and closely-spaced rectangular pads near the "VUSB" label. Press down on a sharp blade to score the board between the two pads and cut the tiny trace between them. Now the Teensy will only be powered by the PCB only, not by USB.

If you wish to modify the sketch, download "RPiChessboard.ino" from the "Files" section below. Load the sketch into Teensyduino variant of the Arduino IDE. It is also necessary to install the WS2812Serial library to run this sketch.

Raspberry Pi Zero 2 W

Here are the steps to configure the RPi: 

Raspbian GNU/Linus 11 picochess tty1


picochess login: pi

password: picochess

$ sudo raspi-config

pi@picochess:~ $ ifconfig

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 11  bytes 1647 (1.6 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 11  bytes 1647 (1.6 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.1.18  netmask 255.255.255.0  broadcast 192.168.1.255

        inet6 fe80::a6af:e447:4ba3:9e4a  prefixlen 64  scopeid 0x20<link>

        ether d8:3a:dd:3f:0e:20  txqueuelen 1000  (Ethernet)

        RX packets 179  bytes 41858 (40.8 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 105  bytes 15379 (15.0 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

http://192.168.1.18

ssh pi@192.168.1.18

password: picochess

$ sudo nano /opt/picochess/dgt/board.py

            if self.device.find('rfc') == -1:

                text_l, text_m, text_s = 'USB e-Board', 'USBboard', 'ok usb'

                self.channel = 'USB'

                self.is_revelation = True

                Rev2Info.set_revelation(self.is_revelation)

            else:

$ sudo nano /opt/picochess/picochess.ini

#dgt-port = /dev/ttyACM0

dgt-port = /dev/ttyS0

dgtpi = True

engine = /opt/picochess/engines/armv7l/NNUE/StockfishNN

engine = /opt/picochess/engines/armv7l/ct800

$ sudo reboot

With luck, you should now be able to place the chess pieces in their initial position and make a move to start the game.

Photos

Files