2

A friend and I are trying to make a chess board where you play against a chess engine. The move the chess engine plays is shown by lighting a few LEDs on the board and you have to move that piece to that location.

Now I have a Raspberry Pi 2 and it has 40 GPIO pins where 27 are only I/O if I am correct, where I need 6 of them for something else.

So my question is, what way to connect 81 LEDs to a maximum of 21 pins is the easiest? The best solution would be something that we can buy which we can connect LEDs to instead of making all the circuits ourselves.

All help is welcome though!

  • Hello and welcome. To get the most of it for yourself, I recommend to first check the linked Q/A I provided in my answer. That should give you a good first impression how to achieve your goal. Please feel free to either edit your question with any issues that come up in doing so. Or put a new question up if you encounter more specific questions during implementation. – Ghanima Dec 15 '15 at 14:00
4

81 makes a nice 9x9 grid; if you wire them across 18 outputs such that each has a unique combination of X & Y:

Each straight line is one output

Resistors are needed on one set of 9 only. To light an LED, bring the anode low & cathode high, each will have a unique 'address'. It is easy to light multiples, and you could then properly multiplex them to make 9x9 graphics as well.

  • I know this has been a long time, but could you please elaborate on "Resistors are needed on one set of 9 only"? – borisjo Oct 1 '16 at 16:40
  • If you think of the circuit made when a LED is made active , it needs 1 LED + 1 resistor; so one set of wires goes directly to the IO pin, one via a resistor; it doesn't matter whether the resistor line is on row or column (horizontal or vertical on the diagram). – Mark Williams Oct 4 '16 at 22:06
2

There are a few solution possible to do so. As the "update rate" of the LEDs would be quite low, any of these techniques will work. So shamelessly ripping off already existing answers, see below:

Beside, the total number of LEDs could be reduced to about 16, lighting just rows and columns instead of individual squares.


Sources and recommended further readings:

How to get MCP23s08(8 bit I/O expander) working with GPIO on Raspberry Pi?
What is the best way to increase digital I/O lines on Pi?
Raspberry pi GPIO extension
Controlling 400 LEDs from a raspberry pi
Controlling many LEDs with few GPIO pins
Is there an addressable LED product that I can wire to a Raspberry Pi where all the LEDs are separate?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.