4x4x4 led cube rookie mistake

Howdy all this is my first post so bare with me.

I have made many 4x4x4 led cubes without issues however I have made a epic rookie mistake.

2 cubes I have made instead off having 16 negative wires and 4 positive wires I have managed to get the leds back to front so I have 16 positive wires and 4 negative so obviously the code won’t run the cube correctly.

I downloaded the code to run my cubes as I am fine with electrics etc not so good with arduino code.

My question is can the code be changed to fix this issues ? As I have it all back to front Or is my only option to remake the cubes and start again.

Hope this all make sense and many thanks

Ian Wright.

Can upload code if that will help

Can upload code if that will help

Please follow the advice on posting code given in posting code

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

Well, if you have wired all the LEDs the wrong way round, you can simply invert the logic in the code but you also have to "invert" whatever transistors or ICs you are using to drive the display - swap PNP for NPN and so on.

Frankly, the most sensible way to make - specifically - a 4 by 4 by 4 LED cube is to drive it with nothing more than a MAX7219 but the wiring is different.

I have had to upload the file it self as the code I am using is to long to post in the fourm.
But this is the code I Am using

led_cube_arduino_code_ino.ino (15.6 KB)

Take this function as an example

//turn all on
void turnEverythingOn()
{
  for(int i = 0; i<16; i++)
  {
    digitalWrite(column[i], 0);
  }
  //turning on layers
  for(int i = 0; i<4; i++)
  {
    digitalWrite(layer[i], 1);
  }
}

It sets each of the columns in turn to 0 (why do people insist on using 0 instead of LOW ?) then whilst each column is LOW it sets each layer to 1 (why not HIGH ?)

So, if what you have done is to insert the LEDs the wrong way round it appears that what is needed is the opposite, ie set each column HIGH in turn and each row LOW in turn

Try turning a single LED on and off with a minimal sketch first
Set a single column to HIGH and a single layer to LOW and the LED where the column and row meet should light

If the sketch had a function that turned a single LED on or off based on parameters passed to it then it would be trivial to change the single function but as it is there are many places needing a change. You might be able to do the changes with a bit of cunning search and replace but take a backup first

But we need to know the circuit! Surely the LEDs are not connected directly to the Arduino. Generally you need transistors to drive the layers at the very least. :astonished:

After lots of reading I decided I don’t know enough about writing arduino code and decided to start again,

However I have attached a a circuit diagram as I literally use 64 leds and 4 resisters and a arduino

Looks like the LEDs are driven directly from the Arduino

So this looks like a total disaster!

Well, depending on how "fussy" you are about detail. :grinning:

I presume the resistors for the layers are at least 100 Ohm - can't make out on what is basically a "thumbnail" image. So this means that one layer is activated at a time and how much current each LED receives is strictly inversely proportional to how many LEDs are illuminated in that layer - if 16 LEDs are to be illuminated, each receives one-sixteenth of the current that would be available if only one LED was illuminated and will be proportionately dimmer.

This arrangement means that there is no complication about simply inverting all the outputs in the logic to correspond to an array assembled in reverse polarity, it will work just as well as the original. But the design in general is poor insofar as the brightness will visibly and fairly dramatically fluctuate as the pattern changes. :astonished:

As I said, for - specifically - a 4 by 4 by 4 cube and not larger, the readily available and inexpensive MAX7219 modules can be used (with different wiring of course) to construct a cube with substantial and entirely uniform brightness.

Cheer buddy gonna look into the MAX7219 for the next one I make for me.

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