No longer will sunglasses be required to look at LEDs!
Howdy folks! I'm Dryw, a new engineer here at SparkFun! I joined in March of this year and have already released a handful of products, such as those Bosch pressure sensors and the IoT Redboard - ESP32. I've also been working on some more exciting products that will be coming out soon, stay tuned for those!
As I've been working here, I've noticed a lot of our products use different resistor values for LEDs. Consistent LED brightness hasn't been a critical design requirement for us, which has resulted in different brightnesses across our catalog. The most severe example I saw was on a prototype, where the green and yellow LEDs were barely visible, and the red and blue LEDs felt like staring into the sun! So I made it my mission to find the perfect resistor for each of our LEDs, in order to give a consistent brightness across all our products, and to never need sunglasses ever again!
This is a fairly simple problem to solve, so you might be thinking "just look at the LED's datasheet and compute the ideal resistor with Ohm's Law." You're absolutely right, and that would be a totally valid approach. However there are some nuanced human factors that make this more tricky than it first appears:
On top of that, there are some additional technical considerations:
In principle, all these factors could be considered and accounted for. But in my opinion, it's much better to just play with the LEDs themselves so there's no doubt about the perceived brightness. So I got to work figuring out the best way to test each of our LEDs.
All the LEDs we tend to use are surface mount, so I needed to create a custom PCB to test them. In fact, we actually use 3 different sizes of LEDs, including 0402, 0603, and 1206. So rather than making different PCBs for each, I figured I could include each of those footprints in parallel on a single board. And heck, while I'm at it, why not add an 0805 footprint and some plated through-holes for LEDs with legs! Then we could test any LED!
In series with those LED footprints, I included a potentiometer as an adjustable resistor. I knew we wouldn't need to exceed 10k, so I used our blue 10k trimpot. It goes all the way to 0 Ohms at the low end, so I also included a 100 Ohm resistor in series to prevent any LEDs from blowing up. Here's what the schematic looks like:
To be clear, only 1 LED is added to each board. There are just 5 different footprints to accommodate any LEDs.
Next step was laying out the board. As I played with it, I was settling on a thin PCB that was a bit under 2" long. That got me thinking... pulls out ruler and a breadboard... Aha! Solderless breadboards have power rails that are just under 2" apart from each other! That would enable a user to have several boards plugged into and powered by a single breadboard's power rails! I really love solderless breadboards, so this was perfect!
However, this lead to a question that's surprisingly hard to answer: What's the spacing between those power rails? You'd probably assume it's on a 0.1" grid, but it's actually not! A quick Google search yields very few useful results, some of which didn't agree with each other. They're usually within the range of 1.85" to 1.9" between the outer rails, so I measured my own breadboard:
I measured a few other breadboards around the office, all were very close to 1.85", so that's what I settled on. There may be some breadboards that are slightly different, but the PCB uses header pins to slot into the power rails, which could bend slightly if needed. I also chose to use a row of 5 header pins on each end, since that's the standard grouping size of the power rails, and more headers make the boards more stable. That lead to this final layout:
I also added some silkscreen around the potentiometer to indicate the approximate resistance as the knob is rotated; the arrow on those blue potentiometers is a great feature for pointing to those marks! However mechanical tolerances and parallax make the precise resistance hard to read, so I also added some test points ("R+" and "R-") for measuring the exact resistance with a multimeter.
Note - you'll see multiple versions of the board in this post. Some are of the initial prototypes, some are of the final product. More details are at the end of the post!
Once the PCBs arrived, I grabbed our most commonly used LEDs, inlcuding a 1206 and 0603 of each red, yellow, green, and blue, plus a red 0402. That makes 9 boards, which I soldered together and stuck into a breaboard. I set the input voltage to 3.3V, and each potentiometer to 1k for comparison:
Same Resistance (1k) - Uneven Brightness
First off, I love how this looks! I've not seen a breadboard application that exclusively uses the power rails, but they sure are handy for this! Second, there's a lot of variance between these LEDs. The image doesn't quite match reality, but you can tell that green 0603 on the right is way dimmer than the rest, and the blue 1206 on the left is completely saturating the camera sensor. Time to start tuning!
I didn't want to be the one to dictate the "best" brightness, so I surveyed several people around the office. I had them all adjust the brightness of each LED until they were happy with it, and I recorded the resistance they set for each (3.3V input). Here's my data:
As much as I love staring at numbers, it's usually best to visualize them in some way. So I made a histogram of each column to compare:
That's quite the spread! I then took the median resistance for each LED, then selected the nearest standard resistor value as our final LED resistors for 3.3V inputs.
We also use 5V on a lot of products, so I added a column to the spreadsheet for that. I could have redone the survey at 5V, but I actually didn't need to! The brightness of each LED is determined by the amount of current flowing through it, which we just determined! So I can instead use Ohm's Law to calculate the resistor that results in the same current at a 5V input, and the LEDs will have the exact same brightness as before! I then tested it in person, and was pleased to see each LED at the same brightness as before. Now we finally have our perfect resistor values for each of our LEDs:
And how do they look? You tell me!
Customized Resistance - Even Brightness
Keep in mind, these resistor values only apply to the exact LEDs that we use! Your LEDs could require very different resistors, so you'll need to run your own tests if you want to achieve perfect brightness. But no need to worry about designing a custom PCB for testing, we've got you covered there!
The whole time I was designing this board, I had the goal of making this a product for users to easily test their own LEDs. I've done my best to make it as simple as possible and sell it as a kit, then users solder the boards themselves. The kit includes:
LEDs are not included with the kit, because the idea is for users to test out their own LEDs. The primary goal is to be a useful tool, but it could also serve as an educational resource for anyone new to electronics. It'd be a fun project for learning through-hole soldering, or even a place to practice surface mount soldering!
It also does a good job of demonstrating Ohm's Law, where lowering the resistance increases the current through a circuit. And this is a nonlinear relationship! For those of you familiar with Ohm's Law, you'll know the current is actually the inverse of the resistance. For some more visualization, I've plotted the resistance and the corresponding current:
Resistance vs. Current
So, as the potentiometer knob is turned to the left, the current (and the LED brightness) shoots up very rapidly! I actually looked into using logarithmic potentiometers for this reason, but couldn't find one that I was happy with. If there's enough demand, we may look into sourcing a good logarithmic potentiometer for a future revision.
There were a handful of other things to clean up before releasing it into the wild. I originally made the board width exactly 0.6", which made for a pretty snug fit that could cause some boards to get jammed. So I reduced the board width by 0.015" on each side to give some wiggle room. We also decided to release it under SparkX, since this is more of an experimental product, so I had to change the logos from the first prototypes. Finally, we put a fun graphic on the back side, which is the standard LED symbol with way too many arrows coming out of it.
And that's that! If you're interested in having some of these to play with, you can pick them up below. Happy hacking!