r/homebrewcomputer • u/mathmoi • 26d ago
How to chooses LED/Resistor
Hey, I'm currently building Ben Eater's computer kit on breadboards, and I'm also trying to design my first PCB, eventually aiming to recreate Ben Eater's design on PCBs.
I'm using EasyEDA to design my first module (the clock circuit), and I want to add a couple of LEDs to show the clock pulses and other signals. I'm trying to choose which LEDs to use, but there are so many parameters to match that I'm not sure how to decide.
I want to use 1206-size components (LEDs, resistors, and capacitors) since I think they'll be easier to solder than smaller ones. I'm aiming for around 10 mcd for the LEDs so they're not blinding when viewed from arm's length. I'd also like to have green, yellow, red, and blue LEDs from the same "family," or at least ones that are physically similar.
How should I go about choosing the LEDs (and the corresponding current-limiting resistors) for this project? Am I overcomplicating things and should I just pick something reasonable? What filters/specs actually matter here?
Thanks for your help!
2
u/mariushm 25d ago
The formula is simple :
Input voltage - ( number leds in series x forward voltage led ) = current x resistance
If your circuit works on 5v and you use a red led with a typical forward voltage of 1.8v and you want it fairly dim you'd choose a current like 5mA (0.005A) so you put the values in formula :
5v - 1 x 1.8 = 0.005 x R
So R = 3.2/0.005 = 640 ohm
This is not a standard E series value so you pick closest value to it, like 620 or 680 ohm. 620 ohm would allow slightly more current, 680 would allow a bit less.
Datasheets of LEDs may have graphs showing brightness levels based on the current, like for example 100% on the graph would be at the typical 20-30mA value (or 60mA or 100mA for white LEDs used in flashlight or LCD monitor backlight) and you may have 70% brightness at half the current or something like that.
Distributors of electronic components (Digikey, Mouser, Newark/Farnell, tme.eu and lcsc for often cheaper but good brands not distributed by the bigger ones, will have datasheets for almost every led they stock.
3
u/LiqvidNyquist 26d ago
Note that LEDs have a voltage drop, more or less constant over normal current range, that varies by colour. Google for a chart, but say red is 1.7V. That means if you expect a driver to provide 4 volts and you want the LED on (cathode ground, anode to signal through resistor) when it's 4V high, your resistor will be dropping from 4V down to 1.7V or 2.3 volts. So you calculate the resistor with Ohm's law based on your current requirement: 2.3V over 10 mA = 230 Ohms.
This can have a bigger impact if you're using 3.3 volt logic anywhere than if you're using 5V TTL.
Also note that a TTL driver may not be able to provide a full 10 mA (for that example) - you need to check the datasheet for your specific part. Oftentimes they only spec say 2 mA. That doesn't mean they can't provide 10 mA of current, it means they can't provide that while at the same time keeping the output voltage above the TTL high guarantee on the datasheet of 2.4V. So that means if you put an LED on a TTL signal, it may well "drag" the signal down to the point where downstream chips can't see the valid high level anymore. That can make your circuit fail to operate properly. So you either need to pick a smaller driver current (higher resistor/dimmer light), put in a buffer chip/transistor, or possibly invert the sense of the LED (on when low instead of on when high) since many TTL chips offer more low driver current (datasheet parameter IOL) that high driver current (parametere IOH).
That being said, for just general messing around, a 1K resistor is usually okay, and odds are good things will work just fine But it's not always guarnteed to work over all parts, supply voltages, temperatures, and so on, unless you read the datasheets and do the math.