RBG LED Array <-> Switch Matrix TLC5940

Greetings All, hoping for some help on a holiday gift I’ve gotten in over my head on.

It’s a coffee table mounted map that lights up locations based on a switch array in one of the drawers.
(The map and buttons record/show which national parks we’ve visited, park visited=switch pressed=colour changed)

Arduino Nano
64 Common Anode RGB LEDs
3 TLC5940 LED drivers, one controlling each colour
4 P-MOSFETs controlling the “layers”
64 Latching push-button switches
1 MCP23017 i2C port expander for the switches

My hardware setup is modeled after GreatScott!'s 4x4x4 RGB LED cube:

My switch Multiplexing is based off of:

To move the array from the switchs to LEDs, I’m trying add parts from Mike Cook’s Econo Monome:

I just don’t understand the code…

I have my setup running using the TLC5940.h library:
Tlc.set(LEDs)-> turnon layer one-> Tlc.set(LEDs)-> turnon layer 2-> etc…

But it’s just becoming a mess, could there be a concise way to ‘combine’ these methods?
Define and light maybe 4 HEX arrays that are assembled directly from the 8x8 switch arrays?
This is the only code I’ve found that drives the TLCs based on HEX arrays (0xff = {1111 1111}), is that a good idea?

I know there is a ton of information on similar projects, but I’ve been going in circles for weeks digging through old posts trying to hack and combine things together and I’m running out of time. I haven’t even gotten to the switch part yet, hoping that will be simple.

I attached the frame of what I have for selecting the colours and writing to the TLC, it works, but I can’t find a efficient way to:

  1. Light the array in two colours, one for a switch being depressed, the other for default state
  2. Compare this array to the one from the switches
  3. Change the light array if warranted

*Note this is still a test breadboard only running 16 LEDs, 1x4x4, picture attached, sorry it’s a rat’s nest.

Many thanks for your time and input, you’ll make a fantastic girlfriend very happy.


Arduinome_8x8.cpp (9.8 KB)

MapRun_Help.ino (23.4 KB)

Hi, you could greatly simplify the led driving circuitry by replacing the whole lot with 64 ws2812B or apa106 leds. Massively easier, only question is can you get them delivered in time. You can buy them individually mounted on small PCBs or even in 5mm thru-hole format.


Simplify the switch circuits by replacing with a single pot and single pushbutton. Then you can dial up a park you have visited and push the button to change the colour. Save the “map” in the Nano’s EEPROM memory.

Not only would this massively simplify the hardware, it would massively simplify the software side too.