Is it possible to control a 3x3 grid of LEDs with 2 I/O pins?

I want to try taking on the project of a led cube with 6 faces each with a 3x3 matrix of LEDs, that is controlled by a gyroscope. Essentially, I want to make it so that one LED traverses through the matrix according to how the box is rotated. I was thinking using some 8-bit shift registers, but pretty sure they need 3 pins to operate. Any ideas?

What is diferente?
All cube has 6 faces.....

What arduino are using?
Do you don't have 3 pins?

Is that 54 LEDs in total, or are the LEDs on the edges and vertices shared by 2 or 3 faces? (That would make it only 26 LEDs, I think: 8 for the vertices, 12 for the edges and 6 for the faces.)

Yes, 3 pins, but you can cascade them so that 7 8-bit registers can share the same 3 pins.

You could use 16 channel i²c i/o expanders instead of shift registers. 4 of those would use only 2 pins, which might be shared with your gyro sensor.

Have you considered multiplexing the LEDs? Might be easier to wire than a pin to control every led individually. 12 Arduino pins and 3 transistors plus a handful of resistors.

One 74595 (8-bit shift register) uses latch, data, clock. 595 can be cascaded.

Using charlieplexing you need only 8 pins for 56 LEDs.

" Charlieplexing Arduino: Control 72 LEDs with just 9 Arduino Pins - The complete guide

LEDs = Xpins * (Xpins-1)...... 8 * (8-1) = 56

Just for grins, could two NAND and an AND gate be used to make it work?

Why not use addressable LEDs like they use in strips? Then one pin could control all 6 faces.

You can get individual WS2812 LEDs on a small PCB so you can arrange them as you like. I used them in this project for an LED race track.

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.