Sunday, April 10, 2016

Switch Matrix

How do you drive 64 lamps and read 64 switches from a microcontroller (in my case a raspberry Pi) that only has a limited amount of io pins?
Easy answer *might* be to use a beaglebone black, one of which I own, but where would be the fun in that?

One of my requirements when rebuilding the Gameshow machine was to minimise the amount of cabinet rewiring needed.  The idea would be to figure out where the lamps/switches/coils/whatever connect to the circuit boards, and build my boards to accept those connectors.  Now, pinball lamps and switches are usually controlled using a matrix.  The basic overview looks a little something like this:

The idea is that the cpu energises the rows in sequence (1P10 - the white/something wires) and then once a row has been energised, it has a look to see if there is any activity on the columns (1P8 - the green/something wires).  An excellent article on switch matrix theory can be found at

So I'm building hardware, making circuit boards and testing things.  It becomes a massive hassle to hook my prototypes and breadboards up to the machine each time I want to test something so my solution was to make my very own mini switch matrix tester.

It basically is a 3x3 switch matrix wired up in the same way the actual machine is.  This makes my life much easier when figuring out my logic and circuits.

I use a 74238N 3-to-8 decoder to drive the rows, and each column is read directly, via a buffer chip - mainly to protect my pi from anything that might go wrong.

I'm taking a modular approach to my circuit board design.  Dirty PCB's make awesome cheap boards up to 10x10cm.  I cant fit everything i need onto one so each board will have a 40 pin IDE connector on it for linking through.

My switch matrix board is fairly sparse as not much circuitry is needed, apart from the large connectors.

After some faffing about with pins and things, we have a working switch matrix!

No comments: