Diodes, such as those that produce light, have an exponential voltage current relationship, so that the current increases rapidly for a small increase in voltage around the operating point.
Therefore, if you put an LED on a variable voltage power supply and slowly increase the voltage, the LED will at first be so dim as to be nonvisible to the naked eye. Then as you slowly increase the voltage, you will reach a point where the LED is becomes visible, and increasing the voltage ever so slightly beyond that point will cause a huge inrush of current that will destroy the device.
Ordinarily, therefore, a constant current supply is preferable for driving an LED. A good approximation of a constant current supply is a resistor in series with a constant voltage supply, whereby there will be a fixed drop in voltage across the LED.
The voltage drop across your LED will vary depending on what kind of LED you use. If you want to make a super bright pushbroom, your best bet is to get the super high brightness LEDs.
Connect the anodes of all the LEDs to a source of electricity, such as the +5 volts of your computer (you can get +5 volts from the correct pin of the mouse connector, or you can tap right into the power supply).
At this point, a note on safety. Be ready to unplug your computer quickly in case something goes wrong. Some computer power supplies can deliver lots of current.
If your pushbroom is an open style pushbroom, be careful where you rest it down, e.g. don't set it down on a metal surface, especially a grounded metal surface like your computer. Connecting the anodes together gives a positive earth pushbroom, so some insulating tape, or careful handling is necessary.
Looking inside the transparent LED housing, sometimes the big fat piece is the negative side. Sometimes not. Sometimes when you buy them, before you cut the wires short, the long one is positive. Sometimes the chamfer or cut off side of the plastic base is the negative side.
This means that you turn on the LED by writing a zero to the corresponding data bit, and turn it off by writing a one.
If you're looking for some adventure, here's some guidelines for living on the edge:
The lower the value of resistance the brighter the LEDs will be, up to a point, beyond which the LEDs and your computer may become permanently damaged.
Thus the goal of living on the edge is to make a very bright pushbroom without blowing up your computer.
Let's begin with an example that draws upon some experience:
I used some super bright high efficiency yellow LEDs I got from active surplus. These are more expensive than normal LEDs (e.g. approx. $1 each as compared to 10 cents each for normal LEDs). Depending on the color, the cost can be more, e.g. blue are approx. $5 each for the super high brightness ones.
I used a USB connector that I cut off of a Stefra Xybernaut XyberCam video camera, since the video camera was useless because the driver was Closed Source. I determined which pin was +5 volts. You can do the same with an old PS/2 mouse, to use the mouse port as a +5 volt supply.
I am now using resistors having a resistance of 110 ohms. Using a voltmeter I measure 2 volts across the LEDs which means the remaining 3 volts of the 5 volts is across the resistor. Thus I have 3/110 = .02727272727272727272... amperes flowing through this resistor (and therefore through the LED). That's approximately 27 milliamps which is pushing the limit of what a parallel port should be driving.
The power dissipated in my resistors is 3*.02727272727272727272 = .08181818181818181816, which is less than a tenth of a watt. I could therefore use eighth watt resistors, but to be safe, and to avoid hot resistors, I would use 1/4 watt resistors.
Resistors come in the following standard wattages:
If you were going to put lots of these LEDs on your rig, you might want to reduce the power consumption. This could be done with a DC to DC converter to drop the voltage to 3.3 volts, thereby using a 50 ohm resistor. 26 milliamps drive gives less than 1/8 watt. Be careful not to leave this pushbroom, with such low values of resistance, sitting around where someone might plug it into a more standard voltage and blow up a computer and the pushbroom.
Briefly, the parallel port has 25 pins, and the best way to connect is to buy a DB25 male connector.
If you like soldering wires, you can get a standard DB25 male connector, but if you don't like soldering wires, you can just buy a patch cord, patch cable, or the like, and cut off one end, strip the wires back, and use a solderless breadboard, such as the Wish Board sold by Supremetronic on Queen Street.
An alternative if you don't like soldering wires, is to buy a crimp on DB25 male and a piece of 25 conductor ribbon cable. Make sure the pitch of the ribbon is correct. No problems at Supremetronic, but I bought some ribbon at Active and it was slightly the wrong pitch, because it was surplus and maybe there for a reason.