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

by Mudit5246 in Circuits > Arduino

1932 Views, 0 Favorites, 0 Comments

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

Screenshot (127).png
Counter using pushbutton | Step by step | DigitalRead

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.

Components Required:

download.jpg
download (1).png
download (2).jpg
download (4).jpg
diymore-10PCS-Lot-Potentiometer-Resistor-1K-5K-10K-20K-50K-100K-500K-3Pin-Linear-Taper-Rotary.jpg_960x960.jpg

1. Arduino Uno

2. Breadboard

3. Potentiometer(10k)

4. Led

5. Resistor

6. Jumper wires

Circuit Diagram:

Interfacing potentiometer with Arduino | Part 3 | Code fully explained
Screenshot (126).png

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.

Code:

For more interesting projects connect with me on:

Youtube: https://www.youtube.com/channel/UCTS10_CRYJhT-vb9...
Facebook page: https://www.facebook.com/techeor1/

Instagram: https://instagram.com/official_techeor?igshid=uc8...

void setup()
{
 Serial.begin(9600);
 pinMode(5,OUTPUT);
  pinMode(3,INPUT);
}
void loop()
{
   int a= analogRead(A0);  
int b = a/4;  
 Serial.println(b);   
analogWrite(5,b); 
delay(200);     </p><p>  }</p>