LEDs can be connected to standard 9V voltage sources with the appropriate resistors, which provide the proper current regulation. If you connect a LED directly to a battery with no resistance, there will be no limitation to the current flow and your LED will not last very long. This is known as a short circuit. In order to limit the current, a resistor must be placed between one terminal of the LED and battery. With a few calculations, you can determine the necessary resistance value for your LED circuit to function ideally.
Determine and record the LED's turn-on voltage, Vf, and current rating, I. These values can be found on the back of the LED's packaging or on the LED's data sheet. LEDs have turn-on voltages that correlate with the colour of light that the LED emits. A table that includes turn-on voltages for standard current ratings can be found in the Reference section under "LED Color Chart."
Subtract the LED's turn-on voltage from 9V. Record this value as V. (9V - Vf = V)
Determine the proper resistor value by using Ohm's law: Voltage equals current multiplied by resistance (V = IR). Rearranging the equation, we can see that R = V/I. We have a value of V and for I. The resistor value that must be connected in series with the 9V source and LED is equal to the calculated value, R.
Connect a resistor with the calculated resistance, R, between one terminal of the battery and LED. Connect the other end of the LED to the corresponding terminal of the battery. The LED should come on and be operate at exactly its rated current.
Due to risk of electrical shock, always use caution when working with electricity.