0

So I build LED cubes and the way I have it programmed is I use an analog pin for the ground layers and set them to high when i want an led on that layer lit up. So lets say I wanted the following LEDs lit

Desired LED behaviour

But in reality the LEDs light up in all the layers that are set to high obviously so this is what actually ends up lighting

Actual LED behaviour

What should I incorporate in order to avoid this happening. I am using an Arduino Nano, do I need to edit my code or is it hardware?

10
  • You turn on one, turn it off, then turn the next one on and turn it off. Do that very fast and it looks like they are both lit.
    – Majenko
    Commented Aug 7, 2018 at 12:49
  • Doesnt work because im spinning the cube around fast so 1 millisecond is noticeable Commented Aug 7, 2018 at 12:50
  • 1
    Then you will need to change the circuit so each LED is directly wired, and not in a matrix. If you can't use matrix multiplexing then you can't use a matrix. Simple.
    – Majenko
    Commented Aug 7, 2018 at 12:52
  • There has to be a better way that i can control parts of the leds and still have a sturdy design thats a cube Commented Aug 7, 2018 at 12:53
  • You don't have a cube, you have a square. And if you are spinning it then multiplexing won't, as you have noted, work well. You have the choice of multplexing (flicker, few wires) or non multiplexing (no flicker, lots and lots of wires).
    – Majenko
    Commented Aug 7, 2018 at 12:55

1 Answer 1

2

Your circuit design has to be used with multiplexing. Multiplexing introduces flicker. Since you seem to be wanting to move the grid of LEDs rapidly that flicker will translate into a very undesirable effect.

So you have a number of choices:

  1. Re-design your system so that you don't use multiplexing. With each LED directly driven you get zero flicker, but you end up with as many wires and GPIO pins needed as you have LEDs (although shift registers could be used to move the bulk of the wiring closer to the LEDs). That's impractical.
  2. Use multiplexing but have the frequency so high that flickering is no longer noticeable. We're talking thousands or millions of loops per second to keep it looking smooth (depending on how fast you are spinning the grid). You would need a high speed multiplex driver chip for this.
  3. Time your multiplexing to the spinning of the grid.

The third option relies on quite a high rate of spin, since your multiplexing increments one column or row for each revolution. With 5 columns to work through it would take 5 revolutions to work through the entire grid.

You need some way of identifying the start of each revolution (e.g., a hall-effect sensor), and each time you start a new revolution you illuminate just one column of LEDs. The faster you spin the smoother the effect will be.

If you want to have LEDs on or off for just part of the revolution it's then down to you to work out when to turn them on or off for that one specific column. That's when the fun really begins.

3
  • Upvoted. Just a remark about 1: you can use e.g. 74HC595's (in daisy chain mode) to upto 32 LEDs with a few pins. Although you need to wire from those 74HC595's to each LED (lots of wires). Commented Aug 7, 2018 at 13:47
  • 1
    @MichelKeijzers Indeed. Plus of course you'd probably then be spinning those around really fast as well, which adds to the instability of the whole thing. Not ideal.
    – Majenko
    Commented Aug 7, 2018 at 13:48
  • Not ideal indeed :-) Commented Aug 7, 2018 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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