LEDs are well-known for their current consumption, and sometimes a resistor is necessary to limit the current at a moderate value, between 10 to 30 mA.This solution has a drawback, because the value of the resistor must be calculated for each value of voltage. Replacing the resistor with a FET transistor offers a number of advantages (figure 1). By shorting the gate with source, the transistor forms o current source without requiring additional components. In this case BF256C is used and its constant current is between 11 mA and 15 mA when the voltage is between 5 V to 30 V. You may use a universal diode like 1N4148 to ensure polarity protection of the LED (figure 2). As a result, the LED can be powered with AC voltages between 5 V and 20 V. At the frequency of 50 Hz the LED is slightly flashing (not quite noticeable) reducing its brightness because of the half-wave rectification.