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:

bus.write_byte(I2C_address,i2c_channel**2) 

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.

Software

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.

Software that uses the MUX

All the hardware elements work together and have now been tested. I am now in the process of completing the physical build and will then modify the chess software for the PI only build.

In the next few weeks I will publish test software for these Mux elements, but as a taster here are two test programs. Both use the Mux. One tests the 4 MCPS by  printing to the monitor the state of a chess board switches  eg A1 Open or E4 Close. The other does the same thing, but also turns on and off the corresponding LED using  the HT16K33

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.

Connecting the I2C Hardware

First connect the TCA9548A I2C multiplexer: directly to the PI as if it were a 3v I2c device using 3v, Gnd, SDA and SCL.

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

Check by typing: sudo i2cdetect -y 1

You should see one device connected with address x71.

You will see that the MUX board has 8 channels labelled 0 to 7. Each channel is a pair of SDA and SDL connections.

Our Connections will be:

Channel Device I2c Address
0 KCD Screen and Keyboard 0x3f, 0x20
1 HT16K33 0x70
2 MCP23017 Chess col A,B 0x21
3 MCP23017 Chess col C,D 0x22
4 MCP23017 Chess col E,F 0x23
5 MCP23017 Chess col G,H 0x24

 

 

Now connect each of the 4 MCP23017 s to one of the channels by wiring the SDA & SDL leads to the Mux connection as shown in the table above. ie One MCP to one channel. Connect the power and Gnd cable to the 3v and Gnd pins on the PI.

Configure the MCPs to the correct I2C address from the table. see the NOX page for how to configure I2c Addresses.

I suggest you do one MCP at a time, or at least just do one to start with. You can modify the test code in MuxMaxAllMCPV2.py.  There are two loops for the MCP, one for set-up and the other for scanning. of the form

for i in range(0,4): # for each of the 4 MCPs

# read the 8 registers
for k in range(0,4):

Change that so for the first MCP it reads i=0  and k=0  (i and k are not the channel numbers, you will see that the program adds “2” to each)

 

Note that if you run   sudo i2cdetect -y 1 now, it will still only show one device at  x71, the Mux.

The I2C signal is switched through the mux by the program to the correct channel preserving the I2C address of the device so that the device recognizes the call. As all the MCPs are on different channels we could have given them all the same address, but I made them different so you can test without the Mux if you want to and for clarity.

56 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.
    http://www.soclebois.fr/ (sorry in French)
    I requested if possible to keep only the sides (the central part being dug) and that was possible at same price.
    Olivier

  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
    Olivier

  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.

    Thanks

    • 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 http://www.ebay.co.uk/itm/152207797934
    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.
    http://www.ebay.co.uk/itm/10pcs-0-1mm-Copper-Solder-Soldering-PPA-Enamelled-Reel-Wire-uk-/371445757889?hash=item567be477c1. 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 https://github.com/Ernisius/Picochess-nonDGT.
    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 https://www.kickstarter.com/projects/1852340281/square-off-worlds-most-evolved-chess-board-ever

    • 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.

  19. John says:

    TL; DR: Piece recognition does not require special components in the pieces; it can all be done by simply keeping a list of where each piece has moved. Problems can be set up by giving the computer the name of each piece as you place it on the board. Pieces can be added, subtracted or substituted using the same method.

    I have an Excalibur Grandmaster chess computer ( dated 4/17/97) which recently died. I have not been able to find a schematic nor any information on repair; however the way it operates may point to solutions to some of the problems of building a similar machine.

    It has a 40cm x 40cm playing surface, hovered in green and cream vinyl. There is a 45mm border around the playing surface. The electronic components are affixed to two large PC boards which are fastened to the underside of the playing surface. All is contained in a plastic housing 20mm in height. The enclosure could be duplicated using a vinyl chess board glued to a larger piece of hardboard or mdf supported on 4 sides with molding which would generate the required clearance under the Board.

    The PCB’s are not identical. One shows the placement and a pictograph of each component. The other shows only the circuit traces and solder “blobs” with all components mounted on the side facing the Board.

    The PCB with the pictographs shows a reed switch and a resister but no circuit tracing. All of the reed switches are asymmetrically located, fastened along the lower left to upper right diagonal (viewed from the bottom) running from 35mm from the lower left and ending at 47mm from the lower left. I recall reading somewhere that this off center mounting is essential for the proper operation of the switches. My recollection is that if the reed switches are not so mounted they will flip flop rather than remaining either on or off.

    There are two LCDs, one for each player.

    There is a chip labeled “1997 RCN 1002A EXCAL. HD6433214LO 1 P Japan”

    There are 18 resistors, 5 capacitors and 2 diodes.

    All of that seems remarkably similar to the circuits which have been discussed here.

    However, the operation solves a number of the issues, including piece identification cited by some posters.

    White has 15 buttons plus an LCD. Black has 5 buttons plus a LCD.

    The units are plastic, ranging from a 90mm King to a 45 mm pawn. All have felt covered bottoms and all have magnets embedded in the base. A groove made with a fingernail suggests that all magnets are 20mm in diameter. There is nothing to suggest that the magnets are not identical.

    When the game is turned on, and the pieces (that is both Pieces and pawns) are properly set up, play can begin. Lifting a piece causes the LCD to display the ‘from’ square in algebraic notation. When the piece is lowered onto a square, the LCD displays the ‘to’ notation. If the move is illegal the LCD will display an error message. If you change your mind you can retract the move with the ‘take back’ button, to a maximum of 12 moves backwards. If you captured a piece during your move the game will show the name of the square to which the captured piece must be replaced.

    The game keeps a record of where each piece has been moved because if say, you tipped the board over, you can press the ‘verify’ button. The game will then run through the pieces by color, starting with the first Queen it finds. You replace the piece, press the ‘verify’ button again and it shows the position of the opposite colored Queen, and hence through each of the pieces which were on the board.

    The game recognized a castling move when you move the King two spaces, it recognizes a capture when you move to a square occupied by your opponent, when your pawn moves to the last row, you press one of four buttons to choose your promotion, then replace the pawn with another piece.

    When your pawn moves to capture en passant the game will remind you to remove the captured pawn.

    If you want to resurrect a fallen piece, swoop down and rescue your King from checkmate or handicap your opponent, you press the ‘setup’ button, remove the piece you want and then press ‘on/clear’, to add a piece, press ‘set up’ then press the button with the symbol for the piece you want to substitute put the piece down (then up and down again to toggle to the opposite color if necessary). Using the two set up steps in sequence allows you to remove a piece and replace it with another.

    You can set up a problem to be solved by turning the game off, removing all pieces and turning it on. It will show an error message but you can then use the ‘set up’ key and the ‘piece symbol keys’ to set up the position you want to analyze.

    The other functions are those found in software chess games; learning openings, replaying Master’s games, choosing levels, getting hints, getting an evaluation of your score during the game, having the game warn you when you have blundered.

    So, all that is required to have the game ‘recognize’ pieces is a running record of where each piece has moved and a way to add or subtract specific pieces from the board. Presumably the software chess games can do exactly the same thing and the only issue is how to convey the information to and fro and display it in an LCD.

    JOHN

    • Max says:

      John, thanks for comment. You are right if you know where a piece starts you can track its movement. As a result you can monitor castling, en passen, Check, stalemate etc. Almost all commercial sensory boards use this process, as does mine. However this is not piece identification in the strict sense, where the board can verify at all times what piece is there. The DGT board does true identification. You can set up a position by just putting the pieces on the board and it uses an RF system to read the uniquely wound ferite core. Therefore when you promote a pawn you don,t have to tell the board, it knows. As a result the DGT boards are widely used in competition to record and verify all moves in a completely unobtrusive way.(and stop cheating by piece swapping)
      Ps I may also need to prune your contribution a bit.

  20. Darian says:

    Max – First off. Thanks so much for your site. I’m in the process of building a board similar to yours (only difference is that I’m attempting to add speech to text functionality).

    I’m struggling to understand how to get the multiplexer to work (how to use it in conjunction with the port expanders, the LCD Matrix, etc). Do you have any snippets of code you can share? Thanks.

    • Darian says:

      Hey – I think I figured it out; I just added the lines of code you listed above… seems to work at least for my initial tests.

      • Max says:

        Darian, well done. Are you building the full I2c setup with 4 x port expanded, LCD and led controller? If so I will be interested to know if they all work together. I am having some problems which I think might be solved with a few pull up resistors. Let me know how you got on. My first board used an Arduino which seemed more tolerant.

  21. eric says:

    Max, thanks so much for this! Do you by chance have an updated script to read all 64 of the reed switches using the updated I2C multiplexer? I’m referring to this script, http://chess.fortherapy.co.uk/files/2016/09/MCPscanv2.zip, on this article, http://chess.fortherapy.co.uk/home/a-wooden-chess-computer/design-ideas-for-easy-to-build-beaglebone-black-chess-computer/using-four-mcp23017s-to-control-64-reed-switches/

    Thanks!

    • Max says:

      Eric, I do, I will tidy it up and post it in the next few days.

      • eric says:

        Thanks for getting back to me. I hate to be a bother, but I’m working on a time-sensitive project right now that isn’t a chess board, but we are using the same model in which we are using the same MCP port expanders and now the multiplexer. I don’t need all of the chessboard code, just a script similar to the previous one in which all of the switch input is read to see if they are open or closed. With that being said, it doesn’t need to be tidy or anything at all, even if you have just a gist or a github where I could take a look at how it’s done, that would help tremendously! Project deadline is getting close :/

        Best wishes,
        Eric

        • eric says:

          Sorry for another post, but I suppose for my project, I also need to control 64 LEDs, similar to the chessboard. I am using the same chip you are, with it wired up to the multiplexor. Thanks!

        • Max says:

          Eric, see above. I have given a Github link to two test files that should help.See the section “Software that uses the MUX” They worked last time I tried them.

          • eric says:

            This is great, thank you. I’m getting an I/O error when trying to write the GPA pins as inputs, however. I have also shorted A0 to set the multiplexer to 0x71, but in my i2cdetect, I am only seeing 71, not any of the MCP devices (21, 22, 23, 24). I figured that was alright because the multiplexer acts as a switch to direct traffic to each of the attached devices, but in this script, we are looking at each of these i2c addresses. I think that’s why I’m getting that error. Any ideas?

            • eric says:

              After running the test script and checking i2cdetect again, looks like I am seeing 71 and 21 addresses now. Script isn’t running without errors though, as I should see all four MCP devices in there. I’ve checked the wiring for the mux and MCP devices many times, not sure what I’m missing.

              • Max says:

                Eric
                You should only see address 71, if everything is connected thru Mux. suggest you build up element by element. E.g. One MCP no mux, then thru MUX, then Led controller no mux etc. Errors might be blown RPI pins. Note I am running on RPI3 for this.

                • eric says:

                  I am also using a Pi3. So far it works with the LED matrix, and then I get the error when I add the first MCP. Is the wiring different than it was before using the mux? How do the MCP devices have addresses of 0x21-0x24 if we are only seeing one i2c device (71 for the mux)?

Leave a Reply

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


*