Possible wiring problem?

Hello everyone. During the past weeks I've been trying to finish my led cube project but I can't solve a problem that keeps occuring. In order to speed up the troubleshooting , I want to make sure that the wiring is correct. How this works is by settting the column pin to high and the row pin to low in order to lit the corresponding led.Setting all the rows of a column to low would lit all of its leds. Only the leds of one column should be lit at a time and hopefully only the ones I want to. I am not too sure about the transistor connections thought and I would appreciate a heads up from the more experienced and knowledgable users of this forum.

The schematic is attached.

Thanks in advance!

Bit_Angle_Modulation_Led_Cube_V4.ino (14.4 KB)

What transistors did you use ?
The ones in your drawing are connected in an a-typical way.
There are no resistors in the base connections of your transistors, is that the way you are using them ?
If you are not sure about the connections you used, show a photo that clearly shows how they are connected, or make a drawing of the housing and what you connected.
That only is useful if you mention the transistor type you used.

Yes, that looks like a standard Charlieplex array with transistor boost on the columns (you would
drive one output high to turn on that column, then the other pins are either INPUT or LOW to
control the 9 LEDs in that column.

The emitter-follower configuration is used for the transistors to boost current without inverting -
there is some voltage drop as a result, but it should only be about 0.7V or so

MAS3:
What transistors did you use ?
The ones in your drawing are connected in an a-typical way.
There are no resistors in the base connections of your transistors, is that the way you are using them ?
If you are not sure about the connections you used, show a photo that clearly shows how they are connected, or make a drawing of the housing and what you connected.
That only is useful if you mention the transistor type you used.

Don't worry, this is a standard trick in Charlieplexing, any NPN transistor with enough current rating for a whole
column of LEDs will basically work.

I'm using the 2N3904 NPN transistor and I don't use a resistor to the base. Can that create any problems ?

What is the problem that keeps occurring?

You don't need a base resistor in that arrangement. However, 2N3904 is not a good choice of transistor for that circuit, because you are running it close to its maximum current (200mA) and its hfe will be rather low at that current. So you are likely to find that the more rows you light at a time in a given column, the less bright the LEDs will be.

My problem is that stray leds light up. Could not putting a resistor to the base affect the current or switching frequency? I don't know much about such details.

Vinter:
My problem is that stray leds light up. Could not putting a resistor to the base affect the current or switching frequency? I don't know much about such details.

You are using the transistors in the common collector (also called emitter follower) configuration, and the emitter current is limited by the LED series resistors, so you do not needs base resistors in this case. Adding them would just reduce the LED current and make the brightness depend even more on the number of LEDs lit.

I suggest you post your code, configured so that you light up only a few LEDs but the problem occurs, and tell us which additional LED(s) light up. For example, what happens if you try to light up all the LEDs in column 1?

The cube is basically the matrix bent into an S shape and lacks the last column of the schematic. 3 leds of every column represent an RGB led. What happens is that while the second column first led's red and third column's second led's green should only be lit, the corresponding led of the other column also light up. Here is the picture. The red led of the third column cant be seen that well but the green one of the second column can clearly be seen. Both are very dim and I suspect it may has to do with the port register manipulation. The code is attached.

sorry for the small size, I had to take this from my phone. Also, the commentary for the interrupt frequency is wrong because I've been messing around a bit with the timer and forgot to change it back.

Bit_Angle_Modulation_Led_Cube_V4.ino (14.4 KB)

The cube is basically the matrix bent into an S shape and lacks the last column of the schematic.

Does this mean that you have built the circuit as per the schematic but have not built the last column into your setup?
From what I see of charlieplexing you need ALL of the circuit for it to work. It relies not just on transistor but the diode action of the LEDs to work.

Tom.
PS Double check your LED polarities as well, one LED in the wrong way round with charlieplexing does not just mean that it will not glow, but it will upset how the rest of the array works.

TomGeorge:

The cube is basically the matrix bent into an S shape and lacks the last column of the schematic.

Does this mean that you have built the circuit as per the schematic but have not built the last column into your setup?
From what I see of charlieplexing you need ALL of the circuit for it to work. It relies not just on transistor but the diode action of the LEDs to work.

Tom.
PS Double check your LED polarities as well, one LED in the wrong way round with charlieplexing does not just mean that it will not glow, but it will upset how the rest of the array works.

All the leds I want to light , do so with no problems. It's just that others which share the same cathodes do so too but very very dimly.Btw the last column isn't needed, only it's cathode row is so we end up with 9 pins that act as anodes/cathodes and one that acts as cathode only. Also I sat down yesterday and checked every led individually . Also checked combinations of leds in each column and it seems that it works as expected. This looks like a programming problem but I can't spot the error.

Then why don't you show the code to have it verified ?

I would try a 22K pull down resistor on the base of those transistors.

MAS3:
Then why don't you show the code to have it verified ?

I did . It's attached to the post with the picture. I also added it to the first post for convenience.
If you mean to the programming section, I did that too but didn't get an answer and the topic got buried so I thought II should verify the wiring first.

@Mike why the resistors ?

Because when the transistor base is connected to an input it is floating and can pick up interference which can cause a small current to flow which would light up LED slightly. A pull down resistor would stop this from happening.

Grumpy_Mike:
Because when the transistor base is connected to an input it is floating and can pick up interference which can cause a small current to flow which would light up LED slightly. A pull down resistor would stop this from happening.

I thought this only mattered if doing input readings. Can a pin set as input create an external signal?

That wire forms an output to the processor, but an input to the transistor.
Some interference to a floating pin can tip the transistor into conductance.
Interference typically is caused by external factors.
But also a signal in the wire next to it, can be picked up and have this effect.

MAS3:
Some interference to a floating pin can tip the transistor into conductance.

This is what I don't get. I understand how interferance can affect input readings but I don't see how this could affect the external circuit. Then again I have limited knowledge when it comes to the details of logic gates.

There is not that much of a difference between the input that needs to be read, and the transistor that needs to be controlled.
As you are not controlling the input (base) of the transistor, you can't tell what it gets.
A wire might act as an antenna and push the transistor into conductance.
By adding a pull down resistor, you are controlling that input.

From the wiring, he is actually driving the transistors bases, they are connected to outputs through 150Ohm resistors. AFAIK, outputs, once they are configured as outputs, are either LOW or HIGH ( at least, frome the moment they are sent a HIGH or LOW order) , not in a open collector state.
I don't see the need of a pulldown resistor here .

Edit : Vinter, you say :

Also I sat down yesterday and checked every led individually . Also checked combinations of leds in each column and it seems that it works as expected. This looks like a programming problem but I can't spot the error.

What power source did you made your tests with ? Is i the same that is used for your arduino wiring ?