Table of Contents

How to Control LED Brightness with a Potentiometer

Arduino LED with Potentiometer
Example Description
Learn how to control the brightness of an LED using a potentiometer and Arduino Uno in PictoBlox. In this project, the potentiometer acts as a variable resistor, allowing you to adjust the LED brightness smoothly by rotating its knob. The analog value from the potentiometer is read by Arduino and converted into a PWM signal to control the LED intensity.

Introduction

Pulse Width Modulation (PWM) is a technique used to control the brightness of LEDs by varying the amount of power supplied to them. In this project, a potentiometer is used as an input device to generate different analog values, which are then mapped to the LED brightness. This simple project helps learners understand analog input, PWM output, and basic sensor interfacing with Arduino.

Connections

LED

  1. Positive (Anode) → Digital Pin 3 (PWM) through a 220Ω resistor
  2. Negative (Cathode) → GND

Potentiometer

  1. One outer pin → 5V
  2. Other outer pin → GND
  3. Middle pin (Wiper) → A0

Step-by-Step Block Coding Guide 

  1. Add the ‘When Arduino Uno Starts Up’ block.
    Arduino-UNO-Starts-Up
  2. This block initializes the program and executes the code when the Arduino starts running.

  3. Add a ‘Forever’ block below the start block.
    Forever block
  4. Inside the ‘forever’ block, add an ‘if-then-else’ conditional block.
    If-Else-with-Forever
  5. In the ‘if’ condition field, insert the ‘read status of digital pin 2’ block.
    forever if-else with read status of digital pin 2
  6. Inside the section, add the ‘set digital pin 13 output as HIGH’ block.
    forever if-else with set digital pin 13 output as high
  7. Inside the ‘else’ section, add the ‘set digital pin 13 output as LOW’ block.

    Final Code

Conclusion

This project demonstrates how a potentiometer can be used to control LED brightness using Arduino Uno and PictoBlox. By combining analog input with PWM output, learners gain practical experience in sensor interfacing and output control. It serves as an excellent beginner project for understanding real-time interaction between hardware components and programming while introducing the fundamentals of embedded systems and automation.