Software
All code can be found at github
File descriptions
Chess_Main.py
Main Program to control the system. At the moment it just plays very basic chess, with some save and load game functionality.Chess_Hardware.py
Program used to test hardware. It currently supports movement for player and pi and gets the players move. Most of the code will be added to Chess_Main.py at a later date.Gamestate.py
Class to hold the current game condition used by Chess_Main.pyMcpBoard.py
Class to control the hardware e.g. the chessboard using a MCP23017 chip to expand the raspi's I/O ports. Used by Chess_Hardware.pyStockfishEng.py
Class to interact with stockfish program used by Chess_Main.pyChessboard.py
ChessBoard v2.05 is created by John Eriksson - http://arainyday.se |
Hardware
Breadboard layout for testing of leds and reed switch matrix
Yes, breadboards can get messy!
The real breadboard
The development circuit is a 3 x 3 matrix of 9 LEDs and 9 reed switches. This should be ok for testing the basic code to read the reed switches and light LEDs as needed. I'm not sure that it would be possible to get all 64 LEDs and switches on this size of breadboard :-).
The development matrix circuit diagram
This is an easier to follow of the circuit used in development. I have used schottky diodes to prevent key ghosting, and 330ohm resistors for the LEDs. Not all 64 LEDs will be on at the same time, as the current draw on the MCP23017 and Pi could be too much.
These are the requirements for Raspbian
Install Stockfish
sudo apt-get install stockfishEnable i2c
sudo apt-get install python-smbussudo nano /etc/modprobe.d/raspi-blacklist.conf
comment out the line blacklist i2c-bcm2708
sudo nano /etc/modules
Add i2c-dev to the last line
sudo reboot
Information taken from raspi.tv
Wiringpi2
sudo apt-get install python-dev python-pip
sudo pip install wiringpi2
Chessboard
Used for game logic
Download from pygame