Arduino, Rasperry PI, Reed Switches, LEDs & more

The Hardware consists of the board plus the various bits of electronics, buttons etc. You can see a video of the hardware components here.

The Board

I needed a board that was thin enough to allow the magnets to activate the reed switch.

My experiments showed me that an 8mm board worked well with 1cm diameter magnets. However all the good quality chess boards I found were at least 15mm thick. so I decided to build my own using 50mm strips of veneer on 8mm MDF board see Building the Chess Board. This worked well.

The Pieces.

I used a standard set of Staunton pieces and simply glued 10mm x 1mm Neodymium magnets to the base:



The Electronics:

The parts list was:

  • Arduino Uno to control the board. I chose the Uno because it is easily available in the UK. The Teensy 2++ would have been a better choise as it has more pins and more memory
  • Raspberry Pi
  • 64 5mm green leds
  • MAX7219CNG LED display driver. A brilliant little device that makes controling the LEDS very easy.
  • 64 Reed switchs
  • Centipede Shield  add-on PCB for Arduino . It uses the Wire I2C interface on analog pins 4 and 5 to provide 64 general purpose I/O pins which I used to directly address each reed switch.
  • LCD Display: basic 20 character by 4 line display. Utilizes the extremely common HD44780 parallel interface chipset
  • Four buttons for chosing options etc
  • Piezo buzzer
  • 64 10mm x 1mm Neodymium magnets


Click here for a higher quality image

15 Responses to Hardware

  1. Berger says:


    Max, I see that you have solved the controll of a LED in each square (64 LEDs).

    In case you wanted to use 2 arrays of 8 LEDs (rows and columns), I built some time ago a simple demultiplexer circuit for Bryan. This circuit was never used because Matt didn’t implement its control (from Teensy) in his project SishFishPi.

    Its operation is very simple:

    1) It works with 5V: perfect to connect to Teensy++ or any other USB device.

    2) 3 pins to select row LED, and other 3 to select column LED. With 3 pins (3 bits) yo have 8 possibilities. For example:

    (0=GND, 1 =5V)

    000 – row 1
    001 – row 2

    110 – row 7
    111 – row 8

    And the same for the columns:

    000 – column A
    001 – column B

    110 – column C
    111 – column D

    2) Enable Pin (E):
    0 = All LEDs off
    1 = The previously selected LEDs will turn on.

    4) The best, I think, is to make the selection “before” you “E”nable the circuit.

  2. maxchess says:


    The circuit you have designed looks interesting, however my knowledge of electronics is limited.
    My alternative was to use the MAX7219, which is quite cheap, £9.41 from proto-pic and which has a set of libraries that run on the Arduino & Teensy.
    Also the chip is driven by just 4 pins.

    The libraries allow you to control up to 8 MAX7219s = 8×64 LEDS daisy chained together!, for the chess board we need only one.
    You can then address any LED directly, so for example to switch on the LED in the first array (0) at position 2, 7 (in an 8×8 array) we just say
    to switch it off we say

    the library also allows us to switch all LEDS off or on and off course we can make them blink by looping around on, off with a delay.

    You could also drive the MAX7219 directly from a Raspberry PI using the SPI interface or directly (see http://browse.feedreader.com/c/Raspberry_Pi_Blog/283371850) but it requires more effort in code and uses most of the GPIO pins, so I think you are still better off letting and arduino/teensy drive hardware.

  3. Michael says:

    Hi Max,

    would you provide the wiring diagram?

    Thanks and regards, Michael

    • maxim says:

      I am not an engineer, just a hobbyist, so I would have no idea how to draw a wiring diagram, but I have added a better version of the hardware layout picture, so you can see better how everything is connected.

      I hope this helps.


  4. Hi!

    I will try to duplicate your great achievement. I wonder what kind of “read switches” you use?

    Pierre 🙂

    • Max says:

      Hi, I just used cheap reed switches I bought from China on EBay. They are quite fragile so order spares, but once in place they are very reliable.

  5. Olivier says:

    Hi Max,

    Congratulations for your great work. It inspired me to try to do the same

    I’ll start by building the usb chessboard using Berger’s sensor Matrix. https://sites.google.com/site/bergersprojects/reedcb/matrix

    Would it be possible to indicate where the soldering should be done to connect the centipede to the reed? should it be at the row level (x) after the diode? (the other side of the reed being connected to the column (y)

    I have also a question regarding the power supply. Do you use only one power on RPI that supplies also the Arduino & the Centipede?

    BR, Olivier

    • Max says:

      The great advantage of using the Centipede board for connecting Reed switches is that you do not need any diodes, pull up resistors or other components. As it says on the “Building the board” page;

      The Reed switches were first glued in place on the underside of the board and then soldered at one end with a common earth, and the other end directly to the strands of 20 strand ribbon cable (16 connections, 2 common earth and 2 unused) the other end of this cable plugged directly into the Centepede card.

      The LEDs and the reed switches are two completely separate matrices. So just to be clear, for the Reed switch matrix you first run one continuous wire as common earth to every square and solder one end of all the Reed switches to that. (It doesn’t matter which end) then the other end of the Reed switch each has a separate direct connection to the Centipede board. So you the address the Centipede board to test if the connection is open. In testing it means you can check each switch directly so fault finding is easy. This makes the wiring easy, but not very elegant and NO diodes required.
      So you choose the x,y connection to match the LED Matrix. I wrote a test program that lit an LED when the Reed switch was activated to make sure the two matched. At first they didn’t so I had to write a little mapping routine rather than re solder the Reed switches.

      On the power supply I used a standard RPI power supply for the pi and the Arduino is powered off the Pi via the USB connection. I have also found I can power the board with one of those portable powerbanks used to power mobile phones. The Centipede board is just a switch, it doesn’t use any pwer. Only a few LEDs are ever on at one time so the whole systen is not very power hungry.

      Please let me know how you get on, only a few people have built one of these. If you have more questions just ask, Max

  6. Olivier says:

    Hi Max,

    thank you a lot for your answer. In Berger site they wrote about ghost effect (diode being a way to solve the issue). I assume centipede and direct connection solve this problem.
    I created 2 diagrams to represent my understanding for options on the reed Matrix and connection to the Centipede. https://we.tl/sSEjq1sX8Z

    Do you think for Reed Matrix the diagram “Wiring_Diagram_Column” be enough?

    About what you wrote:
    “20 strand ribbon cable (16 connections, 2 common earth and 2 unused) ”
    the continous wiring is then connected to the ribbon too. Right? why 2 strands are necessary for the common earth connection?

    Also for the second ribbon only 16 connections are to be used (no need to connect the 2 common earth). Is that correct?

    For Led, I do not see clearly the relationship between the “8 strand ribbon cable glued” and the matrix where each led is soldered (one leg x and one leg y). I tried to zoom the image but the definition is not high enough to see the details of the wiring.

    Sorry I have very limited knowledge in electronics and would like to start with a good basis.

    Best regards

    • Max says:

      You are right having direct connection means there is no ghosting, so no need for Diodes.
      For wiring the reeds I suggest using one long earth wire that snakes its way backward and forward. You are right that in theory you should only need one strand of ribbon cable for the earth, but because the wire is long I made 4 earth connections, 1 every 2 rows. So I used two connections on each ribbon cable, but all going to the same earth

      For the LEDs there is a diagram and a complete description on how to wire the matrix in the links section. Its LED Matrix
      This also gives detailed instructions on connecting the MAX72XX .

      I hope this helps. Max

  7. Jayant says:

    Hi ,
    Very interesting project. Appreciate the lucid way you have explained.
    Is there any DIY shop where I can get all the components for a quick assembly of the chess board?
    I am not sure if I can get all the components in India.
    Pls suggest.

  8. vitor says:

    on this project, you dont identify each peace by itself right? you only know what peace is played because you detect only with the reed switch right? All reed switch are activated at same time and each one is identified by position?

    • Max says:

      That’s right, I track the pieces rather than “identify” them. So I know the starting position and then update where each piece as the game progresses. I have looked at various technologies to track pieces such as RFID, but that requires 64 sensors. DGT boards cost around $1000 and use a patented passive LC technology to identify actual pieces. Any ideas for a practical low cost method much appreciated.

  9. Brian says:

    See my comment under Raspberry pi only build.
    Although my board with vertically mounted reed switches is finished and works perfectly ( much better than horizontal mounting). I would still like a board with piece recognition, and can’t justify the cost of a DGT board..
    I have the 64 hall sensors and am experimenting with them.
    With the sensors glued to the back of the chessboard, routed so there is 1mm thickness of wood. Then mounting the magnets in the chess pieces between 0 and 10mm deep for the different pieces, I can easily differentiate between them. I am using 10mm diameter magnets at the moment and the value stays constant as long as any part of the magnet is directly over the sensor, but quickly falls away when moved a few mm’s off centre. I am waiting for 25mm diameter magnets to see if this works better for pieces placed off centre on the square.
    I will be using 4 of 16 channel analogue multiplexers to read from the 64 squares.

    At the very least this method could replace the reed switches and diodes, and hopefully with some careful programming full piece recognition.

Leave a Reply

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