Arduino Uno LED Dimmer
Learn how to dim an LED using the Arduino Uno! In this project, we will control the brightness of the LED with PWM (Pulse Width Modulation).
Components Needed:
- Arduino Uno Board
- LED
- Resistor (220 ohm)
- Potentiometer (10k ohm)
- Breadboard
- Jumper Wires
- 12V power supply adapter
Circuit Diagram

Hardware Wiring Explanation:
Place the LED on the breadboard.
Connect the longer leg (anode) of the LED to pin 9 on the Arduino.
Connect the shorter leg (cathode) of the LED to one end of the 220-ohm resistor.
Connect the other end of the resistor to the GND (ground) pin on the Arduino.
Connect the middle pin of the potentiometer to pin A0 on the Arduino.
Connect one of the outer pins of the potentiometer to 5V and the other outer pin to GND.
Software (Arduino IDE):
Setup:
If you haven’t already, download and install the Arduino IDE on your computer.
Connect your Arduino Uno to your computer using a USB cable.
Verify your code by clicking the checkmark icon (Verify) in the Arduino IDE.
Once verified successfully, upload the code to your Arduino by clicking the right arrow icon (Upload).
Power the Arduino Uno:
Plug the Arduino into a USB port or power it with an external adapter.
Operation:
Once the code is uploaded, turn the potentiometer knob to adjust the brightness of the LED. The LED should dim or brighten based on the position of the potentiometer.
Learning Points:
analogWrite() Function: Used to generate a PWM signal to control the brightness of the LED.
analogRead() Function: Used to read the value from the potentiometer to adjust the LED brightness.
map() Function: Used to map the potentiometer's input range to the PWM output range.