Led brightness control/fade LED

Led brightness control

Overview :

With the help of Arduino UNO/nano PWM pin controlling the glow or brightness of LED in increasing and decreasing order.

List of components :-

1. Arduino UNO/nano
2. Led light (3 mm/5 mm)
3. Resister 100/220 ohm
4. Breadboard
5. Jumper wire ( male to male )

Connection :

A light-emitting diode (LED) is a semiconductor light source that emits light when current flows through it. Electrons in the semiconductor recombine with electron holes, releasing energy in the form of photons.

LED’s long terminal is positive and short terminal is negative

5 mm led

breadboard is a rectangular plastic board with a bunch of tiny holes in it. These holes let you easily insert electronic components to prototype (meaning to build and test an early version of) an electronic circuit, like this one with a battery, switch, resistor, and an LED (light-emitting diode).


Fix the Led into breadboard connect the resister into one of the terminals (try to connect in positive terminal ). connect positive terminal with PIN 6 of Arduino . and connect the negative terminal with the ground.

On most Arduino boards, the PWM function is available on pins 3, 5, 6, 9, 10, and 11. The frequency of the PWM signal on most pins is approximately 490 Hz. On the Uno and similar boards, pins 5 and 6 have a frequency of approximately 980 Hz.


PWM stands for Pulse Width Modulation technique , It is used to convert the digital signal into an analog by varying the width of the Pulse . The PWM pins are used for giving the desired analog output . They are used to set the LED brightness or to run Stepper or Servo Motor or anything which require analog inputs

//Initializing LED Pin
int led = 6;
void setup() {
  pinMode(led, OUTPUT); //Declaring LED pin as output
void loop() {
  //LED brightness will increase
  for(int i=0; i0; i--){  
    analogWrite(led, i);

simply copy past the code.

Upload and working :

click on verify button verification is successful
If not then check for port selection
Tool> port> select COM port

Successful upload your code you led is blink as given below in fig

You can also see the glow rate of the LED in your serial monitor along with your LED glow

if you want to see at which rate fading is control open serial monitor.