You Want Electronic Components for your project. 

For more information, contact us at: 

4.6 Potentiometer Interface

Different Types of Potentiometer Explained - blog - Onzuu

4.6.1 Definition of a Potentiometer

A potentiometer is a variable resistor with three terminals. It can be used to produce a variable voltage that an Arduino can read through an analog input.

A typical potentiometer has:

  1. VCC – connected to the supply voltage.
  2. GND – connected to ground.
  3. Wiper – connected to an Arduino analog input.

The wiper voltage changes as the knob is rotated.

4.6.2 Connecting a Potentiometer

A typical connection is:

Potentiometer Terminal

Arduino

First terminal

5V

Middle terminal

A0

Third terminal

GND

The exact direction of increase or decrease depends on which outer terminal is connected to 5 V.

4.6.3 Reading the Potentiometer

Pots PCB Design For Nano Shematic Check - General Guidance - Arduino Forum

Example:

int potPin = A0;

int potValue;

 

void setup() {

  Serial.begin(9600);

}

 

void loop() {

  potValue = analogRead(potPin);

 

  Serial.println(potValue);

 

  delay(200);

}

As the potentiometer is rotated, the analog reading changes.

4.6.4 Using a Potentiometer to Control LED Brightness

Graphical Programming Tutorial for Arduino – Potentiometer Control LED «  osoyoo.com

A potentiometer can control the brightness of an LED.

int potPin = A0;

int ledPin = 9;

 

void setup() {

  pinMode(ledPin, OUTPUT);

}

 

void loop() {

  int potValue = analogRead(potPin);

 

  int brightness = map(potValue, 0, 1023, 0, 255);

 

  analogWrite(ledPin, brightness);

}

The map() function converts the potentiometer reading from the range 0–1023 into the PWM range 0–255.

How the System Works

Potentiometer → Analog Input → Arduino Processing → PWM Output → LED

When the potentiometer is rotated:

  1. The potentiometer produces a different voltage.
  2. The Arduino reads the voltage through A0.
  3. The Arduino converts the reading into a numerical value.
  4. The value is mapped to a PWM range.
  5. The PWM signal controls LED brightness.

I am an ICT enthusiast and software developer with interests in web development, networking, embedded systems, and the Internet of Things (IoT). I enjoy building innovative technology solutions, learning new skills, and using technology to solve real-world problems. I am committed to continuous learning, professional growth, and delivering quality work.and also i have 3 years of teachining and developing iot project.