Introduction: Controlling LED Brightness With Potentiometer With Arduino

About: pursuing Bachelors in Electronics and Communication at Chandigarh University

In this project ,we will control brightness of LED using variable resistance provided by potentiometer. This is a very basic project for a beginner but it will teach you many things about potentiometer and LED working which are required to make advance projects.

We can also control LED brigthness without potentiometer . click the link below to check that project

link: - Led brightness control without potentiometer .

Step 1: Components Required

Step 2: Circuit Schematic

Pin 11 --> led anode

A0 --> wiper

Vcc --> 5V

Gnd --> terminal 3 of potentiometer, cathode of LED

Step 3: Arduino Code

Arduino analogRead function is used to measure the voltage between 0 to 5 volts and converts it into a digital value between 0 to 1023. The reason for value 1023 is because the analog to digital converters is 10-bit long. As analogWrite of PWM have duty cycle between 0 to 255 thats why we will divide value read by 4 in the code.


const int POTENTIOMETER_PIN = 0;

int analog_value=0;

void setup() {

// put your setup code here, to run once:

pinMode(11, OUTPUT);



void loop() {

// put your main code here, to run repeatedly:


//value of analog_value is from 0 to 1023 and duty cycle of PWM is 0 to 255.