Need help getting 256 colors out of a LED

SgtWookie

Joined Jul 17, 2007
22,230
Hi Branden,

Sorry, I've been a bit distracted. I didn't build it, but I simulated it.

One thing I forgot to ask you - did you already have some potentiometers (pots) that you wanted to use?

I think you mentioned 10k pots before. If that's the value you have, and want to use, then R2 and R3 should be 2.7k, as shown in the schematic.

You're also going to need resistors for each anode of each LED. Sorry, there's not an easy way around that.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
OK, now let's talk about the LEDs.

They have Vf (forward voltage) ratings of 1.8 to 3.5v for the red, and 3v to 3.5v for the green, all at 20mA.

Let's play it safe; if we err on the low side of Vf, the LEDs won't be as bright as they might be, but they won't burn out quickly.

You're going to be powering this from your computer supply. So, you have +12v available.

For the red LED, let's assume a Vf of 2v.
For the green and blue, let's assume 3.2v.

Each anode will need a current limiting resistor. Let's call them Rlimit.
The general formula is:
Rlimit >= (Vsupply - Vf_LED) / Desired_Current
So for the green and blue:
Rlimit >= (12v-3.2v)/20mA
Rlimit >= 8.8/0.02
Rlimit >= 440 Ohms.
Now we look at a table of standard resistance values; one can be found here:
http://www.logwell.com/tech/components/resistor_values.html
Looking at the green E48 columns, we find that 440 Ohms is not a standard value, 430 is too low, and 470 Ohms is the closest standard value that is higher than 440.
Now we can flip the above formula around, and find out what the LED current will be if we use a 470 Ohm resistor:
I_LED = (Vsupply - Vf_LED) / 470 Ohms
I_LED = 8.8/470
I_LED = 18.7mA - it'll still be quite bright, and we even have some leeway in case the Vf is a bit lower than we expect.

Now, the red LED:
Rlimit >= (Vsupply - Vf_LED) / Desired_Current
Rlimit >= (12v - 2v) / 20mA
Rlimit >= 10/0.02
Rlimit >= 200
Referring back to the table of standard resistance values, we find that 200 is a standard value.

Now, we need to determine the power rating requirement for the resistors.
Let's do the red LED Rlimit first.
P=EI, or Power (in Watts) = Voltage x Current (in Amperes)
P = (12v-2v) x 20mA
P = 10 x .02
P = 200mW
For reliability, we double that result, so we need a resistor that is rated for 400mW or more. 1/10, 1/8, 1/4, 1/2, 1, 2, 5, 10 Watts are standard ratings. The closest you can get is 1/2 Watt. 1/4 might work, but the resistors would be hot all the time, and it wouldn't last very long.

Now for the green and blue:
P=8.8 x .0187
P=0.16456 Watts
Double for reliability, 0.32912 Watts. You'll need 1/2 Watt resistors for those as well.

However, there's a "sneaky trick" that you might use, depending upon the power supply that your computer has.

A standard ATX or ATXPLUS12 form factor supply has +3.3v, +5v, and +12v along with -5v and -12v for the RS232 communications.

If you use the 5v supply for "grounding" your common cathodes, then you will have a difference of 12v-5v=7v, so you can use lower value (and lower wattage) resistors!

See if you can re-calculate the resistance and power requirements for Rlimits using this idea - just repeat the calculations I've done above. (You DO want to learn how to do this stuff, right? ;))
 

Thread Starter

branden137

Joined Mar 7, 2010
27
I absolutely want to learn this stuff.

I was hanging on every word honestly.

I appreciate the excellent detail and I good at math so I got this use of formula stuff.

Also i know how to read resistor values. The color code stuff.

It is so difficult to read about this stuff because everyone seems to throw in items I was to look up because they are out of my scope.

I have some pots but come to find out they are trimmers and so they are not good for repeated use according to what i have read. SO we have free reign as the pots go.

Thank you Again.

I am currently in finals at my school and looking for a house and newly married so in about 3 days Ill order this stuff.

I eagerly await more circuit knowledge.
 

Thread Starter

branden137

Joined Mar 7, 2010
27
Okay I can make the main thing but I do not understand where to place the pots

Because they are on the side and bottom left of the page disconnected from the main circuit, I assume that they are in the middle between the main circuit and the V+ but I am guessing.

Branden
 

SgtWookie

Joined Jul 17, 2007
22,230
Congrats on your marriage :) Good luck on finding the perfect home. :)

Okay I can make the main thing but I do not understand where to place the pots

Because they are on the side and bottom left of the page disconnected from the main circuit, I assume that they are in the middle between the main circuit and the V+ but I am guessing.
Pots have three terminals, very frequently they are all in a row; let's call them terminal 1, 2, and 3.
Even if they are not all in a row, there are two "ends" (1 and 3) and a "wiper" terminal (2).

The resistance between the two end terminals does not change when you rotate the shaft of the pot.
The resistance between either end terminal (1 or 3) and the wiper terminal (2) changes when you turn the shaft.

On the schematic, towards the upper left, I have shown two connection points labeled "VRx-1" and "VRx-3". You connect all three pots terminal 1's to VRx-1, and all three pots' terminal 3's to VRx-3.

Looking to the right, you will see that the top three LM339 comparators have connection points labeled VR1-2, VR2-2, and VR3-2 - that is where you connect the wiper terminals (2).

You want to buy "linear taper" pots, not "audio taper" or "log taper" pots.
"Linear" pots change in resistance evenly over the (approximate) 270° rotation of the shaft. The "audio taper" pots are used for audio amplifiers.

Since you are buying new pots, I suggest that you get 100k Ohm pots instead of the 10k pots. Because you are changing the resistance of the pots, R2 and R3 also need to be changed from 2.7k to 27k.
 

Thread Starter

branden137

Joined Mar 7, 2010
27
Everywhere I check the Comparator 339 have 14 pins how do i hook them up the diagram shows only 3 ends

BUT then I noticed that all the comparators have different numbers on the 3 sides

between all 4 I get all numbers but 3 and 12 Which would be VCC and ground If I look at the diagram below.

http://pdf1.alldatasheet.com/datasheet-pdf/view/3064/MOTOROLA/LM339.html

In this case am I only using one Comparator to run the whole thing or 4 Separate ones using the 4 different channel set that are in the single comparator.

Also what are R4,R5,R6 doing exactly it seems they would be bypassing the LEDs to me by completing the loop.

Thank you i advance

Branden
 
Last edited:

Audioguru

Joined Dec 20, 2007
11,248
Why don't you look at its pins on its datasheet?
An LM339 has four comparators, not one or two. It has 14 pins not 8 pins.
The datasheet shows its pins.

An LM393 is a dual comparator with the same circuits as an LM339 but has 8 pins.
Two sets of two inputs, two outputs, a positive supply pin and a 0V pin for a total of 8 pins.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
Sorry that I did not explain that to you better, Branden.

It may seem confusing, but indeed - all four comparators are in one IC package (IC=Integrated Circuit).

I should have also mentioned that manufacturers publish datasheets for the components that they make. Practically all of them are available online in .PDF format.
National Semiconductor's datasheet for the LM139/239/339 has quite a few example circuits.
Link: http://www.national.com/ds/LM/LM139.pdf

It is always a good idea to download the latest datasheet from the manufacturer's website when you are planning on building something new. There may be corrections or changes in specifications that you need to be aware of. Also, a part may be in "last time buy" or "obsolete" status - you want to find out that kind of thing before designing a new project.
 

Thread Starter

branden137

Joined Mar 7, 2010
27
Okay can you look at my PDF file and tell me if I have the routing of everything about right.

The former item with the comparators seperate made it look easy but with the 4 being together I am trying to make a PC board and it seems difficult.

I am stuck in the thought process that + and - are not to ever touch and I noticed a lot of separation merely by a resistor.

I know my drawing is ruff but I believe you can make things out.

Yellow is +
Black is -
Green red blue to respective LEDs
Pink wires are just jumpers
Purple are transformers
aqua is diode
C is Capacitors

I did not know if I needed to hook up 3 or 12 on the lm339n.

I just need to know if I am understanding the flow of things later I will make a clean sexified one.

Thank you
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
Branden,
Did you see the NOTE: in the upper right hand corner of the schematic? That should answer your question about pins 3 and 12.

How were you planning on making the circuit board; by etching a blank PCB, or doing point-to-point wiring on a protoboard, or something else?
 

Thread Starter

branden137

Joined Mar 7, 2010
27
I plan to etch a blank PCB and I was just wondering if it looked right circuit wise.

I will be cleaning it up, but I was not sure if I placed everything in the right places.
 

Thread Starter

branden137

Joined Mar 7, 2010
27
Okay then how do I use 3 pots if there are 5 spots only for the pots to go.

Don't I need 6 holes for 3 pots

just to ask was my diagram close to right. I just want to know if I am understanding.

I guess I do not understand that meaning of VRX-3, VR3-2, VR2-2, VR1-2, VRX-1

Unless you mean all prong 1's of the Pots go to the VRX-1 and all prong 3's of the pots go to the VRX-3 and Prong 2 go accordingly to VR3-2-1

Where do I attach the common Cathode part of the LED
 
Last edited:

retched

Joined Dec 5, 2009
5,207
If you are using single sided stock, you will only want to etch the bottom file on the copper (RGB_PWM_LM339_CC_bot.pdf)


Then you can transfer the top file to the top of the board (non copper side) after etching, as a legend.
 

SgtWookie

Joined Jul 17, 2007
22,230
Okay then how do I use 3 pots if there are 5 spots only for the pots to go.

Don't I need 6 holes for 3 pots
Branden,
I already explained that with the pots, all terminal 1's go to VRx-1, all terminal 3's go to VRx-3, and the middle pins (2) go to VR1-2, VR2-2, and VR3-2 individually.

just to ask was my diagram close to right. I just want to know if I am understanding.
Please forgive me, but I am tired and don't feel like doing that now.

I guess I do not understand that meaning of VRX-3, VR3-2, VR2-2, VR1-2, VRX-1

Unless you mean all prong 1's of the Pots go to the VRX-1 and all prong 3's of the pots go to the VRX-3 and Prong 2 go accordingly to VR3-2-1
That's it; you have it.
 

Thread Starter

branden137

Joined Mar 7, 2010
27
what program did you use to produce the pcb template you made for me. Because I need to modify the boards size and the placement of components.

I tried PCBEXPRESS but after taking the time to make things I could no make the board have a common ground sight like you did.


I mean the way that all the board was a ground except the areas sectioned off to be Powered

Thank again.

I have all my components just need the board now.
 

SgtWookie

Joined Jul 17, 2007
22,230
The layout and board were made using Cadsoft Eagle 4.16r2.

There is a freeware version available; it is limited to a board size of 3.2" x 4", you can only have one sheet schematics, and a maximum of two layers in the board. Other than that, it's functional.

You can download the freeware version from http://www.cadsoftusa.com

If you download the same version that I have, I can help you if you run into trouble. However, if you download a newer version than I have, you are on your own. My version is registered, and I really don't want to pay again to upgrade the license.

Sparkfun has a decent Eagle tutorial here: http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=108

After you've installed Eagle, you'll have a number of subdirectories in the program's folder.
I've attached the .BRD and .SCH files. Create a new Project folder, and download them into your Eagle[version]\Projects\projectname folder.

Never edit the schematic without having the board open, and never edit the board without having the schematic open. If you do, you will get in trouble in a hurry. You can wind up messing it up so bad that you have to start over from a backup.

Use the Erc in the schematic and Drc in the board frequently; they will complain if something is wrong.
 

Attachments

Thread Starter

branden137

Joined Mar 7, 2010
27
BAD NEWS Failure on first try not sure if things have been killed

GOOD NEWS bought 2 sets of everything.

ISSUES that caused issues:

1) I used a paper with the diagram in toner and ironed it on to the single sided copper plate. TONER diagram was PERFECT but as I wet and rubed the paper off some toner peeled off.

2) Then I got the point were the paper was just fuzz and dipped it is ferous cloride and the paper was still causing me issues because the copper was not getting eaten, so i had to scape down the borders.

3)After all that, then I fought to get the toner off. I was using nail polish remover ( the girly purple kind) and the crap would not come off. I ended up scrubbing it off, which left the ground and lead areas thinner and holey in places. there were no full on breaks though.

4) My soldering skills are sub par a bit and the leads to thing are to little for me to work with with my current soldering tip.

5) Do capacitors have a direction?

6) I forgot the 27k resistors and put 2.7k's on accident.



Suggestions?

Can I make larger solder points for all components that are not point size limited.

Also I did not get a fire or anything just some sizzling I was thinking it could have been the residue from the solder.

I used EXPRESSpcb and the file is below.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
I guess you expected me to do something with a PDF file.

I don't know WHAT you expected me to do with it, but I'm not going to do anything with it.

I gave you a complete schematic and board layout that would have worked just fine; I don't know why you felt that you had to change it. But rather than use the files I uploaded for your convenience in starting with Cadsoft Eagle, you started off using a completely different software, ran into trouble, and don't give me anything but a PDF to work with.

What is it that you expect me to do?

Yes, electrolytic and tantalum capacitors are mostly polarized.
Yes, putting in the wrong resistors will cause unexpected problems for you.

Using magazine print works very well (the kind of magazine print that comes in the newspaper; semi-glossy advertisements)

Use 90% isopropyl alcohol to remove the toner after etching.
 
Top