Design for easy to build one system Chess Computer

The goal of this new project is to build a fully functioning Wooden chess computer (Like a Mephisto Exclusive) similar to the one described in this site, but in a simpler way and in a way that others can copy. It is important that the design produces a wooden board that is nice to look at and use.

Design goals:

  • Raspberry Pi based, no other processor
  • Simplicity/ ease of build.
  • Low cost
  • Ease of duplication by others.


New Easy to build Electronic chess board design!

Since I first built this project the Raspberry Pi environment has exploded and many new bits of hardware and software modules have been developed. The net result is that it is now easier to build a system using just the Raspberry Pi (without an Arduino) and the alternatives to the Pi such as the Beaglebone Black make no sense. The arrival of the Pi Zero for $5 strengthens the case.

I2c bus connects all major components

I2c Based design with multiplexor

I2c Based design with multiplexer, only major connections are shown                                                          Note: Red wire is 5v and the purple wire is 3v, Green = Ground, Yellow = SDA, Orange= SCL


My original design had assumed I could use a single I2c bus and hang all devices off that. It turns out that while it is logically possible to connect a very large number of devices to the Raspberry Pi via I2c, It is not electrically straight forward. Many I2c devices are supplied on breakout boards with built in resistors, and devices may run at either 3v or 5v.

The 5v devices usually run displays. The net result of all of this is that in  practice you can only directly connect 3 devices reliably without carefully balancing voltages and separating out devices with different voltages.

I found that with the device mix need for this project that I  got intermittent failures because of the load place on the bus if  4 or more devices are attached. So the noughts and crosses project worked fine, but this chess project requires a slight adjustment.

The solution, is to connect a TCA9548A  I2C multiplexer to the PI and then connect up to 8 devices to the multiplexer.  This gives you 8  I2c channels to which each component is connected.  All that is required is a small change to the original software. I am building this variation now and will include more detail when its done and tested.

9th December Update:

I have now tested the TCA9548A  I2C multiplexer with all devices and it works well and simply. You connect the mux as if it were a 3v I2c device using 3v, Gnd, SDA and SCL.

It normally has an I2C address of x70, but I changed it to x71 by simply taking A0 to 3v, this avoided a conflict with the HT16K33 which is also x70.

On the output side, you connect each device to its own 3v or 5v supply, plus GND and then connect its SDA & SDL leads to whichever of the 8 channels you choose. ( 0 to 7)

You start your code with these lines to set up the mux:

import smbus
I2C_address = 0x71
I2C_bus_number = 1
bus = smbus.SMBus(I2C_bus_number)

Then before each device you tell it which <12_channel> 0 to 7 to use by using:


the “2**i”    calculates binary that gives channel pos, ie channel 0 is 0b00000001 (first channel along) and channel 4 is  0b00010000  (5th channel)

Importantly you don’t change the I2C address of any of your devices from what they were before, except where they might clash with the MUX, in my case no “0x71” allowed.

The great advantage of this device is that:

  • You can have up to 8 channels, but the load on the Pi is as if one is connected.
  • You can use devices with a mixture of 5v or 3v powered directly from the Pi without the need for a logic level converter.
  • Devices can have duplicate I2c addresses provided they are on different channels, the only reserved address is the Mux address.


The only exception to this good news is the Sain Smart I2C  LED  LCD with  Keypad that I used for the noughts and croses project. Unfortunately the Adafruit library it uses seems to have hard coded bus routines in it and I cannot figure how to edit it. I have also decided I want a bigger screen so I am going for an I2c 4×20 Character LCD, which I have tested with the mux and it works, plus another MCP23017 for the four buttons I need.

My next step is the final assembly of all this, however I am off for a month or so soon, so it may take a while before I get around to it.


TCA9548A 1-to-8 I2C multiplexer

Adafruit TCA9548A 1-to-8 I2C multiplexer


My new design uses the I2c bus. This means that it connects to the Raspberry PI using just 4 wires. It consists of these elements


Another advantage of this design is cost. The total cost of all the electronic components is shown below. All except the Pi, sourced on Ebay, mainly from China, more expensive if bought locally.

Item  Price £
1 Raspberry Pi Zero (But any pi will work) 3.00
1 TCA9548A 1-to-8 I2C multiplexer 6.34
5 MCP23017 port expanders 4.00
64 Reed Switch Glass Normally Open 6.93
1 Adafruit 16×8 LED Matrix Driver Backpack** 1.54
64 5mm LED s 3V 3.20
32 10mm x 1mm Neodymium magnets (for the pieces) 4.39
1 I2C 20×4 Character 5v LCD Display 4.00
4 Push Button Switches 4.00
Total Cost 37.40


I will put up more details of the build later, but the connection each of the components above is well documented on the web.This does not include the cost of the chessboard & pieces.

** I used to list the generic  HT16K33  board, but I had problems with it. So I think it better to use the Adafruit 16×8 LED Matrix Driver Backpack – HT16K33 Breakout, particularly as they have written the driver for it.


The software for each component is broadly the same as described elsewhere on this site and I have got all the components working separately. I am currently working on finishing the hardware build. Whatever way you design it there are still 64 reed switches and 64 LEDs to solder in place.

Controlling the Reed Switches is here

Controlling the LEDs can be done with the Adafruit 16×8 LED Matrix Driver Backpack – HT16K33 Breakout it has its own library, which makes programming in Python very easy.

The Physical Build

I have described elsewhere the basic approach to building my first chessboard. Here are some further topics on the subject including a welcome contribution from Brian.


41 Responses to Design for easy to build one system Chess Computer

  1. Olivier says:

    Hi Max,

    An idea for the enclosure. I went to a web site that offers tailored enclosure at reasonnable price ~50€ including transport for a 50*50 cm with a specific pattern. Possibility to choose the type of wood (oak, beech) & pattern. (sorry in French)
    I requested if possible to keep only the sides (the central part being dug) and that was possible at same price.

  2. Olivier says:

    Hi Max,
    Yes. I have bought a chessboard and will dig the inner part for the reeds. Then I think of just putting it onto the enclosure. I’ve looked on the Internet and it is quite difficult to find a second hand base with the right size.
    I will also see to do it myself but I’m not quite sure of the final result compared to an cabinetmaker

  3. Hi,

    I’ve be interested to join in if you are going ahead with something like this. Otherwise I’d love to know your ideas. I see another site where a man just bought an existing board and dug the inside out so as to fit in the components. The building of the matrix looks hard though.

  4. Mis012 says:

    I came up with an idea to make a low cost arduino chessboard a long time ago, which would record moves and save them to pgn file. But when pi zero appeared, I started to think about making it a chess computer with it. I am still unsure if reed switches are good enough, but if you will provide your source code, then I might be able to build up on that or just stay with a working thing as opposed to being stuck trying not to use reed switches becouse it would be hard to program.

    So to me it seems like a good idea. I’ll have my zero soon hopefully, so I can start testing some of my ideas that won’t need other hardware. I will post my idea here if I can get it to work.

    • Max says:

      Writing a simple chess computer (no board) is reasonably straight forward. The Python Program that runs Stockfish on this site does that. It will run on a Pi zero. You just need to write an interface. The page contains all you need as downloads including source code. The difficulty comes when you want to use real pieces and a board rather than a screen. Reed switches work really well. The chess computer I built uses them as do most of the commercial systems. If you don’t use reed switches, how do you intend to detect piece movements?

      • Mis012 says:

        My problem is just hardware based, becouse there are things like piece capture, castling or piece promotion, and also people dragging pieces. To me it seems really complicated, if not impossible to solve flawlessly. I’d like my chessboard to be usable without instructing people not to drag pieces.
        Also why are you using this particular display when there are way cheaper on ebay? Actually even cheaper small TFTs.

        • Max says:

          You are right that it impossible to make any man machine interface that works flawlessly. However most of the issues you address can be overcome. Piece capture, castling and piece promotion all require the user to tell us what he is doing. In castling the rules of chess state that you must make the King move first. From there we know where the castle must move. In piece promotion, we must provide a way to tell the board what the new piece is. I do this by asking the user to press one of four coloured buttons. For piece taking we know that two pieces must be lifted, the taking piece and the captured piece. we know which is which from whose turn it is. We therefore allow therefore record all reed switch movements and can easily work out what has happened. Similarly for Dragging we use “Debouncing” techniques. We capture all reed switch changes but only use the first one and the last one, ignoring all in-between moves. You are right it is complicated, but it can be done by thinking through all the possibilities. In real play with real people my chess computer works fine allowing players to focus on the chess.

          You also say I could have used a cheaper display. The display I suggest is “Sain Smart I2C IIC Interface RGB LED Screen LCD 1602 + Keypad” it costs £4. It has the advantage that it includes 5 buttons, has a really simple to use driver written by Adafruit; and has simple I2C wiring, in common with all the other parts of the system. So I only need to run four wires from the entire board to the Pi. However the advantage of an open design is that we can each choose our own solution. The problem with TFT displays is that you need special versions of the operating system to drive them and then you still need more connections for the buttons. I have some TFTs and the only way I could get a sensible solution was to drive them from an Arduino, but that drastically complicates the design.

  5. migan says:

    Display: Sain Smart I2C IIC Interface RGB LED Screen LCD 1602 + Keypad (Lots of alternative here, but this seems the simplest to start with)
    Would you list the alternatives here please.
    Thank you!

    • Max says:

      Migan, one alternative is: “Adafruit RGB 16×2 LCD and Keypad Kit for Raspberry Pi” which is functionally the same as the Sain Smart. In this new design I wanted to keep everything using an I2c interface. However nothing stops you using any display you like, you just need to be able to send messages from Python. So you could use a serial LCD display. I did look at using touch screen and other TFT displays, but they make things more complicated and you only need to send simple text. The whole point of a wooden chess computer i that it should feel as much as possible like playing chess on a board with a person. If the display is complex, you don’t need the board.

  6. Jonathan says:

    Hi Max

    Great project! Just wondering if you will be posting some more details of the new build, ie the one with the i2c controllers?

    Many thanks

  7. Jens says:

    Is there anywhere a complete building FAQ ?
    I´m not a specialist in computer programming, but I
    really would like to build this Chessboard.
    Can anyone help me with the programm and the wiring ?
    I have an Raspberry Pi Zero and all other parts, like in the
    list above, but I dont know how to go on further ..
    What should be on the Micro SD Card ?
    THX for helping !!

    • Max says:

      Well that’s the point. This is an opportunity to learn. You could start by building two simple circuits.
      1) a three by three matrix of LEDS that switchs them on in sequence.There a lots of tutorials on the web like this one.
      Once you can do this, you can do a chess board 8×8 matrix. 2) a three by three reed switch circuit, again lots of examples on the web. Then take these two circuits and build a Tic Tac Toe (Noughts and Crosses) game.
      The chess board is just a more complicated version of that.

      • Jens says:

        OK, I´m 61 years old and just retired from work. I thought it would be easier to build. So i bought the things for nothing, but that doesn´t matter.
        Is there a possibility to buy a complete Raspberry Pi for that with all wires connected ? I have a chessboard and will connect the magnet sensors and the LEDs with it.
        Please help me ! THX !

  8. Brico Pierre says:

    Hi. Thanks for your ideas. I just wonder if it would be possible to put RFID (or a similar technology) into the each chess piece to detect them automatically on the board.

    I’ve a DGT electronic board and it’s able to detect all pieces. This very convenient to analyze position without playing with a keyboard/screen to setup the starting position.


    • Max says:

      THE DGT boards with piece recognition cost around $1000. For our build. it would be possible to put an RFID tag into each piece. The RFID tags are cheap and small, so that’s no problem. The issue is reading the tag.A simple RFID reader costs $3, so in theory you could put one under each square. That’s $192 worth of readers. It might be possible to have a single reader and use some form of multiplex antenna under the board to read tags, but that’s way beyond my knowledge. I agree it would be great to do this, so if you figure it out, let me know.

  9. Brian says:

    I want to recommend my method for the board because it is so simple and works so well.

    I bought this board on ebay
    drill a 3mm hole at each corner of every square for the led’s.
    counter drill from the back not all the way through because the led base is bigger than the top
    drill a 3mm hole again not all the way through to insert the reeds vertically. ( i use a bit of pipe on the drill bit to set the depth.(use needle pliers to bend the reed wires or you will break the reed switch). both ends protrude from the hole.
    The reeds will stick out <1cm, also you need to mount the electronics on the back, so add a rim around the board 1-2 cm's to allow for this.
    so no need to hollow out the board and no pcb for the switches/leds required.

    • Max says:

      Brian, This looks like an interesting solution. For my new design I used a similar board, but routed grooves for the Reed switches. Your idea of mounting them vertically looks much simpler.
      The other challenge I find is running wires and soldering 64 chess squares each with 4 solder points. Could you post a picture of your wired board so we can all see what techniques you used?
      Did you use bare wire and add insulation, or covered wired and cut insulation gaps?

  10. Brian says:

    This is also my mark 2 board, the first one I routed grooves in the board, and laid switches horizontally, but I found the magnetic sensors too fussy. This method is not only tidier, but it also works much better.
    I used this for much of the wiring. to hook up the board. The advantage is you can solder directly and the heat melts the insulation.
    I also use wirewrap wire for connections to the arduino.
    For each square I soldered the reed and diode together ( tip – use blue tac to hold the parts in position for soldering)
    Then used needle pliers to form the wires before pushing them into the hole. so just 2 wire connections per switch.
    I have completed this part and it works really well, I tested using the arduino sketch and serial monitor, that I get good responses from every square.
    For the led’s I have ordered the HTK1633 as your recommendation, but that will take a while to arrive from china.
    I don’t see a way to upload a picture here.

    • Max says:

      Brian, useful tips here when you say “For each square I soldered the reed and diode together” what do you mean? Is this an LED or a separate diode? If so does that mean you wire your reeds in a grid rather than direct connections? If so, do you also have an LED grid?

      • Brian says:

        Yes, I do it a little different to yours. I use an 9*8 grid ( the 9th row is for up to 8 buttons). The diode on the reed isitch is to prevent ghosting.
        I use a 4017 decade counter to select each row and then load it in parallel into 4021 shift register, which is read serially by the arduino
        I have a separate 9*9 led grid (because i have a led at each corner of the square). I used 2 *max7219 on my prototype. but will use HTK1633 on my mk 2.
        My arduino code is also on my github site.

  11. Brian says:

    I have uploaded my version of picochess to github
    it accepts commands from the arduino such as l: square number and d:square number to lift and drop pieces. b:button number for menu buttons. tb: for take back
    It sends to arduino
    L: square list or C:square list to light or clear squares.
    You can select different engines, levels personality, time controls and more from the menu ( see picochess documentation)
    My version also includes a mode, when a piece is lifted, all destination legal squares are displayed.
    If anyone wants to use this, I recommend downloading an image from the original picochess and replacing the picochess directory with mine. This should avoid the problems of getting all of the requirements satisfied.
    Be aware though I am not a programmer and I learnt Python by tinkering with this. It is not complete and probably still has bugs, but it does work.

  12. Bryan says:

    I’ve read elsewhere that using the Arduino can help take some load off of the Raspberry Pi. Also, I was curious to hear how well Stockfish runs on the Pi Zero. I agree that the form factor of the Zero looks great for this project, however I wonder if a beefier CPU would be useful for running a chess engine. In terms of these two question, how well are things working for your build with just the Raspberry Pi Zero?

    • Max says:

      Bryan, The argument for having the Arduino control the board and the Pi control the chess engine is more one of flexibility and separation of function. It adds a small amount of complexity because you now have to do serial coms between the Arduino and the Pi. The load on monitoring the board is tiny and when Stockfish is thinking, the board is not really being monitored. The code for running on different versions of the Raspberry Pi should be the same. You are right that it probably plays stronger on a more powerful Pi, but since at plays with an ELO of 1300 at its lowest level and I have never beaten above level 2, I wouldn’t worry. It will still be awesomely strong on a Pi zero. Unless you plan to use the board seperatly from the chess engine, it all gets simpler if you write on just the PI.

  13. Karsten says:

    Max, this is really a cool project. However, piece recognition seems to be misleading as your board can only do piece tracking from the starting position. I thought a bit on how to realize real piece recognition, because I want to setup an arbitrary position when doing training. In the end I came up with using LC resonant circuits instead of reed-switches, which seems to be the obvious way to do it and I guess that the commercial boards also use this. After some extensive search I found a forum where this idea was already mentioned, which I cannot find again…
    I also plan to include more functionality that a DGT board has.
    Btw, the is a kickstarter project called square off doing a similar (?) board as yours

    • Max says:

      Karsten, very interested if you can get piece recognition to work, please keep in touch. Also had a look at “square Off” it looks amazing and I’ve backed it. They have already reached their pledge goal so it looks like it will go into production.

    • Brian Loxton says:

      This looks interesting.
      I mentioned in another post on this site I am experimenting with Hall effect sensors for piece recognition. I only have one sensor at the moment but I can successfully detect the 12 different pieces. I won’t know how consistent it is until I get the other 64 sensors.
      Did you consider this?. It seems simpler than LC resonance.

  14. Karsten says:

    Brian, I also thought about Hall effect sensors. It is one of the ways to detect the current change due to the resonance directly, but the resonance is the effect for making it work. One sensor should be enough if you use a 16 channel mux to adress the rows and files. I couldn’t find your other post, so what configuration are you using?
    The other way is using a DAC/ADC combiniation and some signal processing this approach would allow for both measuring the current and or the resonance frequency. Detecting the frequency depends on DAC/ADC resolution, sampling rate and analog bandwidth which will determine at which frequencies the resonances can be placed. I chose this approach mainly because I am working a lot with DACs and ADCs in my job.
    Yesterday I received my ordered parts for realizing the project, an analog/digital mux/demux and an AD/DA converter board. So far the project existed only as a plan based on common sense and I have never worked with a Pi or an Arduino before. Now that I got the parts I will start experimenting. Especially the allowable thickness of the board and the crosstalk from neighbouring pieces/squares is something I need to figure out.

    • Karsten says:

      Brian, I just saw that you are using only the magnetic effect. Is that precise enough for working through the board and also for pieces that are maybe placed off center on a square?
      I was assuming that you use Hall current sensors. That is what I considered first, but I don’t know how precise they are as most of them are for currents up to 5A.

  15. Brian says:

    I plan to route the back of the board to bring the sensor within 1mm of the chess piece.
    My measurements using Arduino analogue input give readings for 200 at 1mm and 500 at 9mm gap. so I need to find the best 6 gaps.
    Pieces off centre are potentially a problem but I am hoping to mitigate that with magnets that are close to the same diameter as the chess piece base.
    I know commercial boards use LC so it is likely more reliable, but I like to experiment.
    I’ll update when I get more data, and I will likewise be following your project with interest.

  16. Max says:

    See update to new design, TCA9548A 1-to-8 I2C multiplexer now required to make I2c work on a Raspberry Pi with more than 3 devices. Doesn’t look like a problem, testing now

    • Bryan says:

      Is this documented somewhere (the 3 device limit for the Raspberry Pi on I2C)? I did some digging and most forums have people suggesting that it isn’t a problem to have as many devices as you can get unique addresses on the bus.

      My current setup only has 2 devices on the bus, but I’m about to scale up. What kind of behavior did you see without the TCA9548A?

  17. Instead of the fragile reed switches that only switch on or off and therefore are unable to tell the difference between each piece – you could use a hall effect sensor and a different size magnet for each type of piece and a different polarity for black or white. Then you could easily measure the variation in resistance to determine the colour and type of each piece on the board as it does in the very expensive DGT boards. Also a Hall effect Sensor could even be made from silicone allowing even for a roll-up board.

    • Max says:

      Vincent, the great advantage of reed switches is that they are extremely cheap and very reliable in operation., but as you say measure only on or off. A number of people have tried using Hall sensors to identify pieces by using different size magnets. The problem is that pieces are rarely positioned precisely on a board, so for any given magnet strength, there will be a variation in detected strength that can overlap with other magnet strengths, so the results are ambiguous and in practice it doesn’t work. DGT uses passive RF technology where each piece/colour combination has a unique RF frequency achieved by different windings on a ferrite core. The sensors involve multiplexing detection antennae. In theory RFID/NFC should be a good technology and there are a few examples.

  18. Brian says:

    I already have a board working with hall effect sensors, (about £7.50 for 100 on ebay). it is quite easy to wire up using 4 of , 16 input analogue mux Cd74hc4067
    As Max says it is difficult to get reliable piece information because of variations in magnet strength, gap and centralisation of the pieces. I minimised some of this by using big diameter magnets (25mm) and varying the distance from the board for each piece type using shims. And although it works, it is not 100% reliable.
    I’m still working on it.but there is no downside because even if it can’t be used reliably for piece recognition, It works 100% for piece detection. and it seems reliable enough for setting up positions as long as you monitor the board.
    I have cast the magnets into plaster-cast moulds of the Lewis chess set.
    Max, let me know if you would like to include pics on your website and I’ll email them to you.

Leave a Reply

Your email address will not be published. Required fields are marked *