Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: Hippynerd on Oct 28, 2012, 12:51 am

Title: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 28, 2012, 12:51 am
I made a new cube using some SMT RGB LEDs, Im using these 5050 SMT LEDs I found on ebay.
This is the specs i have on the LEDs, I've written the ebayer, but they wont be back for a couple weeks.

RGB PLCC -6 5050 3-CHIPS SMT SMD LED Light
VF Forward Voltage
Min2.9   Max 3.6
Luminous Intensity
Min 4000   Max 5000 mcd
Power Dissipation 200 mW
DC Forward Current 60 mA
Reverse Voltage 5V

I've built the cube using common cathode, assuming thats how most of other rgb cubes are setup.
The LEDs have 6 leads, so I could build it either way, or even use them in series.
(https://lh3.googleusercontent.com/-UkTUp7QAI_A/UIw1PQZRi2I/AAAAAAAAC4o/Ro_u6WQKstk/s640/IMG_20121025_234226.jpg)

I had planned on making a matrix, but it turned out to be too difficult to solder up, and i found that I can just buy a nice SMT RGB LED matrix for under $10 so I abandoned that idea, but I made up a 32 bit shift register out of 4 74hc595s.
(https://lh4.googleusercontent.com/-XrVBr3WHkpI/UIw1W76gQ8I/AAAAAAAAC4Q/Xnt2W2hWNX4/s640/IMG_20121024_211218.jpg)

I figured i'd use it with this cube, but then I realized that I will need to control one plane (48 LEDs) with it, and 32 bits wont work unless I cut the planes in half, which would be difficult. Had I made 2 1/2 cubes, and set them next to each other, it would work... but I have 1 cube.

So, I built a big 56 bit shift register tower (7 chips tall) I figure I will use 48 bits for the LED anodes, and 4 bits for the planes (cathodes), and have 4 dummy bits (but they could be used for additional features).

If I use shift registers, i will need resisters, and im not exactly sure what the forward voltage is on these leds since the only info I have lists one voltage. I tested the leds with 3 volts, and the red ones were really bright, too bright, but the didnt blow from quick testing 3v. Based on looking over specs on  several 5050 leds, my guess is the forward voltage is 2.2v Red, 3.2v Blue, 3.2v Green

From 5 volts, 100ohm should get me close on the blue/green ones, and 150 on the red.
Since I dont really know what these LEDs should use, I figure i can experiment with resisters on a spare LED to try to dial in the right resisters for each color, but maybe there is a better way?


I have also been revisiting the idea of running the shift registers at 3.3v instead of 5, reduce the 5vs to 3.3, and resister the data pin so that it gets 3.3v from the arduino. I was thinking maybe having a voltage regulator (like an lm317) drop the voltage from 5 volts to 3.3. Then I would have to resister the red LEDs, and run the other leds on 3.3v

Is that a reasonable solution?

Im also considering just using LED drivers instead, just to be easy... There seem to be many good LED drivers, which would be a good one, and why?

I've read some posts here that mention TLC594?, max232,ws280?

I have an uno for developing it, but I plan on running it off of a nano, and hopefully a small inexpensive power supply (like used for charging cell phones)

I also have a real nice power supply from a DVD player, it puts out 5, 12, and 24v, but i was hoping to save it for something that needs a lot more current (like a burning laser!)


So... im interested in ideas about how to control the cube best, I have shift registers, and can maybe scrounge up resistors (or just order some online...), but I will probably have to order resisters online, and maybe i should just order some inexpensive driver chips instead?

Oh, i just realized that I have some ULN2003 chips (they are in circuits, but I can unsolder them.)

Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Grumpy_Mike on Oct 28, 2012, 01:00 am
Quote
but maybe there is a better way?

Yes you have the LEDs, connect them up with something like a 330R resistor and actually measure the forward voltage then you can do the math correctly to get your current.

Quote
I have also been revisiting the idea of running the shift registers at 3.3v instead of 5, reduce the 5vs to 3.3, and resister the data pin so that it gets 3.3v from the arduino. I was thinking maybe having a voltage regulator (like an lm317) drop the voltage from 5 volts to 3.3. Then I would have to resister the red LEDs, and run the other leds on 3.3v

Is that a reasonable solution?

Absolute crap solution.
1) The shift registers cannot supply the current.
2) You always need a current limiting device with an LED. http://www.thebox.myzen.co.uk/Tutorial/LEDs.html (http://www.thebox.myzen.co.uk/Tutorial/LEDs.html)

Quote
maybe i should just order some inexpensive driver chips instead?

No as well.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: dhenry on Oct 28, 2012, 01:26 am
Quote
but the didnt blow from quick testing 3v.


Told you so, :)

Quote
Is that a reasonable solution?


Yes. Essentially the output resistance of those shift registers act as the current limiting mechanism here.

The risk you run, however, if the leds have wildly differing forward voltage drops, you may not be able to turn some of them on.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: dhenry on Oct 28, 2012, 01:40 am
Here is an interesting design that you may want to think of. It is for singles but notice that a) it is done without the use of shift registers - think very hard about that; b) it is done without resistors either.

http://www.doyoung.net/works/CUBE8/index.html

Youtube has a video. Check it out.

I like the implementation of touch-based power button. I think its light-sensing can be improved.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 28, 2012, 02:19 am
Thats quite the interesting cube. 128 control lines to control 512 LEDS.

I see the touch button thing, it looks like they use a photo resistor, and maybe capacitive touch on the other button.
Heres a video of a guy that made circuit boards on glass slides, They use capacitive touch, and you can operate it from back of the glass (not the side with the traces).
https://www.youtube.com/watch?v=5ZH1-eScY0M
I thought it was pretty awesome just because the circuit is on a see through board, but its even cooler as a input device!

I have to salvage some resistors to do some testing, and see if I can figure out the appropriate voltage for each LED.

I did read your webpage about LEDs Grumpy Mike, I assumed as long as you had the right voltage to feed your LED, you dont need to worry about current.  As a test, I ran a blue LED on 2 D cells, Im not sure what the forward voltage on the LED is, but my guess is close to 3v. The circuit was simple, 2 batteries and an LED,  no current limiting resistor, or any other fancy bits. Based on your webpage, it sounds like I have stressed the LED, but it did not seem weaken the LED any. Im confused, or conflicted, im not sure...

The Shift register way seem a bit more clunky, but thats also kind of appealing. The components will be on display with the cube, so a stack of shift registers, and resisters might be extra cool looking, but not as nice of a way to control the LEDs. I think its kind of interesting how I got 2 totally different responses. Mike, why is the shift register way crap? Im not criticizing, im curious about what is good and what is bad about things. Im also unclear on what you mean by "no as well"

Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 28, 2012, 05:46 am
I just converted my old 4x4x4 cube to run on a nano, while I was at it, i decided to hook the Shift registers to the 3.3v pin on the nano, it seems to be running, but is it doing bad things...
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Grumpy_Mike on Oct 28, 2012, 09:09 am
Quote
Told you so,

Be aware that dhenry is well known on this site for having a very odd attitude to reliability and safety of components. His attitude is that if it dosn't melt then it is fine.
LEDs are a particular blind spot of his.
He delights in being clever clever and showing off how smart he is. Which is odd because he isn't. Look at his past posts and see the larg number of things he is totally wrong about.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: dhenry on Oct 28, 2012, 01:26 pm
Quote
I see the touch button thing, it looks like they use a photo resistor, and maybe capacitive touch on the other button.


The photoresistor was there for ambient detection. The power button itself is touch sensing.

Quote
Heres a video of a guy that made circuit boards on glass slides,


That (iching copper on glass) is actually very impressive.

Quote
so a stack of shift registers,


Staking the shift registers the way you did is quite original, as I haven't seen anyone doing it.

The issue with shift registers in this application is that they take space and don't present well. The "nothing but led" approach is quite appealing.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Tom Carpenter on Oct 28, 2012, 04:27 pm
I have been working on something similar, only mine is 12x12x12. It really is an awful nightmare wiring up all the LEDs. The worst part is I finished doing it using magnet wire, only to have insulation in the wire break down and short everything out, so I need to rewire all the common wires.

For mine I am using TLC5951's for the cathodes (though TLC5947s were my first choice but they are too slow for a cube the size of mine), and 4-16 line decoders wired up to create a 7 to 72 line decoder driving P-ch MOSFETs for all the anode common lines.
By using these IC's mine is capable of 36bit colour (though I have limited it down to 24bit).
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 28, 2012, 06:16 pm
Mike, if you two want to fight, thats ok with me, but its not my interest., Im interesed in finding solutions, and some experimenting, and hopefully some learning and success.

I would like to know why something is a good idea, or a bad idea, so if you want to talk about what is good/bad about something and why, that is what im hoping to hear.

dhenry, Did you watch this video too, where he shows how he made them? I thought it was pretty impressive.
Im glad you like my shift registers, that is called piggybacking, its commonly used for building memory modules of different sizes, with one sized footprint.

I realized that it shouldnt matter if im using 5v or 3.3 on my other cube, since im syncing with the shift registers, they get 5 volts from the plane pin. I think i originally assumed you needed a resister on the anode side, not the cathode side, and I didtnt want to buy 16 resisters (they cost a quarter each locally...) So I made the cube common anode and used 4 resistors.

When I made the last cube, all the software I found was for common cathode, When I made this one, I made it CC, to avoid those problems.{fail}

Tom, wow 12cubed sounds awesome, is it RGB thats a heck of a lot of wires! and magnet wires has to be very difficult, I've soldered magnet wire, and its a pain in the butt to get the insulation off (I found tinning the end worked, but you have to burn alot of nasty insulation off, and its a lot of effort.

The wire Im using is 19 gauge galvanized wire (like bailing wire) for the anodes, and 24 gauge copper wire for the cathodes (since each LED requires 3 wires, I went with smaller gauge (less obtrusive, and the cube doesnt need that much structural support). I used the copper because I thought it would look good, and I could make the negative lines silver(color), and the positive lines copper)
The 19 gauge is good and stiff, it makes the cube fairly sturdy. Ive found that I spent a lot of time straightening the wire (it comes in rolls, but I want straight lines, and it takes a lot of effort to make the wire straight), I'd like to find straight wire, im considering welding/brazing rods.

Tell me about those TLC5951s and 5947s, im interested in finding PWM solutions for my common cathode cube. Its a 4x4x4, broken into 4 planes, I need to control 48 LED anodes (16 RBG), and 4 plane pins (cathodes). I could run the planes right from the arduino, or ??? The way i was originally planning on doing the matrix was with 4 Shift registers, 3 would control the cathodes, and 1 control the anodes. Now Im considering using 7 shift registers (6 for cathodes, 1 for anodes(1/2 really))

I dont understand the bit about decoders and p-ch mosfets, I did read something about someone hooking up a light strip that was CC, and they used something like that to make it work.

I did a lot of searching last night, and it looks like almost every RGB LED setup is CA, and I wasnt able to find any examples of CC RGB PWM LED drivers. Shift Registers are looking like a better approach right now.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: dhenry on Oct 28, 2012, 06:59 pm
Quote
it was pretty impressive.


What's really impressive is how the whole thing is wired up. He used a 32-pin mcu for that 8x8x8 cube.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 28, 2012, 09:34 pm

Quote
but maybe there is a better way?

Yes you have the LEDs, connect them up with something like a 330R resistor and actually measure the forward voltage then you can do the math correctly to get your current.


I hooked up a 220 ohm on the red, and a 100 ohm on the green. Im using 3.3v from an arduino nano, and with the red LED I get 2 volts, with the green I get 2.7, the green seems pretty bright, but the red doesnt seem very bright.

Calculations Red (3.3-2)/220 = 0.005909091 (or about 6ma)
                  Green (3.3-2.7)/100 = 0.006 (or 6ma)

Green (3.3-2.77)/75 =0.007066667
Green (3.3-2.88)/50 =0.0084

Red (3.3-2.2)/50 = 0.022  (hey, getting close)
Red (3.3-2.1)/75 = 0.016 


Sadly 50 ohms is the smallest resistor I can find.
From that can I calculate what voltage I need for 20ma?
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Docedison on Oct 28, 2012, 10:19 pm
responding to him... (DHenry) is like a battle of wits.... Except you are battling with an unarmed man... Once in  a while he even manages to stay on topic...
Mainly he is just annoying as he knows everything about anything... and usually is wrong. IMNSHO

Bob
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: dhenry on Oct 28, 2012, 10:45 pm
You are dealing with a few things:

1) different voltage drops causing different If for the same resistors. In your example, your reds have about 2.1v voltage drop and your greens about 2.8v. So to achieve desired If, the reds need to have resistors of (3.3v - 2.1v) / If and (3.3v - 2.8v) / If for the greens.
2) even if the same If goes through all leds, they have different efficiency / light output and our eyes have different sensitivity to different colors.

So play around with different resistors until your eyes perceive them to have same brightness. No point in having very precise values for those resistors.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 28, 2012, 11:47 pm
I just did some more testing. i hooked up a 50 to the red, and ran 3.3 to all 3 anodes. It looked a little blue, so I hooked up a 50 to the blue, and a 63 to the red. I then measured the diodes

I found the green, with no resister measured 3.24, red measured 2.15, and blue was 2.7

Red (3.3-2.15)/63=0.018253968
Blue (3,3-2,7)/50=0.012
Green (3.3-3.24)/0= ?
But it still looks like mostly blue

I measured the voltage across the resisters, and the blue measures .49, and the red measures 1.

Im assuming with all 3 LEDs on, it should be white, and any color variance should be adjusted with a resistor.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 29, 2012, 09:20 am
http://bildr.org/2011/08/74hc595-breakout-arduino/
heres an example of someone running 595s on 3.3 volts from an arduino. They are even running LEDs w/out resistors.

Then I read this
http://arduino.cc/forum/index.php/topic,26476.0.html
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: dhenry on Oct 29, 2012, 12:31 pm
1) Your hc595 is not a perfect voltage source, as it has significant internal resistance. As the current draw goes up, its output voltage goes down (when outputing 1), reducing the current draw. The same mechanism works with a mcu's pin.

2) Your led does not have a constant voltage drop: the voltage drop goes up, albeit slowly, when the current through it goes up.

Put the two together -> you don't get smoke when powering a led with a  hc595 directly.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 29, 2012, 05:34 pm
I've been looking about the internet for more info about 3.3v, and found this about the nano...

Power can be supplied to the Nano via the USB cable; feeding 5V directly into the 5V pin, or 7~12 (20 max, not recommended) into the Vin pin. You can only draw 3.3V at up to 50 mA when the Nano is running on USB power, as the 3.3V is sourced from the FTDI USB>serial IC. And the digital I/O pins still allow a current draw up to 40 mA each.

Im pretty sure that 50 ma wont be near enough, but If I resister the 5v input from the USB to 3.3v that may work. That way, the shift registers are powered directly from the USB, instead of through the arduino.
Its still going to need 17 resistors, which is messier than i would like, but less messy than 50 resistors.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 29, 2012, 07:21 pm
Revisiting resistor options...
Ideally (from the pretty lights perspective), each LED would have a current limiting resistor (thats 192 resistors!), but because of many reasons, its very impractical to put 3 resistors on each LED, but not as impractical to put one on each LED column (or SR output pin, same thing) (48 LEDs), but even that is a lot parts, space, and complexity. Only one plane at a time is lit, so theoretically, it should be the same, but then I think only one LED is actually lit at a time, so it seems that resitoring the planes (common) (like I did on my other cube), would be viable.

I have noticed that on the other cube, when it lights up all the LEDs on a plane, they are not as bright as when it lights up only a few leds per plane. this cube will have 48 LEDs on a single plane, and my guess is that it the dimming would be more dramatic.

HRm... resitoring the USB power input wont work, because the current will vary depending on how many LEDs are lit at one time, I think i would need a 3.3 Voltage regulator to run the CRs at 3.3v.
A driver chip would be nice, sadly I havnt found one that will work with common cathode.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 29, 2012, 10:10 pm
I found a 3.3v voltage regulator (from an old wrt router that died), snatched a few parts from it (Diode, coil, voltage regulator, cap), and soldered them up into a tiny regulated power supply.

This site tipped me off to the VR
http://kioan.users.uth.gr/wireless/wrt54g/supply.html

And looking over the datasheet, they had a typical circuit, which happened to be exactly how Linksys used it, so I just took the parts connected to the VR, and applied them based on the schematic in the datasheet http://html.alldatasheet.com/html-pdf/87877/ANACHIP/AP1501-33K5/1780/7/AP1501-33K5.html

I wasnt sure about the input cap, so I omitted that part, and it seems to put out 3.4v with no load.
The 12v brick I used said its .3a@12v, the VR is rated at 3a. Im not sure what my current needs are, but I think this will be more than plenty.

(https://lh4.googleusercontent.com/-yELDG8ueVCE/UI7vJsQ3LzI/AAAAAAAAC44/MJl5NRIv1sU/s800/IMG_20121029_135303.jpg)
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 30, 2012, 05:29 am
Something strange happened. When I tried to hook up the 3.3v to the shift registers, i disconneded the 5v, and the cube didnt stop working, it kept on working until I disconnected the ground.

I hooked up the 3.3v and ground from the 3.3v power supply to the shift registers on my old cube, and it didnt work right. its hard to explain how it worked, but it was slowed/delayed, and it seemed to not display stuff. It was just wrong.

Im totally baffled how/why the shift registers and cube were running on 4 wires (clock, data, latch, and ground)
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Tom Carpenter on Oct 30, 2012, 10:43 am
Clamping diodes on the inputs of the shift register IC. Basically if you remove Vcc, power can flow from an input which is set at logic 1 to Vcc via the protection circuits. This is not good for the IC as the protection circuits aren't designed to power the thing.
If theArduino is running at 5V still you also have a problem as you are running the shift register at 3.3v meanung that the inputs will be far above the absolute maximum allowed voltage of Vcc+0.5V
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 30, 2012, 05:43 pm

Tom, are you saying that the SRs are getting power from the data/clock/latch line? and that if i put a diode on those lines it will be ok? or that I should resistor the inputs down to 3.3v.

When I made the 3.3v power supply, i was thinking I could run the arduino at 3.3v, but the docs say minimum input voltage is 6v (but isnt the usb power 5v?)

I still need to find some decoupling caps, my shift registers dont have any on them, and I guess they like them.
I have lots of broken stuff i could pull smd caps from, but sadly, i dont know their value, I probably have many many suitable caps on various broken boards.

I also found this website with a 5x5x5 RGB cube thats running on shift registers and ULN 2003 chips. The way they mulitplex uses a lot less pins, but I cant figure out a way to build it, and make it stable with SMD LEDs, and solid uninsulated wire.
http://gemlit.com/howto/
They are doing 25 x 15, If I could figure out how to do the SMD LEDs my cube would be 12x16 (28 pins), half as many as ithem currently using 48 x 4 (52 pins)

They use the ULN 2003 on 2 of the shift registers, is this for current limiting? The schematic shows no resistors, but it looks like the PCB has places for 1206 lands, and my guess is those are the resistors.
I also notice that they claim that most RGB cubes are common cathode, but theirs is common anode. That seems odd to me, since I seem to only find drivers for common anode setups.

I also found the rainbowduino (seeedstudio), uses my9221 chip, for their 4x4x4 CC RGB cube. Sadly, i havnt been able to find that part.

I have some ULN 2003s, and from what I see on ebay, they are fairly inexpensive.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Tom Carpenter on Oct 30, 2012, 05:50 pm
What I am saying is that when you disconnected the 5V line, it stayed working because there are diodes built into the chip. This is a very bad way of operating the chip.


When you connected 3.3v, you need to level shift signals from 5v down to 3.3V otherwise there will be excessive currents flowing through the same built protection diodes which will damage the chip.

Level shifters can range from dedicated IC's to Transistors, to basic resistor potential dividers.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 30, 2012, 06:50 pm

What I am saying is that when you disconnected the 5V line, it stayed working because there are diodes built into the chip. This is a very bad way of operating the chip.


When you connected 3.3v, you need to level shift signals from 5v down to 3.3V otherwise there will be excessive currents flowing through the same built protection diodes which will damage the chip.

Level shifters can range from dedicated IC's to Transistors, to basic resistor potential dividers.


Hrm.. ok, this is interesting. Could you give me a couple examples that I could start experimenting with ? I have some resistors, I could make a resistor potential divider, What values would be appropriate? Looking over the wikipedia page https://en.wikipedia.org/wiki/Voltage_divider

It looks like their example of 6v from 9v, is the same ratio 3.3v from 5 v. In which they say R1 should be twice the value of R2. I've looked, and not found a pair of resistors that are suitable, however I have some tiny resistor packs, and I could bridge 2 resistors to make one resistor thats half the value of the other resistors. They are pretty low resistance (63 ohms).

How about the ics or transistors? I have some routers that I can pull parts from, maybe I have the transistors already?
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Tom Carpenter on Oct 30, 2012, 07:30 pm
1.8k and 3.3k tend to work well. 
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 30, 2012, 11:28 pm
I think i have a couple 3.3k, but not 3. and I dont think i have anything close to 1.8k.

I just made up this little schematic to show one layer of the cube.

It shows the cathodes connected (this is physically how they are connected too)

The anodes are connected to the next layers anodes, but im only showing one layer in the schematic, or it would be very hard to read.

(https://lh6.googleusercontent.com/-wIdpbfgSzwc/UJBRvZwUjFI/AAAAAAAAC58/pJSx-eoJ2IU/s640/RGBcube_schem-00.png)

16 RGB LEDs means 48 Anode pins to control, but only one cathode.

I do like idea of each layer having common R anode, common G anode, and common Blue anode, then it would be 16 cathodes and 12 anodes. I just dont see a way to do that, and make the cube dimensionally stable. The way the cube is built now is pretty dimensionally stable
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Tom Carpenter on Oct 31, 2012, 12:20 am
The way I have made mine structurally sound is to use a plastic frame, but I have access to a laser cutter at the University where I study so that may not be an option. The other thing I considered doing was to use plastic rod which can be gotten from hobby shops, and then either glue or melt the layer wires into it to give it rigidity.

What values of resistor do you have available? If you have enough 3.3k resistors, you can put two in parallel to get 1.65k which would give you exactly 3.3V. Alternatively any three resistors of the same value with the top of the potential divider being two in parallel will result in 3.3V

Code: [Select]
o-----+--+
      |  |
    R [] [] R
      |  |
      +--+-----o
      |
    R []    Where R = any value - preferably between 1k and 10k
      |
o-----+--------o
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 31, 2012, 12:48 am
The resistors I have are old leftover ones from who knows... They are partial packets of 5 from radioshack. I dont think I have more than 3 of any one value. But I suppose, If I can find 3 sets of 3 leds, I could make 3 different sets of voltage dividers. I also have some broken routers and things i can pull parts from, but they are tiny (like 0402 or 0603), and hard to solder wires to.

I've been reading about MAX7219/7221 chips, they are common cathode drivers, Is there a good reason why I shouldnt try to find some of those?

Also, the local electronics store only carries NTE parts, so if there are NTE parts that might work, I might be able to get the part locally.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Grumpy_Mike on Oct 31, 2012, 07:58 am
Am I right in thinking that for each plane you have a sepreate cathode connection and that all the cathodes are not connected together on each plane? Otherwise it would never work would it.

Have you done any tests to see how these LEDs look when they are on, if you need diffusers or what current you need to run them at.
Once you know the current for each LED you can then work out how much current to sink with the cathode sinks, you might need a FET here.

You then can look into how to provide that current at the anodes.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 31, 2012, 05:34 pm

Am I right in thinking that for each plane you have a sepreate cathode connection and that all the cathodes are not connected together on each plane? Otherwise it would never work would it.

Have you done any tests to see how these LEDs look when they are on, if you need diffusers or what current you need to run them at.
Once you know the current for each LED you can then work out how much current to sink with the cathode sinks, you might need a FET here.

You then can look into how to provide that current at the anodes.

You are correct about the each plane having a separate cathode connection (4 cathodes, 48 anodes), but all the cathodes per plane are connected (thats 48 cathodes tied together per plane as the LEDs have 6 leads)

I did many tests on the LEDs at 3.3vs to figure out the forward voltage on the LEDs. I figure at 5vs I would need about 100 ohm on the red, 150 on the blue/green. At 3.3v, I need around 50-75 ohms on the red, and maybe something on the blue, im not too sure. I had a an LED hooked up to the 3.3v with a couple resistors, with the 3 leds lit, it seemed a bit blue, and Im guessing that it should be white.

Nearest I can tell, the forward voltage on the red is 2.15, and the blue and green are about 3.3v (That is to say, if I want 20 ma per LED, then those are the approximate voltages)

I have been experimenting with making some voltage dividers to try to hook up some shift registers, to get them to output 3.3v my lack of parts is making it hard, but I have found  bunch of tiny 4.7k resistors, and I'll be messing around with them this morning.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Grumpy_Mike on Oct 31, 2012, 06:14 pm
Quote
but all the cathodes per plane are connected (thats 48 cathodes tied together per plane as the LEDs have 6 leads)

You mean anodes here don't you. It is the cathodes that are negative that are connected together.
The LEDs are capable of 60mA so you intend to run them at 20mA, is that right.

Do you know when you start multiplexing them they will look dimmer because they will only be on for one quarter of the time. One way round that is to boost the current.

If you are using resistors then there is no point in running the shift registers at a reduced voltage, you just alter the value of the resistor.
So given a 5V feed what values do you come up with for a 20mA current?

Quote
my lack of parts is making it hard

Resistors are less than a penny each unless you pay vastly inflated prices.

Quote
I've been reading about MAX7219/7221 chips, they are common cathode drivers, Is there a good reason why I shouldnt try to find some of those?

The reason is that you cannot control the brightness of each individual LEDs. Also they will not work with the way you have wired it up.

Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 31, 2012, 06:43 pm

Quote
but all the cathodes per plane are connected (thats 48 cathodes tied together per plane as the LEDs have 6 leads)

You mean anodes here don't you. It is the cathodes that are negative that are connected together.
The LEDs are capable of 60mA so you intend to run them at 20mA, is that right.

Do you know when you start multiplexing them they will look dimmer because they will only be on for one quarter of the time. One way round that is to boost the current.

If you are using resistors then there is no point in running the shift registers at a reduced voltage, you just alter the value of the resistor.
So given a 5V feed what values do you come up with for a 20mA current?

Quote
my lack of parts is making it hard

Resistors are less than a penny each unless you pay vastly inflated prices.

Quote
I've been reading about MAX7219/7221 chips, they are common cathode drivers, Is there a good reason why I shouldnt try to find some of those?

The reason is that you cannot control the brightness of each individual LEDs. Also they will not work with the way you have wired it up.




I do mean I have 48 cathodes tied together per plane (aka common cathode) There are also 48 anodes per plane that need to be individually controlled, they are connected to the copper wires in my photo, the silver colored wires are the cathodes. Basically, the cathodes connections hold each plane together, and the 48 copper wires hold the planes up. Using copper for the anodes (+), and zinc coated wire for the cathodes (-), was not an accident, I did that intentionally to make it obvious which is + and which is -.

Resistors around here are about 25 cents each, so 48 resistors will cost $12. assuming I only buy the right ones, and dont have any problems. I ordered shift registers online a month ago, and they cost $5/20. A shift register, and a resistor are basically the same cost to me. 48 resistors will make things quite messy too, I would probably want to hide that mess under the cube, but keep the shift registers, and nano, neatly next to the cube, for display, but im still not sure how I will mount/display the cube.

Since there is no way to run the shift registers at the low voltage that the red LEDs need, I will need a minimum of 16 resistors, or a constant current driver. I havnt messed around with PWM yet, but I expect to do PWM, shiftPWM or otherwise...

I havnt done much testing at 5v, my guess is to get 20ma, I will need 100ohm for red, and 150 for blue and green. Im still not too sure about how much current each LED needs for even brightness/color.

The whole point of running the shift registers at lower voltage is to reduce the amount of parts. If I only needed 4 resistors, I could live with that, but 48 is going to expensive, ugly, and more effort.

I have a few of these ULN 2003a chips, they are transistor or diode arrays? Could those be helpful? 
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 31, 2012, 08:41 pm
making voltage dividers with 0402 resistors is very difficult, but I managed to make 3 of them with 4.7k resistors, and soldered them up to my old cubes shift registers, and it lights up, but its not working right, its acting crazy. It could be my dividers are not working right, I dunno.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Grumpy_Mike on Oct 31, 2012, 10:04 pm
Quote
Resistors around here are about 25 cents each,

WHAT!!!

You need to order them on line, it is sewing your view of electronics and forcing you into making silly design decisions.

Quote
It could be my dividers are not working right,

I doubt it, that sounds more like faulty wiring or bad software.

Quote
I will need 100ohm for red, and 150 for blue and green.

That sounds wrong.
Quote
the forward voltage on the red is 2.15

Again that sounds too high, but assuming it is right:-
So the voltage across the resistor is 5 - 2.15 = 2.85V so to have that voltage with 20mA needs a 2.85 / 0.02 = 142.5 Ohms
Similarly for a voltage drop of 3.3V you need 5 - 3.3 = 1.7 then 1.7 / 0.02 = 85 Ohms
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Oct 31, 2012, 10:27 pm
Doh! i got the values backwards, I meant 150 ohm for the red, 100 for the blue and green.

I couldnt even buy shift registers locally, the only stores that have parts are radioshack, and oregonelectronics, radioshack has almost nothing helpful, and OE only carries NTE parts, and they are expensive, and not very helpful.

I can get resistors at both places, OE is $.25 each, and RS is #1.20/5 pack. We used to have a Norvacs, but they went out of business, probably because there just isnt enough support for them, and they were a bit expensive (about the same prices as OE and RS, but they did have a lot of parts, most of the time I could actually get what i needed, but sometimes you gotta spend $10 for a cap.)

I can order stuff online, but it usually means waiting a week or 3. I also dont like spending $1 on resistors, and have to pay $5 shipping to get it within a week. I'd rather spend $5 on a driver chip that does everything i need, and looks good on display.

Even if I had all the resistors I need for this project, its gunna be ugly trying to figure out where to put them, and I like to use uninsulated wire, which will things difficult to wire, without shorting somewhere.

Im testing the 3.3v on my old cube. The shift registers are on the cathode side on that cube, they get 5v from 4 arduino pins (but are they have 220 ohm resistors) On that cube, when its lighting up all the LEDs on 1 plane, they are dimmer. 16 resistors on the column pins would be better than 4 resistors on the plane pins. If I did the RBG cube the same way, it would be 48 LEDs, and really really dim when all the LEDs on a plane are lit.

I dont have an accurate data sheet, so I had to hook up resistors, and measure and calculate (back on the first page of this thread are all those numbers... Scroll back to the first page, and check my numbers and math there, I think its right, but I could have made a mistake.
 
The voltage dividers I made are tiny (0402 parts), its very likely I buggered them up with my iron, or solder. No change in the software. Im using the old cube, and its shift registers (that work fine on 5v), to see if I can make them work at 3.3v like I hope to use on the new cube.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Grumpy_Mike on Oct 31, 2012, 10:41 pm
Quote
and really really dim when all the LEDs on a plane are lit.

That either means your design is bad or the power supply is not up to it.
There should be no dimming when there are multiple LEDs on.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: cyclegadget on Nov 01, 2012, 03:03 am

Cheap, quick, parts from the USA as far as shipping is concerned. At least that is what I have been told and they shipped quick to me.

http://stores.ebay.com/thaishine
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 01, 2012, 03:33 am
Thats where i got the shift regitsers. they got here in less than a week.

I ended up ordering 200 (100 ohm, and 150 ohm) resistors. $5 is better than $12 i guess, but I still have to wait till next week probably. Hopefully they will be close enough. I also ordered some .1 uf caps.

I spent the better part of the day wrecking and repairing my old cube, I wont be using it for testing stuff anymore. I also soldered up some RGB LEDs to some shift registers to experiment with 3.3v. I can run the blue and green at 3.3 safely. I still need to make new voltage dividers, I keep breaking the tiny ones I've made.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: dhenry on Nov 01, 2012, 02:37 pm
Quote
I couldnt even buy shift registers locally,


Very rarely you can. But many distribution houses offer next day delivery. Digikey for example does that, as mouser / newark.

I order my parts in hundreds so shipping cost ends up as nothing.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 01, 2012, 05:27 pm
I think i could have gotten some from the OE shop, they sell NTE parts, and Im sure NTE must make some kind of shift register, but the counter guy wanted me to try to figure out which part would work, and I didnt know, so I left, and bought online instead. I would prefer to buy local, and support local business, but they charge too much, and cant be bothered to help make a sale.

They already have my package ready for shipping (i have the tracking numbers, but they havent been scanned in yet.)

They also sent me email offering me %12 off their normal prices if I buy today. (but not on ebay, on their regular website. The regular website doesnt offer the 4day shipping, they do have 3 shipping options, but the quick way is kind of expensive for a few parts. Im considering ordering those 85 ohm resistors.

I guess I assumed that shift registers were fairly common, they seem to be used in a lot of things.

I cant even find RGB LEDs locally, they only have single color ones, and they want $.65 each for them. It would have cost $40 just for the LEDs on my first cube.

Mike, My old cube uses 4 resistors, one for each plane, which means it uses between 20 and 320ma (assuming my resistor is the right size...), when it lights all LEDs on a plane, it is noticeable, if you are paying attention, but most folks dont seem to notice.

I may try to make and sell a few cubes, so I can buy a bunch of parts and see how many ways I can light up LEDS!

I want to try some of those cool POV projects with spinning LEDs (like spokePOV), or the spinning globe things. I have an old VCR that im thinking about turning into a POV project.

MMMMmmm  I love LEDs.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Grumpy_Mike on Nov 01, 2012, 11:10 pm
Quote
My old cube uses 4 resistors, one for each plane,

Well that explains it, very poor design that.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 02, 2012, 08:30 am

Quote
My old cube uses 4 resistors, one for each plane,

Well that explains it, very poor design that.

It was when i changed it up from using 20 pins, to using shift registers that I noticed it, so it would be more like a very poor re-design, if you must form it that way. I prefer to think of it as a work in progress. I may just throw some resistors at it and solve things the easy way, rather than the elegant way.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 05, 2012, 09:39 pm
My resistors should be in today, so I should be able to wire up the cube for 5v, using 100, and 150 ohm resistors.

I also drew up some fritzing images with 3 different setups, one uses 5v, and is probably the common way of doing it.

The other 2 images are running 3.3v from the shift registers, to the LEDs. using 50 ohm resistor for the red.

To keep things simple and easy to understand, this is only using 8leds, and 1 shift register per color, and one for the cathodes (4 total 74hc595s)

5v, 4 shift registers, 16 100 ohm resistors, 8 150 ohm resistors:
(https://lh5.googleusercontent.com/-gtTrTGCB21w/UJgiOQxnJgI/AAAAAAAAC8A/j3UodLNJSZY/s800/32bitshift8rgb1_bb-800.png)


3.3v from arduinos 5v line
(https://lh5.googleusercontent.com/-ViO6-ISHwIs/UJgiOSsnWFI/AAAAAAAAC8A/VFcHWtXPAe4/s800/32bitshift8rgb2_bb800.png)

3.3v from external power supply
(https://lh6.googleusercontent.com/-yd2XdAawxWg/UJgiOkDDLGI/AAAAAAAAC8A/hRX0IiGptjU/s800/32bitshift8rgb3_bb-800.png)

Im not sure, but I think the last one needs a ground to the arduino for the latch/clock/data lines to work.

Is there anything wrong with any of those designs? I just realized that I need to put .1uf caps on the shift registers, so other than the caps, is there anything wrong? will one design work better than another?
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Tom Carpenter on Nov 05, 2012, 10:31 pm
The middile one definitely has something wrong. You don't use a resistor potential divider as a power supply [unless you use a power op-amp to prevent (make negligible) the effects of loading, but that is a whole other kettle of fish].
You should use a proper voltage regulator - be it a LDO regulator, a switching regulator, a zener diode, or other such voltage regulation devices

Loading 101:

If say for example you have two 1k resistors as a divider and say connect 5v at the top. Under no load, you will get 2.5V. Say you now used that as a power supply, and started drawing i dont know, maybe 1mA from the 2.5V line

You would then have
Ib = Vb/Rb = Vb/1000 [A] flowing through the bottom resistor, and 1mA flowing through the output.
That would then mean that flowing through the top resistor you have:
I = 1 + Vb [mA] = 0.001 + 0.001Vb [A]
The voltage drop on the top resistor would then be:
Vt = IR = 1000*I = 1 + Vb [V]
That would give you a total voltage drop across the potential divider:
V = 5[V] = Vt + Vb = 1+2Vb

So that would mean that at the output, the voltage would be:
Vb = (5 - 1)/2 = 4/2 = 2[V]

So in that case, just 1mA of loading would result in the output voltage dropping by 20%.


In your case you seem to be using 10k for the lower resistor and 5k for the upper resistor and are attempting to power 3 LEDs from it. So input voltage would be 5V, load current would be say 60mA. So just for fun that would give Vb = -200[V]. That figure is of course absurd, and the reason for it is you simply cannot put 60mA through a 5k resistor when the voltage across it is limited to 5V (The maximum would be I=V/R = 5/5000 = 1[mA], and at that amount there would be 0v across the LED).
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 06, 2012, 12:48 am
Wow! that was a really good explanation. So, #2, bad idea, on the voltage divider on the shift register power source, I'll look seeing if I can fix that with a VR circuit.

Resistors and caps came in. I can put some filtercaps on my shifters now.

I may pair up some 100 ohm resistors to put on my 3.3v test RGB leds too to test the 3.3v have something setup like the 3rd example.

I may also be able to rig up the cube similar to the 1st example, I have a 7 piggybacked 74hc595 shift tower soldered up for the cube.

but that still has to wait for me to take care of other business first :(
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 10, 2012, 03:14 am
I've been experimenting, before wiring anything up to the cube. I had a rig setup for running 8 RGB LEDs on 3.3v, but I decided to undo that, and set it up for 5 volts, because it wasnt working, and I wanted to start with something easier.
So, re-soldered it up with resistors (8 100 ohm on the red, and 150 ohm on the blue and green). I have the cathodes (the negative side) soldered to a wire, and the anodes soldered to resistors, that are soldered to 3 piggybacked 595's. I soldered up a few .1uf caps to where I hook the 5 volts up to the shift registers. I made a couple jumpers to power the 595s from the 5v and gnd pins on the uno, and a jumper from the cathode to  the gnd on the shift registers.

No LEDs would light up. just to see if If the LEDs would light, i tried hooking up the 5v to the resistors, no luck, but in the process, I touched the cathode wire with the 5v wire, and some leds lit up. I took the ground wire off of the cathodes, and hooked 5v to it, and it seems to work fine (runs the shift pwm demo).

Im confused though. I double checked everything, and my LEDs seem backwards. The schematic shows pins 1,2,3 as cathode, but on all my RGB LEDs, you hook up 5v to that side, and ground on the other side to light them.

I double checked the datasheet online and the only odd thing I can find is the symbol for the LEDs looks funny, on the blue and green leds there is a symbol that looks similar to an LED next to the regular LED symbol.
Im including the image from the ebay auction
(https://lh6.googleusercontent.com/-IpnrriyaxOc/UJ24Aocyi0I/AAAAAAAAC9A/G9j8ICHZVNA/s800/RGBLED5050.jpg)
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Tom Carpenter on Nov 10, 2012, 12:53 pm
Look at the pin numbers on the bottom right diagram (you can ignore the zener diodes). The have drawn the image as if it were from looking at the back.
If you then look at the top left diagram, the cathode is marked with a triangular notch.

The good news is that if you have in fact wired everything as common anode, it is a lot easier to control as you can now use the TLC5940's or any other LED current sink to drive them.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 10, 2012, 05:13 pm
Oh, that was my first thought (that I had wired them common anode), but no matter what side you look at the part, the triangle bit is on the cathode, right? (topside vs upside down). The test unit I made was a 19 gauge wire soldered to the leads that are on the same side as the triangle.

I've checked all the LEDs I've setup, and they all seem to use the + on the side with the triangle, and none work with the - hooked up on the side with the triangle.

I wish I had some tlc chips to test it right now.

Im curious about the funny looking LED symbols in the diagram. Green and Blue look weird, they have a reversed looking diode on top of the regular diode. zener LED? I dont understand.

The LEDs are pretty bright, I think I will need to make tiny diffusers for the LEDs.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Tom Carpenter on Nov 10, 2012, 05:46 pm
Interesting. That means that the diagram is wrong (the mark is the anode not the cathode).

The Zener diodes aren't LEDs. I am not sure why they are there, but I would guess for some sort of overvoltage protection?
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 10, 2012, 06:19 pm
(https://lh4.googleusercontent.com/-bL1GDJw8E2M/UJ6A54KO22I/AAAAAAAAC9M/YzEXsU2GXmE/s800/IMG_20121110_082754.jpg)
You can see the little triangle corners all lined up with the heavy gauge wire. I have a few test setups like this and all of them have all of the cathodes (triangle sides) connected together.

I do have a set of 8 just like these, only with resistors, and they are running on 3 shift registers. I have them wired up rgbrgbrgbrgbrgbrgbrgbrgb, but after reading the code, I would like to have wired them up rrrrrrrrggggggggbbbbbbbb. Its running shiftpwm rgb demo.

I guess one of the benefits of using shift registers and resistors is when you have something goofy like this happen, shift registers will still work.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 11, 2012, 11:45 pm
(https://lh6.googleusercontent.com/-zXAi-NLPy1Q/UKAn1gdbddI/AAAAAAAAC-A/63ns_bNM0cA/s800/ShiftOut3SR-8RGBLED24R_bb-800.png)

This is what im working with right now, its a test unit that is setup the same as the ShiftPWM example (even though the LEDs are marked otherwise.)

Im running the 8 RGB LEDs off the arduino, The power supply is via USB (using a usb phone charger, I think its 500ma)

it seems to me that I should be having power issues when its running all the LEDs at 100% (24 LEDs * 20ma =480m. Thats about 160ma per shift register, and about 1/2 amp on the arduino.


according to this site:
http://www.elcojacobs.com/using-shiftpwm-to-control-rgb-leds-with-arduino/
thats not really a problem? I also noticed that there is a picture of 16 RGB LEDs, which is what I will need to do for the RGB cube,

I do have the cube mounted on a case, I have to solder up 48 resistors, and 6 shift registers, which is going to be kinda messy.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 12, 2012, 03:40 am
This is the next test Im doing, its running the LEDs on a 3.3v power supply, and possibly running the arduino off the 12v that powers the 3.3v circuit, but probably running on the 5v from the usb, I dunno.
(https://lh6.googleusercontent.com/-mvvP6NWg-NE/UKBg6FYJkaI/AAAAAAAAC-c/vAnBWm5_0CE/s800/ShiftOut3SR-8RGBLED3.3v_bb-800.png)

The one Im wiring up actually has 100 ohm resistors, I didnt have any 47 ohm resistors.
The wiring between the shift registers and LEDs looks crazy, but i think it will be easier to solder up.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 13, 2012, 06:24 pm
Heres a video of the 3.3v with voltage dividers (like the 3.3v setup in the previous post:

http://www.youtube.com/watch?v=qrVXc-KL2YE

As you can see, it didnt work right, it did make the LEDs light up, but It was pretty wrong.

Heres a video of the 5v test setup (it uses 8 RGB LEDs, 8 150 ohm resistors, 16 100 ohm resistors, and 3 shift registers.) In this video I also include the 3.3v setup, without the voltage dividers, it runs pretty good w/out the dividers, but It may be causing some kind of damage, i dunno.

http://www.youtube.com/watch?v=ZN0qXgcU-w0
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 14, 2012, 12:25 am
Instead of soldering up a bunch of resistors, and shift registers, I did a little googling instead.

Check out what I found.
http://aglick.com/charliecube.html (http://aglick.com/charliecube.html)

This guy built a 4x4x4 RGB cube using 64 LEDs, some wire, perf board, and a nano. No resistors or transistors or chips of any kind, just some wire, leds, board, and nano.

The way he solved the problem was like using geometry to solve a accounting problem.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 15, 2012, 08:14 pm
I did a lot of soldering yesterday. I found some unused xmas lights that had wires in groups of 3, about the right lenght for my project. I cut, stripped, tinned, and soldered them onto the resistors that I had previously soldered onto the column wires on the cube. I ended up having to untwist the wires to move them through the case, and it ended up pretty ugly. I will probably end up replacing those wires, but they will work for now.
Before green wires:
(https://lh5.googleusercontent.com/-JsVb-HfU5rA/UKUU9LYnknI/AAAAAAAAC-o/RwrbBhSC4dU/s800/IMG_20121113_225137.jpg)
After green wires:
(https://lh4.googleusercontent.com/-DIob2Sv6nOs/UKUVhoXINdI/AAAAAAAAC-4/2lrwMupi-m8/s144/IMG_20121114_151228.jpg)
The horror!
(https://lh4.googleusercontent.com/-i1_CTQIepys/UKUVzdIZXoI/AAAAAAAAC_A/r8ShCNFG5Ug/s800/IMG_20121114_161523.jpg)
(https://lh6.googleusercontent.com/-ywVxfrZlb3c/UKUYFUczDSI/AAAAAAAAC_4/08JQyBWn-e8/s800/IMG_20121114_205801.jpg)
Soldering away...
(https://lh6.googleusercontent.com/-fmuonNQpbUE/UKUXez_RshI/AAAAAAAAC_o/NdGikfLJq3w/s800/IMG_20121114_184956.jpg)

Which brings us to here:
(https://lh3.googleusercontent.com/--FHjS4KsqNc/UKUYY7fqITI/AAAAAAAADAA/vtmrLAMGLvs/s800/IMG_20121114_211923.jpg)

Now that I have the shift registers wired up to the ribbon cable (clock, latch, data, ground), and wired to the LEDs, I need to figure out how to source current to the common planes. 

In my first cube, I used 20 pins, 4 pins sourced 5v (through 220 ohm resistor). I upgraded that cube to using 2 shift registers to control the sink, and sourced 5v via 4 pins through 220 ohms.
I recently upgraded that cube to 16 100 ohm resistors on the column(sink) pins, and removed the 4 220 ohm resistors on plane(source) pins.
In my RGB shiftpwm tests, I sourced 5v to the common pins via the 5v pin on the uno (Originally I had it from a 5v power supply, but later I moved it to the uno for portability). 

It seems to me, each of those are drawing too much current through the arduino.

Im considering a few different approaches, I could add a shift register (this is what i had originally figured that i would do). using 4 bits to source the current, and having the other 4 for added features, like buttons? or sound?, I dunno really.
Then I realized that mixing those bits in with the column pins may make shiftpwm, or other however I may control those bits more difficult, and a separate shift register may be better.
I figured, I could use 2 bits for sourcing the current per plane (1 8bit chip to source 1 48 LED plane), but it seems to me running the current for 48 LEDs through 2 shift register pins will be too much for it.


In my previous post, with the 4x4x4 RGB cube, they are able to do this with 64 RGB LEDs, and no other parts. I guess they are able to do all the current control via PWM, and since the red LEDs need a lot less voltage than the other LEDs, it somehow must adjust.

Also, Ive noticed other people posting about making 4x4x4 RGB cubes, if you are making a similar cube, post in this thread with how you are doing it, and what features you are thinking about.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 17, 2012, 09:23 pm
I havnt lit this cube yet, Im still not sure how i want to source 5 volts to the 4 planes. It seems to me that I should be similar to my other cube, but I need to deal with 3 times as many LEDs.

I have built an SMD version of the asher glick cubes spire. 
(https://lh6.googleusercontent.com/-a7sb4jKi1JM/UKXmWG1AMEI/AAAAAAAADAQ/mGeGMPzxVhM/s800/IMG_20121115_230643.jpg)

I also came up with a way to do this with 8 RGB LED Spires, but I havnt figured out how to do the 8 led spire in SMD.

I've figured out 2 ways to do the 8 LED spire. One way is to simply build 2 4 LED spires, and rotate the top spire 45 degrees from the bottom spire. Instead of 4 leads, you will have 8.

The more interesting way is instead of using the pi/2 rad formula for rotating the LEDs, use pi/4 rad, and iterate it 8 times (instead of 4).  This should end up with 8 leads and 8 charlieplexed RGB LEDs in one column. I have to wait for LEDs to arrive before I can build a spire.

Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Nov 18, 2012, 07:55 pm
I just read up on the ULN 2003 chip, and it looks like a great way to source 5 volts to each layer. It says it can source upto 500ma, that sounds like plenty compared to a single arduino pin. It looks like I hook ground up to pin 8, 5v to pin 9, and use the first 4 pins for input, and last 4 pins for output to each plane. WahBam plenty of current, with a few pins unused. If I had a ULN2803, I could pair up the 8 arrays into 4 arrays for twice the current.

This way, I can modify my old software for the cube to shift out 48 bits instead of 16, and it should work on this cube. I think i can probably use shiftpwm with this cube too.

Still waiting for new RGB LEDs to arrive... They are common cathode, I will use them to make a charliecube like asher glicks. I cant wait to compare the 2 cubes :D
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Dec 08, 2012, 06:24 pm
An update on the 4x4x4 RGB Cubes.

The charliecubes seem to be working great. I have built a couple, and have been running them 24/7 on 5 volts via USB. I have also run them via the Vin with 18v, and they work fine, but the chip gets warm, so I went back to 5v.

The more proper cubes are still under development, one uses TLC5490, and the other uses shift registers and resistors. I built a 48 bit shifter for the anodes, and am using 2 shift registers to sink the 4 planes. I think I need almost 1 amp, and 2 shift registers wont be enough for that probably, so I may need to modify it.

I have a few ULN 2003a chips, and I had thought they would work for sourcing, but that may not be the best solution.

I have been investigating using p-channel and n-channel mosfets. There are a lot of them, and I dont know which ones would be appropriate. It seems the ones in the smaller packages are too small (1/4 amp), and the bigger packages are way bigger than my needs (4 amp).

What are good ways of supplying sink/source to the planes? Is one way vastly superior to another?

Another consideration is circuit board space, im using very small boards with little space, so space is as much consideration as cost (ideally both would be small.)

Shift registers, mosfets, darlington arrays are what I have been looking at, but maybe I should look at other options too?
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Dec 10, 2012, 06:15 pm
I think i have found a good current source for my TLC5940 cube,
Manufacturer Part No: IRF3205

Specification
Mosfet Type N-channel
Current Rating 110A
Rds (On) 8m?
Voltage Rated 55V

They are under $1 each, and seem to be a good n-channel source. I need about 1amp max.

Im still uncertain about sinking on the shift register cube. I had originally built it with 2 shift registers to sink, but I think I will need lot more than 2 shift registers for that.

I've ordered some of these p-channel mosfets, we will see if they will work.
Manufacturer Part No: IRF9540

Description
MOSFET
Transistor Type:MOSFET
Transistor Polarity:P Channel
Drain Source Voltage, Vds:-100V
Continuous Drain Current, Id:-23A
On Resistance, Rds(on):117mohm
Rds(on) Test Voltage, Vgs:-10V

Im still interested in other options, ULN ?

For what im doing, I only need 1amp max, are there other parts that might be more suitable? These mosfets seem way bigger than I need. I think I could also do the same thing with a pair of ULN2803s,  but I think that would be less energy efficient, and probably a worser way to do it if its running on batteries.


What are some good ways to source/sink
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Dec 10, 2012, 07:54 pm
How about these little guys? they look good enough for 1 amp at 5volts.

Mosfet Type: P-channel
Current Rating: 2.6A
Rds (On): 40 mOhm
Voltage Rated: 12V
Package: SSOT-3

Mosfet Type: N-channel
Current Rating: 4A
Rds (On): 100 mOhm
Voltage Rated: 60V
Package: SOT-223

They are much smaller than the ones I actually ordered (from the previous post). but they look like they exceed my needs, take up less space, and are even less expensive. These seem much better than what I ordered, but maybe they are not?
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Dec 21, 2012, 08:32 pm
Im trying out TLC5940 chip on the SMT RGB LED cube, I have it wired up with 3 Chips, each have a 2k resistor, and I used 1 10k resistor, but the schematic didnt show any decoupling caps, so I didnt put any in.

Im trying it with the BasicUSe example software (just one plane of of 16 RGB LEDs, no multiplexing), and on Usb, it starts out really bright all on full, and after about a minute, it dims, and flickers each individual LED, but looks weird, and im pretty sure, wrong.

When I run it from 5v power supply, its similar to on USB, but its not bright at all, just flickering each individual led.

I know that I have some solder issues, since all the LEDs are not working (I buggered them up while soldering the wiring on the backside of the board.

Im using the info at:
http://playground.arduino.cc/Learning/TLC5940
and I wired it up like the example.

Heres a picture of the wiring, I havnt done the stuff for the planes, but I run a wire from the 5v to one of the common plane wires.

(https://lh5.googleusercontent.com/-Iq8om1lCGEE/UNP4iCiFs2I/AAAAAAAADFE/Wh6C7JRE8v8/s640/IMG_20121220_214711.jpg)
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 09, 2013, 04:28 am
I worked on this again tonight. I repaired the some wiring on the middle chip, now all the LEDs light up in order, but they are pretty dim. I also put .1uf caps on each 5940, and its a little brighter, but nowhere near as bright as they should be.

Im just running one plane at a time with a 5v wire to the plane, and the software running the 5940s. The cubes gotten kinda beaten up being knocked around my bench for the last month or two. I will need to replace some LEDs I think :(
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: ematson5897 on Jan 09, 2013, 04:40 am
This is sort of an old topic, but I straighten my wire for cubes by grabbing both ends with needle nose pliers and stretching it. You will feel it stretch and then its perfectly straight
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 09, 2013, 05:33 am
I tried that too. I used a vice, and vicegrips. The copper wire (24 gauge) breaks really easily, then springs out of control. The steel wire (19 gauge) did get straighter, but it was very difficult to stretch. I was able to do it, but when relaxing the wire, it still had curves in it. I also tried pulling real hard on the wire while smacking the wire with my hand, it didnt work either. I got straighter wire, but I couldnt get the curve out entirerly. I was working with about 6' of wire at a time, trying to get the longest section of straight I could get, but it just never got straight enough for me. I have some 22 gauge steel wire, but I havnt tried straightening large sections of it.

How were you doing it, how long and what gauge wire?

There is also a technique where you twist the wire, I actually got the best results with that technique, but when you look close, you could see the twist, even from 10 feet away, you could kinda see the twist. What you end up with is a wire that has very consistent tight twist to it that is roughly straight and rigid.  After a few days of trying things, I ended up going back to the original gentle uncurving metheod.

I was looking at the music wire that I had used on the charliecubes, and its got some rust on it, so its not stainless steel, its hardened steel.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: ematson5897 on Jan 09, 2013, 10:10 pm
Yea i was using a vice and needle nose pliers. And I think 22 gauge copper wire
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 09, 2013, 10:20 pm
I found the copper to be the most difficult. Thicker and harder were easier to get straighter, and I was spending a lot of time bending wires. My copper was a little smaller than yours, and my steel was a lot thicker.

How long of sections did you do? did you cut 4" sections, or many feet at a time? I wasnt able to completely remove curve, but if you spend enough time with it, it gets fairly straight. When using the music wire, its very straight, and doesnt get bent while working with it. But its very difficult to solder, comapred to copper or gavlanized steel.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 11, 2013, 09:35 pm
I re-uploaded a new sketch, and hooked it up again, and its doing something!  :D

Right now I am only controlling one plane by connecting it to 5v.
The ICs are wired up like the example in the TLC5940 tutorial:
http://playground.arduino.cc/Learning/TLC5940
except that I have decoupling caps on each chip.

https://www.youtube.com/watch?v=3CF0BB3cjFI

Its running the Useprogmem example program, it just lights all 16 RGB LEDs in a plane, and turns them off in sequence. I think it may do some PWM while its turning it off too.

Its not as bright as I had hoped, but maybe with some experimentation, i can make some improvements. I ran the same LEDs on shift registers and resistors, and I seem to remember them being considerably brighter, but maybe that just my imagination.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 15, 2013, 06:46 pm
The smt cube is going to wait until i can figure out a good way to source 5v to each plane. Im assuming a mosfet would be the best way, but I have to figure out what part I need, and order them, and wait for shipping...

I setup a test fixture with some charliecube spires, and I have 3 different resistor sizes. no resistor, 150, 100, and 50 ohm (I didnt have any 50 ohm, so I doubled up on the 100s). No resistor is visibly brighter, but the others light up pretty well. Im thinking of modifying one of my cube with 100 ohm resistors.

It seems to me that there are two viable ways to introduce resistors. I could put on resistor on each of the i/o pins, or I could put one resistor on each of the 64 leads on the 16 spires.

More resistors typically means more evenly controlled, but I think in this case it may not actually make any difference, because It seems to me that the LEDs are being lit ONLY one at a time. Since there will always be 2 resistors used (one on the high pin, one on the low pin), There will always be 2 resistors being used to light any single LED. If I use 100's then Im doing 200 ohms which should mean my LEDs never get anywhere near 20ma.

Measuring what is actually going on would be best, but measuring is going to be difficult to impossible for me, a few calculations only takes a few minutes, and is relatively easy.

(https://lh3.googleusercontent.com/-k1hKZ1S1S8U/UPWRtPKN5sI/AAAAAAAADcc/C6TF04RHZDo/s640/IMG_20130114_160302.jpg)
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Docedison on Jan 15, 2013, 08:02 pm
If you want really straight wires try heating the wire to a low red heat while applying tension to the wire. Allow the wire to cool naturally and you will have annealed the wire.. No more bends or gentle curves in the wire. This also is useful to relieve work hardening of copper and alumininum as well.

Bob
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 15, 2013, 11:01 pm
That seems a bit excessive, I would have to heat it, to soften it, to straighten it, then harden it to help keep the structure of the cube. I certainly wont be heating up galvanized wire till its glowing red.

If i were to heat wires, I think I would use music wire, but use a lot of heat to tin them (like with a solder pot, or small torch.)

I really like the look of the copper, but its too soft for cubes, they really think they need a bit more durability than copper or aluminum provide. The music wire is also small enough that you can barely see it.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 18, 2013, 09:13 pm
I think i have worked out controlling the columns on the cubes, but I need some help with controlling the planes. One cube sinks(Shift register/resistor cube) the planes, the other cube sources(constant current cube). 

It looks like the mosfets that I purchased are totally not appropriate for what theses, which kinda sucks, but moving on, I need to figure out a good way to sink, and source 5v upto 1 amp.

Based on what i've read, it seems like there are basically 2 viable options, Darlington arrays and Mosfets. It sounds like mosfets are a better option, because they waste less electricity.

http://learn.adafruit.com/rgb-led-strips/usage

So, it seems I should get an N channel mosfet or maybe I could use a couple ULN2803 chips for sinking the planes on the shift register cube.

How about sourcing 5v?, should I use a P channel mosfet? What are other options?

I understand that I want a fet with low RDS, typically measured in millionths of an ohm, What are all the factors I need to consider when shopping for mosfets?

Crossroads posted a way to sort through the mind boggling inventory at digikey, That is a good start. I tried to apply the concept at mouser, but that didnt work out well. Ebay, Thaishine, and Tayda all seem too difficult to figure out what part I want. 

Newmark has a good looking search interface, but Im unsure exactly what things to select. I was able to knock the list down to 100 parts for both n and p channel at 1amp.

I think i also need the parts to be logic-level, that is to say, they can be switched with 5v.

Jameco has lots of parts, but the search interface is kinda difficult.

If I knew exactly what i was looking for, and exactly what specs I should be looking for would make it easier,

I am also uncertain about packages. for 1amp at 5v, I dont think i need any heatsinks, but I would rather buy a part that wont need one, if that is an option. Smaller  (as in takes up less space), is better than bigger. SOT23 isnt too hard to solder, so even that isnt too small.


I've modified one of my charliecubes to use 100 ohm resistors, and it is noticably dimmer, Im going to try to measure some LEDs with a few different resistors sizes and calc the current use, and try to get them closer to 20ma. Nearest I can tell, I will have to settle for less current on the blue/green, If I drop to 50 ohm, that should put the blue/green at about 20ma, but the red should be over 20ma. Because of the layout, you can only use one size resistor and keeping red within spec means putting blue and green considerably lower current than red.

If you are considering trying music wire, I have found that for this size cube, 015 is too delicate (you can do it, but its very difficult), and 025 is more than sturdy enough, so Im going to try 020, I think it could be the ideal size for this size cube.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Tom Carpenter on Jan 19, 2013, 12:36 am

I understand that I want a fet with low RDS, typically measured in millionths of an ohm

I think that is mOhm, or milliohms, i.e. thousandths of an ohm.


These are what I chose for my 12x12x12 cube. I ended up with 72 of them, and each one supplies 2 rows of 12 RGB LEDs, totalling 24*3=72 diodes per transistor = 1.44A peak current.

http://uk.farnell.com/nxp/nx2301p/mosfet-p-ch-20v-2a-sot23/dp/1894738?Ntt=1894738
I chose them for (a) price, (b) size, and (c) they are rated at 2A drain current at a Vgs of -4.5V making them suitable for 5v logic levels.

Ideally one with a slightly lower on resistance (these are 0.1Ohm at -4.5V) would be better, but these were a good price and I only lose 0.144v which would have been lost over the PWM constant current sources I have wired to the Cathodes. In my case theThe power lost is 1.44^2 * 0.1 = 200mW, which is well withing the power dissipation the transistor can support.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 19, 2013, 10:43 pm
Ah, now that you mention power dissipation, I remember reading something about power dissipation, I think it was nick. He mentioned a bunch of things that were a bit over my head, and hard to comprehend. There is something about gate capacitance or some such thing that I should also consider?

I think nick also posted some nice tiny FETs that were rated at 4amps, which seemed very surprising to me that such a tiny thing could handle such current.

So, it seems i will get the best results with a mosfet in both circumstances?


I decided I should test and measure the current on the common cathode LEDs that im using on the charliecube. I would like to find ideal resistors for them, by my calculations 200 ohms should keep the LEDs safe, but you dont know unless you measure. I soldered some resistors on to some LEDs, and hooked them up to a 5v power supply. I found that the blues were running at 20.9mA. I measured the power supply, and found that it was actually 5.25v.

I tested the test fixture running off usb, and it was 4.17v on the Vin pin, but a little higher on the 5v pin. I tested the cubes running on 500ma, and 850ma power bricks, and they were both different too. and both well under 5v. The highest voltage reading I got was on the 850ma on the 5v pin at 4.8v

If the LEDs are getting 4.2, then they need much smaller resistors than if they are running at 5, but since every way that I power them, they run at different voltages, i cant figure out the right size resistors, other than,200 ohm more than enough. At 5v, 200 ohms (2 100 ohm resistors) should be limiting the current to 14mA on the red. At 4.2v, those same resistors are limiting the LEDs to 10mA. If I change to 50 ohm resistors(100 ohms), and the LEDs are only getting 4.2v, they should be at 20mA, and the blue and green will be well under 20ma. but if they are getting 4.8v, then 100 ohms will only limit them to 25mA, but the blue and green will be down to 12ma.

Somehow, i dont think these LEDs are going to ever see 5v, no matter what.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 20, 2013, 10:44 pm
Yet another crazy cube idea. one of the nice things about this setup is that you dont use too much current, and you dont have to worry about mosfets, It does require more parts than the charliecube, but its only 16 transistors. Because it only lights up 12 LEDs at a time it only uses 240 mA, but it has a duty cycle of 4%, so it wont be very bright.

Here my modification of a 5x5x5 transistor cube (thanks crossroads), that I changed to 4x4x4 RGB. I didnt quite draw all the lines in, but hopefully enough is there to get the right idea.
(https://lh4.googleusercontent.com/-hKageNO53hw/UPxi2OGPLVI/AAAAAAAADdE/JiXWKCiwGvo/s800/4x4x4_RGB_cube_transistors.jpg)

At this rate, I may never get the original cube SMT constant current cube finished, or the shift register-resistor cube built.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 24, 2013, 12:24 am
I've been reading up on the transistors...
For the cascaded transistor cube, it looks like i could use 20 2n2222 transistors. Since my needs are 240ma, 3904s wont be suitable. It seems like I could also do it with ULN chips and 4 transistors. Is there any reason an n-channel mosfet wouldnt work well?

I still havnt figured out what mosfets to use for the other cubes, but maybe I will find one to use with the transistor cube.

Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 26, 2013, 06:32 pm
I have been trying to figure out what decoupling cap I need for the TLC 5940, Ive read that I should put a 47uf electrolytic cap on them. I've looked over the datasheet, and not found anything that suggest what cap to use, the tutorial doesnt have any decoupling cap, and calculating what cap seems to be some kind of magic that nobody really understands.

I've dug through all my spare/scrap parts, and cant find any 47uf caps, i have many caps in various sizes, but that that size. What about voltage rating, what caps do i need? how do I know what size is right?

Im also curious about ordering parts from the big houses like digikey mouser, ... How long does it take to get parts within the US? does it take weeks, or within a week? I've never ordered anything from any of those places, so any tips would be helpful.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 27, 2013, 07:26 am
Ive found lots of fets that will probalby be suitable, trying to pick one is hard.

Ive found this one DMN2112SN
its 100mOhm, 1/2watt 1.2a
My needs are:
16x3x20=960ma=.96a
THis is my dissipation calculations.
.96x.96 =0.9216 x .1= .09216, or 96mw, or about 1/10th watt, so well within 1/2 watt.

this is from the digikey website:

FET Type   MOSFET N-Channel, Metal Oxide
FET Feature   Logic Level Gate
Drain to Source Voltage (Vdss)   20V
Current - Continuous Drain (Id) @ 25° C   1.2A
Rds On (Max) @ Id, Vgs   100 mOhm @ 500mA, 4.5V
Vgs(th) (Max) @ Id   1.2V @ 1mA
Gate Charge (Qg) @ Vgs   -
Input Capacitance (Ciss) @ Vds   220pF @ 10V
Power - Max   500mW
Full datasheet.
http://www.diodes.com/datasheets/ds30830.pdf

Does that seem like a good part for what im doing? I dont want to buy any more parts that are not what i need.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: CybrE3_Mad_Coder on Jan 27, 2013, 09:49 am
I love to see these things in action, Can you maybe think about making a video for us so we can see  :D
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Headroom on Jan 27, 2013, 02:34 pm
For decoupling you usually need one larger cap, for example 47uH, and smaller caps for each chip involved with usual values ranging from 0.1uF to 0.01uF. The latter ones are for the high frequelncy noise and should be located as close as practically possible to the ICs.

Here's an excellent tutorial on it:
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html (http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html)

I order most of my components from places like Mouser, Digikey and Newark and they ship rapidly. Of course it depends on ones particular location but my things usually arrive within 3-4 days.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 27, 2013, 05:53 pm
CybrE3_Mad_Coder, heres a link to my youtube videos, the last several videos are examples of LEDs and circuits that ive been working on. I have some TLC5940 stuff, 74hc595/shiftout stuff, and some charlieplexed stuff.
https://www.youtube.com/user/hippynurd?feature=mhee

Headroom, Thanks for the tips, It sounds like those place dont take any longer than ebay or any other place, thats good to know.

I looked over mikes decoupling page, and things are still rather complicated and hard to understand everything, but its good to have that as a reference. As I understand it, if the caps arent quite right, there can be a lot of RF noise, and I guess its common for folks to just throw some caps at it, and be unaware of the noise issue. I dont like solving problems by making other problems, which is what im trying to avoid, while learning...

I have 104 ceramic caps on my shift registrers, and my tlc chip, but I think my tlc chips may also need 47uH because mike had posted that on another thread about that chip.

There are no capacitors in the TLC tutorial, and the 595 tutorial has them in the wrong place, it would really be nice if things were consistent around here. its kinda confusing.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Jan 29, 2013, 06:40 pm
I ordered some parts from digikey yesterday, and in just over an hour, I was notified that my order was ready for shipping, it appears to be on its way, and should be here by the end of the week, and shipping cost was minimal.

1   25   DMN2112SNDICT-ND   MOSFET N-CH 20V 1.2A SC59-3      25
2   25   785-1085-1-ND   MOSFET P-CH -30V -1.2A SC70-3              25
3   100   CF18JT51R0CT-ND   RES 51 OHM 1/8W 5% CF AXIAL      100
4   100   MMBT2222AFSCT-ND   TRANSISTOR GP NPN AMP SOT-23   100
5   10   399-6098-ND   CAP ALUM 47UF 35V 20% RADIAL      10
6   100   CF18JT75R0CT-ND   RES 75 OHM 1/8W 5% CF AXIAL      100

Hopefully, the fets are the best fets for my purposes. I think I have some parts that will be very efficient, but Im hoping they are fast enough.
The other parts are for other cubes, including the new transistor shifter cube.

I hope to have some inexpensive charliecube kits soon if anyone wants to build one.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Feb 02, 2013, 09:56 pm
I ordered parts monday around noon, and the parts arrived by thursday. It seems they can ship stuff just as quickly, and inexpensively as any ebay provider within the US.

They did kind of use a lot of packaging, but they did use about 1/2 recyclable packing material.

I forgot to calculate the resistors for the 2n2222 transistors. I need 240mA for the transistor cube, The transistors I got seem to be limited to 350ma, that should be enough for my needs. I have been trying to figure out HFE, and what resistors to use with them, to limit the current to safe levels. Nearest i can tell, about 330 seems to be about right, to keep me under 350ma, but enough to drive the transistor well into saturation.

It seems that while reading about mosfets, one of the nice things is that I wont be needing a current limiting resistor, like I would on a BJT, but that I could use a resistor to help reduce the chance of the fet self destructing or going into a feedback loop or something. can anyone explain that ?

The transistor cube is coming along nicely. I have 16 spires built, and I have 20 transistors soldered and circuit wired up for them. im still trying to figure out the best way to assemble the spires onto the PCB. Im thinking that making 4 spires into 1 plane, then fit each plane onto the PCB. I'll get some pics up today.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Feb 03, 2013, 06:16 pm
(https://lh6.googleusercontent.com/-qPRNPCHEMHc/UQ1_T4XFyII/AAAAAAAADe0/P1uASV3NIM4/s640/IMG_20130201_193530.jpg)

Heres one image of the spires being assembled. I havnt soldered them together yet, but I think this is how I will do it.

(https://lh5.googleusercontent.com/-9VmwgZDRsu4/UQ1_ZvO1iEI/AAAAAAAADe8/BUp5dSxoq-E/s640/IMG_20130201_183910.jpg)

This is an ugly picture of the transistors. I grouped them badly. It was to make it fit in a small space. After soldering them in like this, I realized I could use a little more space, put 4 transistors inline, and the wiring would have been a lot neater and tidier.

(https://lh6.googleusercontent.com/-eA31SdwXfSk/UQ1_08BFsMI/AAAAAAAADfM/uFcPyXmOqXg/s640/IMG_20130131_165531.jpg)
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: rickweiss on Feb 06, 2013, 09:15 am
man, you're doing a great job!! I'm anxiously awaiting your next posts! thank you for sharing this with us!

rick
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Feb 06, 2013, 07:39 pm
You are welcome rick, thanks for the support. :D

If things go well today, I think I will solder the LEDs to the board, and finish the circuitry. Then the scary part, testing.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Feb 13, 2013, 07:56 pm
(https://lh5.googleusercontent.com/-lV331Uk2LRA/URPqHfoomkI/AAAAAAAADok/40RVQdiRSB8/s640/IMG_20130206_195937.jpg)

I havnt posted anything in a while, I have been testing transistors for the new cube, and for the other unfinished cubes.
The above picture was after finishing the new cube design. I chose to build this one using just the LEDs leads, instead of using wire. I wanted this cube to fit on a smallish PCB, the LEDs are just under 1" apart, and that meant that the LED leads were just long enough to work without additional wire.
I did have to add 2 support wires, to help make the cube sturdy, but I may take them off, as they are kinda ugly.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Feb 22, 2013, 08:57 pm
Ive finally gotten the transistor cube working. Heres a quick video
http://www.youtube.com/watch?v=_Fo-Xs6t2rg

This circuit uses:
64 Common Cathode RGB LEDS
20 NPN transistors (2n2222, I used tiny sot23 package parts, but any 2222 should work)
20 Resistors (eight 270 ohm 2n2222 base resistors, 12 anode resistors (eight 100 ohm, four 150 ohm)
The cube layout uses lines instead of planes. Typical 4x4x4 cube construction uses 4 planes of 16 LEDs, this uses 16 lines of 4 LEDs, which brings the duty cycle down to 6.67% (from 25%), but it requires few parts, and doesnt require off-board power, since it only lights up a maximum of 12 LEDs(4 RGB LEDs) at a given time.

This specific cube was made using the LED leads and no additional stiff wire, It is also sized to fit a slightly smaller circuit board (this board is only 3" wide, so the LEDs are about 7/8" in apart, unlike the other cubes that are 1" spacing.

I think it looks horrible in the daylight, compared to the cubes with nice stiff wires, but when its dark, you dont notice so much.

This cube use 20 pins on the microcontroller, and on most arduinos, that doesnt leave any pins left for additional features, and assuming you are using 20ma LEDs you could draw upto 240ma at one time, which may be too much for 28 pin dip arduinos.

Edit: removed old ugly program, see next post for better program.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Feb 23, 2013, 11:29 pm
This is a better test program, I've cleaned things up, and added some more programs.
Code: [Select]

// TransistorCube  -- Test Program
#include <avr/pgmspace.h> // allows use of PROGMEM to store patterns in flash

#define CUBESIZE 4
#define PLANESIZE CUBESIZE*CUBESIZE
#define PLANETIME 3333 // time each plane is displayed in us -> 100 Hz refresh
#define TIMECONST 5 // multiplies DisplayTime to get ms - why not =100?

/*
** Defining pins in array makes it easier to rearrange how cube is wired
** This cube uses 2 plane pins and one led pin to light up any single LED.
** Pins 2-13 are used to control the 12 RG and B anodes (the rear to forward 4 LED)
** 5 banks of 4 transistors that are controlled by 8 arduino pins sink the cathodes.
** Pins (14,15,16,17) control 4 transistors that select the row(wide), and on each row.
** Pins (18,19,0,1)4 control 1 of 4 sets of 4 transistors that select the level(height).
** First you have to turn on a row, then turn on a level to sink the LED.
**
** This cube uses NPN transistors. We send HIGH to sink a row or level,
** and we send HIGH to turn on a anode color/forward/back LED. send LOW turns LEDs off.
*/

int RGBColumnPin[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
int RowPin[] = {14, 15, 16, 17};
int LevelPin[] = {18, 19, 0, 1};
int RowLevelCount  = 4;
int RGBColumnPinCount = 12;
// initialization
void setup()
{
  int pin; // loop counter
  // set up LED pins as output (active HIGH)
  for (pin=0; pin<(RGBColumnPinCount); pin++) {
    pinMode( RGBColumnPin[pin], OUTPUT );
  }
  // set up plane pin1 as outputs (active HIGH)
  for (pin=0; pin<CUBESIZE; pin++) {
    pinMode( RowPin[pin], OUTPUT );
  }
  // set up plane pin2 as outputs (active HIGH)
  for (pin=0; pin<CUBESIZE; pin++) {
    pinMode( LevelPin[pin], OUTPUT );
  }
}

void loop(){
// comment out lines below to run just the specific test you want
// to run. comment all but one routine at a time for best results.
// You can also change values inside the programs for different testing.

  loopFor();
  loopRand();
  loopRedWall();
  loopFullOn();

}

// This bit of programming uses 3 loops to sequence all 192 LEDs
// one loop controls 1 LEDs anode pin, the 2 other loops control the cathode pin.
// You turn a pin HIGH, to light the LED (turn the anode HIGH, and turn 2
// transistors HIGH to sink one cathode line (4 RGB LEDs)
// Turning all pins LOW, turns all LEDs off.
void loopFor()
{

   for(int thisRowPin = 0; thisRowPin < RowLevelCount; thisRowPin++){
     for(int thisLevelPin = 0; thisLevelPin < RowLevelCount; thisLevelPin++){
        for(int thisPin = 0; thisPin < RGBColumnPinCount; thisPin++){
       
        planesOff();
        digitalWrite(RGBColumnPin[thisPin],HIGH);
        digitalWrite(RowPin[thisRowPin],HIGH);
        digitalWrite(LevelPin[thisLevelPin],HIGH);
       
       
        delay(100); // increase value to slow down
       
        digitalWrite(RGBColumnPin[thisPin],LOW);
        digitalWrite(RowPin[thisRowPin],LOW);
        digitalWrite(LevelPin[thisLevelPin],LOW);
     //   delay(100); // if you want an off delay       
      }
    }
  }
}

void loopRand()
{
    int randPin = random(12);
    int randPlane1 = random(4);
    int randPlane2 = random(4);
   
    planesOff();
   
    digitalWrite(RGBColumnPin[randPin],HIGH);
    digitalWrite(RowPin[randPlane1],HIGH);
    digitalWrite(LevelPin[randPlane2],HIGH);
       
    delay(50);
           
     
    digitalWrite(RGBColumnPin[randPin],LOW);
    digitalWrite(RowPin[randPlane1],LOW);
    digitalWrite(LevelPin[randPlane2],LOW);
     
     
}

void planesOff(){
    for(int thisRowPin = 0; thisRowPin < RowLevelCount; thisRowPin++){
        digitalWrite(RowPin[thisRowPin],LOW);
    }
    for(int thisLevelPin = 0; thisLevelPin < RowLevelCount; thisLevelPin++){
        digitalWrite(LevelPin[thisLevelPin],LOW);
    }
}


void loopRedWall()
{

   for(int thisRowPin = 0; thisRowPin < RowLevelCount; thisRowPin++){
        for(int thisPin = 0; thisPin < 4; thisPin++){
 
     for(int thisLevelPin = 0; thisLevelPin < RowLevelCount; thisLevelPin++){
         
        planesOff();
        digitalWrite(RGBColumnPin[0],LOW);
        digitalWrite(RGBColumnPin[1],HIGH);
        digitalWrite(RGBColumnPin[2],LOW);
        digitalWrite(RGBColumnPin[3],LOW);
        digitalWrite(RGBColumnPin[4],HIGH);
        digitalWrite(RGBColumnPin[5],LOW);
        digitalWrite(RGBColumnPin[6],LOW);
        digitalWrite(RGBColumnPin[7],HIGH);
        digitalWrite(RGBColumnPin[8],LOW);
        digitalWrite(RGBColumnPin[9],LOW);
        digitalWrite(RGBColumnPin[10],HIGH);
        digitalWrite(RGBColumnPin[11],LOW);
        digitalWrite(RowPin[thisRowPin],HIGH);
        digitalWrite(LevelPin[thisLevelPin],HIGH);
       
       
        delay(5); // increase to slow down
       
        digitalWrite(RGBColumnPin[0],LOW);
        digitalWrite(RGBColumnPin[1],LOW);
        digitalWrite(RGBColumnPin[2],LOW);
        digitalWrite(RGBColumnPin[3],LOW);
        digitalWrite(RGBColumnPin[4],LOW);
        digitalWrite(RGBColumnPin[5],LOW);
        digitalWrite(RGBColumnPin[6],LOW);
        digitalWrite(RGBColumnPin[7],LOW);
        digitalWrite(RGBColumnPin[8],LOW);
        digitalWrite(RGBColumnPin[9],LOW);
        digitalWrite(RGBColumnPin[10],LOW);
        digitalWrite(RGBColumnPin[11],LOW);
        digitalWrite(RowPin[thisRowPin],LOW);
        digitalWrite(LevelPin[thisLevelPin],LOW);
     //   delay(100);       
      }
    }
  }
}
void loopFullOn()
// This program lights 12 LEDs ina line, and cycles through the row/levels
{
   for(int thisRowPin = 0; thisRowPin < RowLevelCount; thisRowPin++){
//       for(int thisPin = 0; thisPin < 4; thisPin++){
 
     for(int thisLevelPin = 0; thisLevelPin < RowLevelCount; thisLevelPin++){
         
        planesOff();
        digitalWrite(RGBColumnPin[0],HIGH);
        digitalWrite(RGBColumnPin[1],HIGH);
        digitalWrite(RGBColumnPin[2],HIGH);
        digitalWrite(RGBColumnPin[3],HIGH);
        digitalWrite(RGBColumnPin[4],HIGH);
        digitalWrite(RGBColumnPin[5],HIGH);
        digitalWrite(RGBColumnPin[6],HIGH);
        digitalWrite(RGBColumnPin[7],HIGH);
        digitalWrite(RGBColumnPin[8],HIGH);
        digitalWrite(RGBColumnPin[9],HIGH);
        digitalWrite(RGBColumnPin[10],HIGH);
        digitalWrite(RGBColumnPin[11],HIGH);
        digitalWrite(RowPin[thisRowPin],HIGH);
        digitalWrite(LevelPin[thisLevelPin],HIGH);
       
       
        delay(100); //This controls speed, bigger is slower.
       
/*        digitalWrite(RGBColumnPin[0],LOW);
        digitalWrite(RGBColumnPin[1],LOW);
        digitalWrite(RGBColumnPin[2],LOW);
        digitalWrite(RGBColumnPin[3],LOW);
        digitalWrite(RGBColumnPin[4],LOW);
        digitalWrite(RGBColumnPin[5],LOW);
        digitalWrite(RGBColumnPin[6],LOW);
        digitalWrite(RGBColumnPin[7],LOW);
        digitalWrite(RGBColumnPin[8],LOW);
        digitalWrite(RGBColumnPin[9],LOW);
        digitalWrite(RGBColumnPin[10],LOW);
        digitalWrite(RGBColumnPin[11],LOW);
*/       
        digitalWrite(RowPin[thisRowPin],LOW);
        digitalWrite(LevelPin[thisLevelPin],LOW);
     //   delay(100);       
   //   }
    }
  }
}
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: cyclegadget on Feb 24, 2013, 02:12 am

I like your progress! I hope you continue to post more videos as you get better at using the cube.

I need to build a RGB cube bad!
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Feb 24, 2013, 02:30 am
Thanks :D
Thats how I felt when I stared this thread many months ago. I had a working single color cube, it wasnt too hard to build...
Then I made all the wrong assumptions, and figured RGB wouldnt be to much harder. Boy was I wrong.
So far, the original cube has lit up LEDs, but is still not working, the next attempt is 1/2 way finished (less than the first attempt), the third attempt has been working great, I've done a lot of work documenting the building and testing modifying, and the last one seems to work, but is in the early stages of software development.

At this point my expectations are  that the unfinished cubes will be the best quality (speed/brightness), but they have also been the most problematic.

The quickest easiest to get up and working is the charliecube, If you use 75 ohm resistors, that should keep the LEDs under 20ma (although I'd recommend 50 ohm resistors as that should keep them at about 20ma, and 25ma on the red)

Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Mar 01, 2013, 08:38 pm
I've been working on changing the 4x4x4 single color cube to work with the transistor cascade cube, and it requires radical change to the program.


This part should read in 16 bits (one plane of data)
Code: [Select]
memcpy_P( PatternBuf, PatternTable+PatternIdx, PLANESIZE );
PatternIdx += PLANESIZE;

The way the new cube works, it seemed best to deal with a whole cube data at one time, since I am lighting 1 line(4 LEDs), instead of 4 planes (16 LEDs).

I have changed it to:
Code: [Select]
memcpy_P( PatternBuf, PatternTable+PatternIdx, (PLANESIZE * CUBESIZE) );
PatternIdx += (PLANESIZE * CUBESIZE));


Hopefully, I've done that right, but there is another part where we use the data, this part:
Code: [Select]
digitalWrite( LEDPin[ledpin++], PatternBuf[patbufidx] & (1 << ledcol) );
Im pretty sure that what that line does is light up a specific LED (LEDPin is one of 16 column pins), and PatternBuf is the 16 bits of data, and patbufidx points to the specific bit for the specific pin. this gets looped 16 times to complete one plane.

Now what I want to do is light up 4 LEDs in a line, not a plane, each of the LEDs are RGB LEDs, so each bit will actually light all three LEDs so its white when on. Instead of lighting just one LED, I need to do all 4 (which is really 12 LEDs). Both ways do cycle of 16 to complete the cube, the old way did 4 cycles of 16, the new way does one cycle of 16, but lights 4 LEDs per cycle.
Code: [Select]

digitalWrite( RGBColumnPin[1], PatternBuf[patbufidx] & (1 << ledlevel) );
digitalWrite( RGBColumnPin[2], PatternBuf[patbufidx] & (1 << ledlevel) );
digitalWrite( RGBColumnPin[3], PatternBuf[patbufidx] & (1 << ledlevel) );
// LED 2
digitalWrite( RGBColumnPin[1+16], PatternBuf[patbufidx+16] & (1 << ledlevel) );
digitalWrite( RGBColumnPin[2+16], PatternBuf[patbufidx+16] & (1 << ledlevel) );
digitalWrite( RGBColumnPin[3+16], PatternBuf[patbufidx+16] & (1 << ledlevel) );
// LED 3
digitalWrite( RGBColumnPin[1+32], PatternBuf[patbufidx+32] & (1 << ledlevel) );
digitalWrite( RGBColumnPin[2+32], PatternBuf[patbufidx+32] & (1 << ledlevel) );
digitalWrite( RGBColumnPin[3+32], PatternBuf[patbufidx+32] & (1 << ledlevel) );
// LED 4
digitalWrite( RGBColumnPin[1+48], PatternBuf[patbufidx+48] & (1 << ledlevel) );
digitalWrite( RGBColumnPin[2+48], PatternBuf[patbufidx+48] & (1 << ledlevel) );
digitalWrite( RGBColumnPin[3+48], PatternBuf[patbufidx+48] & (1 << ledlevel) );
}
patbufidx==patbufidx+CUBESIZE;


I dont really understand the "& (1 << ledlevel) )" part in this case ledlevel is one of the 2 transistors that are controlling which line is active.  It seems to me that I dont want that in there, but its doing something like shifting a bit, and I dont know if I need it or not, or how to treat it in this modification. The variables ledrow, and ledlevel are what make this loop 16 times (4 sets for 4)
Since its lighting up 4 LEDs at a time, instead of looping through 4 planes, I changed the patbufidx++ to the above +CUBESIZE, is that a good way to do it?
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Mar 22, 2013, 09:51 pm
I could use some help fixing up this code to work right. The hardware tests fine with my other program, but I have been having no luck getting this one working right, and could use some help.

I've spent a bunch of time going over this code, and changing things many different ways.
I still havnt figured out how to make this program work with the transistor cube.

Most cubes are planar, but this cube is different. Its similar to the charliecube in that it treats the cube as 16 LEDs in a spires of 4 LEDs. Changing the program that runs 4 cycles of 16 cycles of LEDs,  seems simple enough to convert to 4 cycles of 4 cycles of 4 RGB LEDs,  

On my previous post I was trying to make the program load the 64 bits at a time, and it was making things crazy and complicated, so a couple days ago, I tried changing it back to 16 bits at a time, while lighting 16 spires/line of 4 LEDs, one spire/line at a time.

The way I was expecting the program to work is basically like this:

1 row pin and 1 level pin turn on a individual cathode for 4 RGB LEDs in a line (spire).

12 anode pins control the 4 RGB LEDs. To keep things simple, we are treating each RGB LED as a single color LED, and using 1 bit per LED

This code includes 3 versions of the anode pins that use a  "1 << variableName" thing,

The program starts with the usual declaring variables, and setting up the pins, then starts a couple loops and has some while statements. The loops used to be 16 and 4, but I needed to change it to 4 and 4 with 12 anode writes instead of 1 anode write.

The original version has a pattern buffer index that points to one of 16 bits of data, and it increments until it completes its cycle, then advances a plane, and reads in and processes that 16 bits. It does this 4 times to complete 1 line of data (64 bits).

Im trying to make this program cycle 4 lines of 4 LEDs at a time, then increment the pattern buffer index 4 times, which should be the same a sequencing 16 LEDs on a plane (4 lines of 4 LED is the same as 16 LEDs in a 4x4 matrix)

I have found that if I comment out the pattern buffer index, I can get things to start to work, but never quite right. Sometimes it lights up many LEDs instead of one, It only seems to read the first 4 bits in a 16 bit segment though.

If I enable the pattern buffer indexing lines, the cube lights many leds on many levels, its really weird.

Heres the current not working quite right version. It only has  a couple lines of data I just change the data with 1s and 0s to test that I can control each LED one or more at a time.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: runaway_pancake on Mar 22, 2013, 10:18 pm

It says the code too many characters for one post :( Splitting it seems the best option.


Click on Additional Options (lower left of text window) and Upload it as an Attachment.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Mar 22, 2013, 10:38 pm
Program attached as text file.

Yay! Thanks Runaway Pancake! :D

Edit: replaced ugly program with more tidy program.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Mar 24, 2013, 02:50 am
I went back through the code, and cleaned things up, and wrote better comments, and changed the data a bit. it now has a small sample of spinning and flipping planes of LEDs.

This cube uses 20 transistors(2n2222), and 20 resistors(8 270ohm 8 100ohm, 4 150ohm), and 64 RGB LEDs. I used 2n2222 NPN transistors with common cathode LEDs, but it can be built with MOSFETs instead of BJTs, it could also be built with ULN2003 chips, or even a combination of MOSFETs, BJTs, and/or ULNs.

If you have common anode LEDs, you will need to use PNP transistors, and change the code a bit (turn HIGHs to LOW, and LOWs to HIGH.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Mar 25, 2013, 03:08 am
I modified the program to change colors each time it completes the cycle.
There are 2 version of the color cycle program, version cycles through:
Red
Blue
Green
Yellow
Purple
Teal
White

Version 2 is more like a color wheel, or rainbow where colors

Yellow
Red
Purple
Blue
Teal
Green

It could be easily modified to do random color(max 7 colors). each cycle.

Getting more colors will be difficult, there really isnt hardware PWM support  (there is, but only on a few pins, not enough for the whole cube) This cube is directly connected, not serialized, so you cant do SPI. I think you can get some color mixing, but its not too simple.

Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: runaway_pancake on Mar 29, 2013, 11:28 pm
hippynerd,

In another Subject you posted that you had some questions about transistors, hfe etc, that went unanswered and that you wanted to discuss them here.

Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Mar 30, 2013, 02:29 am
Yeah, I do have some. It has been a while since since then, so I cant remember exactly what details, but it mostly had to do with finding the right resistor to use. With the BTJ types, you need a base resistor, and part of the calculations require figuring out the gain or HFE (I think thats right... its been a while). What I ended up doing was build a test circuit with all the parts that I planned on using, and guessed for the base resistor. Then I measured, and changed the resistor, and measured again. I did this several times and it seemed that anywhere between 150 and 300 ohms was safe for a base resistor.

I found many graphs and stats on the datasheet, but I couldnt figure out what to use for gain. I cant find the datasheet, but the part is a 2n2222, in the sot23 package. I thought it was linked in this thread, but I cant find it.

I also have some mosfets. As I understand it, I dont need a resistor between the microcontroller and the gate, but I do want a resistor between the gate and source, and I think that it is there to help it switch off faster? I think I got some 5ks for the mosfets.

If you could help clear up how I should calculate the resistor values, that would be great.

Im still kind of unclear on how to figure out decoupling caps, but it seems like there are only a few values commonly used for that, and trial and error may be good enough.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: runaway_pancake on Mar 30, 2013, 03:22 am
OK

The beta isn't given on a graph, it's a figure inside a range. 
They don't vary widely, and they've got better over the years, but each device is different.  [There are such things as "matched pairs", more expensive, and matched quads in DIP/IC packages.]
Designers assume maybe the "typical" or work with the specified "minimum", when beta is important.  Avoid "beta critical" designs.

Some "rule of thumb" figuring:
Collector current cannot be greater than base current * beta
You can back figure beta by determining where collector current starts to poop as base current is decreased.

With a "common emitter" circuit, base current = (input voltage - V_be) / base resistor).
Collector current (Max) = Vcc / (base current * beta).  Your design demand should be less than "max".
A transistor isn't a perfect conductor, that's why it's called a "semiconductor"; there is a voltage drop from collector to emitter (V_ce) - as current increases, V_ce increases.  So, be prepared to take that into account.  In our "common collector" circuit, V_cc gets divided amongst the LED, the resistor, and across the collector-emitter junction.

Emitter current = base current + collector current
(When collector current is much more than base current, I_c approx = I_e)

So, some transistor has a beta of 50.  If it's actually more than that, that's OK.
Let's say the goal is 50 mA collector current. 
If everything was ideal we could go with 1mA base current, but anticipate more.  With 2mA, then 100 mA collector current is possible, but that's "capacity" kept in reserve, a buffer, it's room to spare.
More base current than necessary should be provided while not over-doing it.  That's a "judgement call".  2X? 4X?  (V_ce * I_e) < P_d.

That's a presentation in a nutshell, but I think it sheds some light on the matter.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Mar 30, 2013, 07:11 pm
http://www.fairchildsemi.com/ds/MM/MMBT2222A.pdf

I think this was the datasheet I was using.

The 2n2222s are for a cube that lights upto 4 RGB LEDs, assuming they are 20ma, then that means I need between 0 and 240 ma (12x20=240) for the LEDs, but that doesnt account for dissipation by the resistors or transistors in the circuit.

From what I can tell, if I use too much base resistor, it may limit current too much. and not sink enough current, which may make it not light up enough, too small of a resistor, and you risk drawing too much current from the microcontroler.

With the mosfets, you dont seem to need that resistor, or is it just under some circumstances?

I have 2 cubes that will need mosfets for turning planes on and off (both cubes are 4x4x4 RGB, and use a 4 plane setup for a 25% duty cycle. Each plane consists of 16 RGB LEDs, assuming 20ma, that totals 16x60=960ma, or about an amp.

One cube sinks, while the other cube sources, so I picked out an n-channel, and a p-channel.
Heres a link to the n-channel.
http://www.diodes.com/datasheets/ds30830.pdf

and heres a link to the p-channel.
http://www.digikey.com/product-detail/en/AO7401/785-1085-1-ND/1856028

In post #77 I talk about how I come to think that this will be a good part, and in post 81 I list the parts that I ordered.

As I understand things, the fets wont need a gate resistor (similar to a base resistor), but it will work best if I have a gate/source resistor (makes it switch faster?). I also read about ringing, and that you can have a ringing issue that may damage the fet, the resistor reduces ringing?

When you talk about a beta, is that the same as gain, or HFE as I've read in other documents?

It was quite a bit of effort trying to figure out the right parts. I had to read a lot of datasheets and try to compare values and such. Digikeys website helped, but even then I spent hours. It would be nice if it were easier.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: runaway_pancake on Mar 30, 2013, 08:02 pm
I'd like to stick with transistors ("bee-jay-teez"), that's supposedly where you weren't getting support.

Beta is h_fe, Yes.
I'm still assuming that the "common emitter" circuit is the basis of this discussion.

As for "dissipation by the resistors or transistors in the circuit", remember: current is the same everywhere in a series circuit.  Let's do one thing at a time and not get caught up in a manic death-spiral.

If you want the transistor to do 240mA, then let's figure 300mA, plan for more than is needed. 
I think that a beta of 50 is a good assumption.
300 mA / 50 = 6 mA
So, with "5V" as input voltage to our humble transistor, (5V - Vbe )/6mA = 4V / 6mA = 667?. 
So, we'll live it up and go with 470?, working out to about 8 mA.

If V_cc is 9V, and I'll venture that V_ce might approach 300mV, then 9V - 0.3 = 8.7V. 
8.7V / 240mA = 36?. 
3 100? in parallel gets you 33?, resulting 263mA.

So, set that up, starting with > 2K for that collector resistor.  Measure the voltage across that resistor.  The voltage across the collector / the collector resistor ? = collector current.  Replace the collector resistor with a lower value, paralleling for value as necessary, taking notes along the way, till you have several data points that you can analyse. [2K, 1K, 500?, 100?,...]
If you can manage with the milliammeter then go that route.  Voltmeters make you get out the calculator, but they don't blow fuses.

The absence of an LED in the circuit doesn't matter, as we're just looking at, discussing, the collector current thing.

Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Apr 04, 2013, 05:45 pm
I think the primary issue I had was trying to figure out the beta, or gain as others called it, when I asked. One person told me to assume a gain of 100, another person told me to assume a gain of 10, and I was unclear on how anyone comes to the conclusion of a good number, both seem to be guesses, and radically different guesses at that.

I looked over the datasheet to try to figure it out. There are several graphs and several tables of data, but I couldnt figure out which one is the correct figure. If you do the calculations with each figure, you get very different results, and I couldnt rely on any of those calculations to be even close.

It seems to me that the part has a specific beta, you shouldnt have to guess if its 10, 50,100, or whatever. I do understand that at different temperatures, the beta will vary, but at or near room temperature, they should be should be pretty consistent.

Your first calcluation, with the 50 beta estimate is for the base resistor correct? That resistor goes between the arduino, and the base on the transistor, correct?

The second calculation you posted you said was for the collector resistor, Im not sure how/what/why that is about. Is that a resistor between the collector, and ground?

With the base resistor, I basically made a guess, then made some calculations, then tried a few sizes of resistors, making notes along the way. Because I was cascading them, I ended up testing them in tandem, as well as single.

It seems to me that I should have been able to get it a lot closer with the calculations, but having to guess with the beta made the calculations seem pointless.

I should look for my voltmeter, I havnt seen it in like 20 years. Measuring was very difficult, since my minimum was 20ma, and my max was 240 ma, I couldnt use one setting to measure all conditions, and that made measuring relatively inaccurate.

In your second calculations you have 9v -.3, should that be 9v-.7 (saturation voltage)?

When I was doing my testing, I only measured current, but I measured it at a few places.

It would also be good to understand why we need a resistor. its my understanding that he base resistor can be used to limit the current to the collector, but its primary function is to limit the current on the microcontroller, without it, you may draw too much current and break the microcontroller. Is that a fair statement? is there more too it?
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Apr 05, 2013, 01:03 am
I've started a couple of schematics. Before I put all the wiring in, its a bit easier to understand so Im including these views, that really only show how the transistors relate to the cathodes on the LEDs.


I've just added the full version. The schematic is kinda weird looking but its complete.

The BOM:
64 CC RGB LEDs
20 2n2222 transistors (I used little SOT23s)
20 Resistors 8-270 Ohm, 8-100 Ohm, 4-150 Ohm
40 pin sip socket (to connect arduino)
Arduino (I used a Nano, but any should work)
Runs on USB or alternate 6v power supply.


Edit: removed incomplete drawings, The full drawing is about 2,000x2000 px, its kind of big, but reducing it made it too hard to read.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Apr 05, 2013, 05:12 am
Heres a schematic for the charliecube spire, its not the whole cube, but if you can understand one spire, then multiply it by 16, you are most of the way there.

Edit: Changed drawings, included both common anode and common cathode.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: runaway_pancake on Apr 05, 2013, 06:29 pm
I just wanted to try to get you to do and understand one thing right: the common emitter circuit.
The key to understanding is to stay with the subject, avoiding the introduction of side issues.
I set out a modest experiment, but without a voltmeter it's pointless.
(You have an ammeter, but no voltmeter?)

There's a big difference between VB, VBE (approx 0.7V), and VCE.

With regard to "specific beta", all design assumptions are, or should be, based on worst-case, h_fe/beta guaranteed Minimum.
In some production lot there would likely be little variation unit to unit, but from lot to lot, or manufacturer to manufacturer there's no telling.
You may find that your transistors do better than the guaranteed minimum, well and good, so you can utilise that overage.

Anyway, till we can agree to work on one specific circuit, really wring out the fundamentals, I can't see any point in going on.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Apr 05, 2013, 07:56 pm
I have a pile of DMMs, the are cheap, but good enough. Somewhere, I may still have a nice meter (you know, the kind with a needle resting on some diamond chips to pivot smooth and effortlessly. I cant remember the last time I saw it, but its a basic VOM.

I think i understand the basics of the calculations, but it would be nice to understand why the parts are needed.  I also dont like the guessing part of the calculation, it seems to me that the part will likely behave about the same under similar conditions for most people. It seems like it should be easy to look that up in a chart or graph, and get close with your calculations, but I wasnt able to do that, I had to test things, before I could get in the ballpark.

The last several posts, I've only been talking about using 2n2222 BJT in my circumstances of lighting up to 0 to 4 RGB LEDs (0 to 12 LEDs total) at one time.
The posts with the schematics show you how the transistors are being used. That same circuit can probably be modified to use mosfets, or ULN (darlington arrays) chips easily though. I did test all 3 types of parts using the same LEDs and resistors that I used on the cube.

I do also have unfinished projects that will need mosfets, and I've picked out some tiny parts that hopefully will be suitable for my needs (about 1 amp), and as I understand it, they dont need a resistor between the arduino, but they need one between the gate/source, I think I have some 4.7k's for that.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: runaway_pancake on Apr 05, 2013, 09:08 pm

I think i understand the basics of the calculations, but it would be nice to understand why the parts are needed. 
Which parts?  Are we discussing the common emitter circuit?

I also dont like the guessing part of the calculation, it seems to me that the part will likely behave about the same under similar conditions for most people.
It's not a  "guess".  You have to start somewhere.  Having only the least is a good start, if there's more (as in more beta, as may be likely) then it only gets better.  The circuit will not be a worse performer for the transistor's having more beta (gain) than anticipated.

It seems like it should be easy to look that up in a chart or graph, and get close with your calculations, but I wasnt able to do that, I had to test things, before I could get in the ballpark.
How can I know where you're losing the plot?  You haven't shown your work.

I can't see what's going on in your schematics; they're pretty free-form, difficult to follow.



Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Apr 05, 2013, 09:26 pm
I just went back and changed some other drawings, and removed the incomplete ones. The complete one is kind of big 2000x2000 pix, but if I reduce it too much, its harder to read.

I will look for my notes, it was a while ago, so I may be a while before I find them.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: runaway_pancake on Apr 06, 2013, 01:07 am
I took some data with two different transistors, a 2N3904 and a PN2222.

(http://i270.photobucket.com/albums/jj118/new_clear_days/circuits/CommonEmitter_current_zps0e21d4c9.jpg)

I ran the 2N3904 out past recommended Absolute Max.
What's not across the load (VL is across VCE.

Clearly, the PN2222 has more gain.
If you don't like comparing the 32? load data, the PN2222 does a lot better job with 67? load.  It's able to sustain > 120mA collector current with 1mA base current.
I'm using resistors for load because I don't want to string out a bunch of LEDs.

[Given the 32? example: 3 Greens in series (= 6V) with a 220? resistor would result about 10mA; so, 24 of those circuits in parallel would have the same effect (240mA).]

> > > This is what I was trying to get you to do in Reply #101.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Apr 06, 2013, 06:09 pm
I looked around for my notes, and I couldnt find much, so I did the calculations again:

I considered 4 circumstances Highest load (240ma), lowest load (20ma), Highest gain guess (100), lowest gain guess (10). Im only using 5v, and saturation point is .7v.

Loads:
1-12 LEDs, assuming 20mA.
20mA to 240 mA
.7v Saturation
Vin=5v
Gain/Beta/HF_E: 10, 100


#1 (20ma load, gain 10)
Base current = 2mA  (20/10=2)
5v-.7v = 4.3v
4.3/.002(2ma) = 2150 ohms
Base resistor size 2.15K ohm

#2 (20ma load, gain 100)
Base current 20mA (20/100)= .2
5v-.7v = 4.3v
4.3/.0002 = 21,500
Base resistor = 21.5k ohm


#3 240 mA load,  gain 10
Base current = (240/10) =24mA
5v-.7v = 4.3v
4.3/.024 = 179 Ohm


#4 240 mA load, gain 100
Base current = (240/100)=2.4 mA
5v-.7=4.3v
4.3v/.0024 = 1791 ohm
Base resistor =1791 ohms

From there It looks like I have range of 180 to 2k ohms. Which is pretty big, it doesnt help me figure out what part to order, so I cant order parts, until I narrow this down.

To make thing a little more complicated, Im cascading the transistors, so, even if these numbers were 100% accurate, they may not be after the second transistor.

In the past I've done calculations, and later found out that real world numbers and calculations can be very different, its best to test things with the specific parts, and specific power supplies, because they can vary.  Sometimes that 5v power supply is only 4.5v, others may be over 5v. 100 ohm resistors may actually be 95 ohms. These seem like tiny insignificant amounts, but when you throw them into the equation, it can change the results quite a bit.

I ended up getting using many resistors and a few transistors, setup a test rig with the parts I plan on using (LEDs, resistors, 2n2222s and a variety of base resistors). I did a bunch of testing and measuring, then I realized that I needed to use 2 transistors for my testing, so that It would be exactly like I will be using them.

I had a lot of hassle trying to measure, since my ranges of measurement was from a fraction of an mA to about 250mA, which meant 2 settings on the meter, and the 2 settings were inconsistent. but my measurements lead me to believe that I could use between 150 and 1k ohm base resistors, 150 drew a lot of current at the base when all LEDs lit (about 40ma), and 1k restricted the current a little bit, 300 ohms seemed to work good, and keep the base current under 20ma. I wasnt able to get 300, but I was able to find 270 ohm resistors, which is what I ended up using.

While I was testing the 2n2222 with 4 RGB LEDs I did similar experiments with the mosfets that I picked out for the other cubes (they need to sink/source almost a amp, way too much for 2n2222s). I have a p-channel, and an n-channel, both have similar ratings, both need to be able to light between 1 and 48 LEDs (assuming 20ma), thats nearly a whole amp. I only did a little measuring, but it seem like they only had about 1ma load on the gate, they seem like a much better part than the BJTs.

Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: runaway_pancake on Apr 06, 2013, 07:59 pm
Quote
In the past I've done calculations, and later found out that real world numbers and calculations can be very different, its best to test things with the specific parts, and specific power supplies, because they can vary.

Yes, this is known as "DVT" - Design Verification Testing.

Again, my sole motivation in posting on the subject was in response to your having posted that you hadn't gotten support enough to understand the relationship between beta and collector current.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Apr 06, 2013, 08:35 pm
I still dont have any idea how to figure out how to figure out the gain/hfe/beta for the calculations, It seems to me, that should be as simple as looking it up in a table on the datasheet.
The beta numbers 10 and 100 came from 2 different individuals, when I asked them where on the datasheet can I find the right value for my uses (20-240ma at 5v).

It seems to me, that there should be a few common resistors used with 2n2222 transistors, one for 5v, and other for 12v applications. the part is only good for about 1/2 amp (mine are smt, and only good for 350ma). I would think that I would find 5v circuits all had about the same value base resistor, and 12v circuits would have a different value, but the 12v circuits would all have a similar value base resistor.

It seems like it should be easier than it is, and it seems like I have to assume every transistor will have a beta between 10 and 100, and be prepared for every calculation in between.

Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: runaway_pancake on Apr 06, 2013, 09:31 pm

I still dont have any idea how to figure out how to figure out the gain/hfe/beta for the calculations,

Then you haven't been reading any of my posts.


It seems to me, that should be as simple as looking it up in a table on the datasheet.

Again, (I have posted this twice before) beta is not a firm figure, there's a range, but a minimum guaranteed is always specified - that's what you work with.  Reconcile yourself to the fact that the way it's done and how you want it are two different matters.


The beta numbers 10 and 100 came from 2 different individuals, when I asked them where on the datasheet can I find the right value for my uses (20-240ma at 5v).

Those numbers did not come from me.


It seems to me, that there should be a few common resistors used with 2n2222 transistors, one for 5v, and other for 12v applications. the part is only good for about 1/2 amp (mine are smt, and only good for 350ma). I would think that I would find 5v circuits all had about the same value base resistor, and 12v circuits would have a different value, but the 12v circuits would all have a similar value base resistor.

Why would you think they would be the same?  
The base current required for IC up to 240mA is different than that for 100mA or 50mA. Yes, someone could set it all up for the possibility of 240mA, no matter what, but then where that's more than required it'd be over-driven like crazy. That's OK, in a political sense, but the cognoscenti will deride the unnecessary base current.


Moderator edit: unnecessary sarcasm removed
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Apr 06, 2013, 10:45 pm

I understand that the gain will not be the same at all voltages, and all currents, but the part is pretty limited in its rage of current, and using it at 5v is very common (especially when you are using it with microcontroller, like we do on this forum)

With a 2n2222 transistor, and 5v, how many possible base resistor sizes could I need? We know the current wont be more than 1/2 amp, or we would need a different transistor. At 240ma, you may have a different gain than at 10ma, which will effect the size of the base resistor. but at similar current levels, it should be pretty similar (note: similar does not mean exactly the same, it means near, or close to.) I understand there will be some deviation from lot to lot, and manufacturer to manufacturer but at 5v, one size resistor should be good for a fair range of current.

Anyway doing the calculations isnt the problem, calculating my needs isnt a problem, figuring out the right value for gain/beta/hfe is a problem You mentioned that I can assume its 50, someone else says I should assume its 10, another person says its probably about 100.

When all is said and done, the calculations were kind of pointless, since I had to hook them up and measure to find the answer.


Moderator edit: severe over-quoting removed; vitriol removed
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Apr 08, 2013, 10:31 pm
Thanks for removing those offensive posts.

I am curious about the claims of vitriol though, but whatever, its probably not important.
I dont really see any value in the posts after I posted my calculations. Those are mostly just a bunch of incorrect assumptions and of little or no educational value.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Coding Badly on Apr 08, 2013, 10:51 pm
I dont really see any value in the posts after I posted my calculations.


There is value to the forum.  The posts stay.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Coding Badly on Apr 08, 2013, 10:58 pm
I am curious about the claims of vitriol though, but whatever, its probably not important.


It is entirely up to you to decide if it is or is not important.  If I have to edit any of more your posts on this thread you will be given a timeout.  If access to this forum is important to you then you will temper your responses.
Title: Re: RGB SMT LED Cube, resistors, drivers, and shift registers.
Post by: Hippynerd on Apr 08, 2013, 11:56 pm
Thanks for your help, its a big improvement. Im sorry for any hassle.