Introduction: Fading/Controlling Led/brightness Using Potentiometer(Variable Resistor) and Arduino Uno

Arduino analog input pin is connected to the output of potentiometer. So Arduino ADC(analog to digital converter) analog pin is reading the output voltage by the potentiometer. Rotating the potentiometer knob varies the voltage output and Arduino reads this variation. Arduino converts the input voltage to its analog pin into digital form. The digital value ranges from 0 to 1023 volts. 0 represents 0 volts and 1023 represents 5 volts. Arduino ADC is 10 bit which means it cam sample input voltage and outputs it an in-between range of 0 to 1023 volts (2^10 = 1024). Arduino works on 5 volts so its ADC input voltage range is also between 0 to 5 volts. Arduino boards working on 3 volts input range for ADC is 0 to 3 volts.

Note: Applying greater voltage to Arduino analog pins will damage your Arduino board. So in our case, the potentiometer voltage output must not increase 5 volts.

Step 1: Components Required:

1. Arduino Uno

2. Breadboard

3. Potentiometer(10k)

4. Led

5. Resistor

6. Jumper wires

Step 2: Circuit Diagram:

The potentiometer is used in the circuits where we need a variable resistance to control current and voltage. Have you noticed that the speaker that you have in your home, you move its knob in the clockwise and anti-clockwise direction to set the volume. Actually, behind the knob, there is a potentiometer, that is you are varying the resistance to set the volume. Likewise in many other home appliances potentiometer is used for the same purpose(old TV’s, old radios etc).

If we directly connect the led with potentiometer we can fade/control the brightness of led but not accurately and if we insert and intermediate microcontroller then microcontroller can fade led with the brightness level we want. In direct controlling brightness depends on the resistance of the potentiometer but with a microcontroller in between brightness depends on the voltage output of the potentiometer and somehow we can even neglect the voltage output and controlled on our defined parameters. With a microcontroller, there is more flexibility than manually fading.

Step 3: Code:

For more interesting projects connect with me on:

Facebook page:


void setup()
void loop()
   int a= analogRead(A0);  
int b = a/4;  
delay(200);     </p><p>  }</p>