Site icon Circuit Ideas for You

Fading LED Circuit using Arduino and Potentiometer

This project shows how to control Fading LED Circuit using Arduino and Potentiometer.

Potentiometer gives analog voltage.

By rotating the potentiometer knob varies the voltage output and arduino reads this variation.

Arduino reads it and changes LED brightness and this LED brightness changes smoothly.

It is easy to make a simple project for beginners and Arduino lovers.

Arduino Coding:

int pot=A0;
int led=9;
int val=0;

void setup()
{
pinMode(led,OUTPUT);
}

void loop()
{
val=analogRead(pot);
val=map(val,0,1023,0,255);
analogWrite(led,val);
}

Code Explanation:

Circuit Working:

Fading LED Circuit Diagram using Arduino and Potentiometer

Parts List:

ComponentsQuantity
Resistor 1.5k 1/4 watt1
Potentiometer 10k1
Arduino Uno1
LED any 5mm1

In this above circuit potentiometer changes its internal resistance.

This changes voltage at center pin of potentiometer VR1.

Arduino reads voltage level and converts voltage into PWM brightness.

LED brightness slowly increases or decreases when knob rotates.

R1 resistor limits LED current to prevent burning out the LED.

It works like manual dimmer.

Formula with Calculation:

Formula for current through the LED is given by ohms Law:

I = Vsource​ − VLED​​ /R

where,

Voltage across resistor = 5V – 2V = 3V

Current needed = 2mA approx since using 1.5k resistor

R = V ÷ I = 3v ÷ 0.002A = 1500 ohm

So 1.5k resistor is correct value we used in this circuit.

How to Build:

To build a Fading LED Circuit using Arduino and Potentiometer follow the below connection steps:

Conclusion:

This Fading LED Circuit using Arduino and Potentiometer helps understand analog input and PWM output in Arduino.

Potentiometer controls LED brightness in smooth way.

Circuit uses only one LED, one resistor and one potentiometer.

This circuit is good for basic Arduino learning.

References:

LED Fade Series Using Potentiometer

Exit mobile version