The formula to calculate the resistor value in a series LED circuit is:
Resistor Value (Ohms) = (Supply Voltage - LED Forward Voltage) / (LED Current / 1000)
The wattage of the resistor can be calculated using:
Resistor Wattage (W) = (Supply Voltage - LED Forward Voltage) * (LED Current / 1000)
Supply Voltage: 5V, LED Forward Voltage: 2V, LED Current: 20mA
Resistor Value: 150 Ohms, Resistor Wattage: 0.3W
Supply Voltage: 12V, LED Forward Voltage: 3.3V, LED Current: 30mA
Resistor Value: 296.67 Ohms, Resistor Wattage: 0.6W
Supply Voltage: 9V, LED Forward Voltage: 2.2V, LED Current: 15mA
Resistor Value: 453.33 Ohms, Resistor Wattage: 0.6W