I have a cap from hardware.com. [I actually turned down a job offer from these folks in the fall of ’99. They only lasted a year or so after that. They intended to be a place where people could order tools, wheelbarrows, etc. on the Internet.] I also like to read at night. I happen to have some ultra-bright LEDs, and when combined with the cap, they make a great light for reading without disturbing others in a dark room. I’m sure it would also be useful when working inside of computer cases *and I dare you to do this at work*. The specs for the LEDs are available here. I’m using a 12 volt wall wort to provide the power. It turns out that the output is 17 volts under a 20 mA load. Now, the current needs to be limited to less than 20mA per LED. Here are some formulas that help with the calculations:

The formulas were drawn using Xfig. The first formula is for resistors in parallel. The second formula is Ohm’s law. Both are formulas I remember from my highschool electronics class from many years ago, but Horowitz and Hill are certainly more illustrious. There is an online Ohm’s law calculator, among other things on the Coprolite EE Tool page. From the spec sheet, we see that the typical voltage drop is 3.6 volts at 20 mA. We need to determine the effective resistance of the LEDs for typical usage. From the specs, and Ohm’s law, we can estimate that each LED at typical specs is 180 ohms. So, we have 3 180 ohm resistors in series, which is 540 ohms. If we hook up 17 volts, using Ohm’s law again, we will get 31 mA going through them. That is too much. If we put a 1K and a 680 ohm resistor in parallel, using the above formula, we get 405 ohms. If we put this in series with the LEDs, at typical specs, we will get 945 ohms. Divide 17 Volts by 945 ohms, and we get 18 mA. Considering that these are typical specs, this should protect us from going over 20 mA.

Here is a picture of the LEDs and resistors soldered to the power supply before mounting on the hat:

Here is a picture of the finished hat: