For the newcomers, it may be not an familar topic to limit the current considering how usually to turn on an incandescent or fluorescent bulb. The resistant of filament in incandescent buld acts as the current limit itself, and the ballast in the compact flourescent light (CFL) has several function, one of which is to limit the current after the light is turned on. For Light-Emitting Diode (LED), those LED bulbs on the shelf already come with an AC-to-DC power adapter and a current limiting circuit. Anyhow, it would be nice to make an LED light from the scratch.
One key to turn a LED on, or not destroying, is a current limiting circuit in place. It works as a valve for the current so that once the voltage applied to the LED making it becomes conductive, the current flows through the LEDs cannot be larger than the one regulated by the circuit. LEDs fails usually resulted from overheating. No current limiting circuit in place is a guarantee way to burn the LEDs up in a few seconds. By the way, attaching the LED chips, those come on the aluminum bare frame, to a heatsink dissipates the heat away from the LED chip generally recommended.
I were scratching my head a lot when learning about LED circuit around 2015, and still scratching my head now (for different reasons). I learned from this tutorial and here and his clear explanation save me some cratches.
The circuit is attached. The bold lines signify the main load route, and the thinner ones indicate the control mechanism to control the current of the main route which is about 150 mA. Wikipedia has a short article and some references attached. The current limiting can be built with a transistor by replacing MOSFET with medium current load transistors such as BD135, BD139.
Limiting current is achieved by the voltage difference between the power resistor (4 ohm, in this case). The maxium current allowed is ~0.5V/4 ohm = 0.125A. The exact value value of the nominator is depended on the transisotr (S8050). In the datasheet of N-channel S8050, Figure 4, the transisor starts to turn on (turn to conductible) with VBC ~0.5V.
How does the current work? First, the MOSFET is turned one because of its Gate is pulled up high through 100k ohm resistor. The voltage across the set resistor (blue) is zero, and the transistor is off. Quickly, the current approaches 0.125A, and the voltage across the set resistor approaches 0.5V. Once the voltage is larger than 0.5V, the transisor is conductible, drains the current from Collector to Emiter, and set the voltage of the Gate of MOSFET to zero. Once the Gate is pulled low (GND), the MOSFET is turnef off, and cut the current through set resistor. Now, the voltage between B and E is less 0.5V, and that turns off the transistor, leaving the Gate pulled high, and the MOSFET is turned on. The transisor and the set resisor makes a feedback loop, and the MOSFET is quickly switching, and that maintains the current through the set resistor closes to the max value. Now, we have a limiting current circuit (whew, kind of wordy).