Project 3: Fade an LED's Brightness (Fade / Fading)

Created on: 2 August 2012
Updated on: 16 January 2023

Tutorial 10 – Pages

One of the Arduino Uno PWM (Pulse Width Modulator) pins is used to fade an LED from dim to bright and back to dim continuously in this Arduino project for beginners.

There are two example sketches built into the Arduino IDE that will both operate this circuit. One is called Fade and the other is called Fading. The only difference between the two is that slightly different code has been used in the two sketches to achieve the same result.

Parts Needed

Besides an Arduino Uno, USB cable, breadboard and wire links, you will need the following components for the LED fade project:

  • 1 × LED (e.g. 3mm or 5mm red, green, blue, etc.)
  • 1 × 220 ohm resistor (1/4W 5%)

Project 3 Video: Fade an LED's Brightness with Arduino

The following video shows the Arduino Fade project breadboard circuit in operation. As can be seen in the video, the Arduino Uno fades the LED's brightness from dim to bright and back to dim again continually.

Arduino Website Page

Fade and Fading are the two LED fade projects found on the Arduino website. Find the circuit diagram and breadboard layout for the fade and fading projects on these pages.

In the Arduino IDE

Find the LED fade and fading sketches in the Arduino IDE using the top menu as follows.

File → Examples → 1.Basics → Fade

and

File → Examples → 3.Analog → Fading

Build the Circuit to Fade an LED's Brightness using Arduino

Find the circuit diagram and connections on both the Fade and Fading pages.

Use a breadboard to connect a 220 ohm resistor to Arduino pin 9. Connect the other end of the resistor to the anode of the LED. Connect the cathode of the LED to one of the Arduino GND pins.

Programming and Operating the Circuit

In the Arduino IDE, select either File → Examples → 1.Basics → Fade or File → Examples → 3.Analog → Fading to open the sketch for this project. Verify and upload the sketch.

After loading the sketch, you will see the LED continually get brighter and then dimmer.