Table of Contents

Arduino LED with Potentiometer Using PictoBlox

Arduino LED with Potentiometer
Example Description

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 

Step 1: Start the Program

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

Step 2: Continuously Read the Potentiometer Value and set the LED Brightness

  1. Add a ‘Forever’ block below the start block.
    Forever block
  2. Inside the Forever block, add the Set PWM Pin 3 Output As’ block.
    inside-forever-block
  3. In the value field, insert the ‘read Analog Pin ()’ block.
  4. Divide the analog reading by 4 before assigning it to the PWM output.
  5. Since the analog input ranges from 0 to 1023 and PWM accepts values from 0 to 255, dividing by 4 scales the input to the correct range.
    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.