Potentiometer

Z2M Part: EDR-00002-20K0

Control LED blink rate with potentiometer.

Circuit Diagram
Circuit diagram for Potentiometer
Wire Connections & Pin Configuration

Wire Color Connections:

Yellow → Analog Pin A0 to Potentiometer wiper
Red → 5V to Potentiometer outer pin
Black → GND to Potentiometer outer pin

Pin Configuration:

Arduino Analog Pin A0 → Potentiometer wiper (middle pin)
Arduino 5V → Potentiometer outer pin 1
Arduino GND → Potentiometer outer pin 2
Arduino Code
Edit
int potPin = A3;  // Potentiometer connected to A3
int ledPin = 13;  // LED connected to pin 13
int val = 0;      // Variable to store sensor value

void setup() {
  pinMode(ledPin, OUTPUT);  // Set LED pin as output
  Serial.begin(9600);       // Initialize Serial Monitor
}

void loop() {
  val = analogRead(potPin); // Read value from potentiometer (0–1023)
  Serial.print(\"Potentiometer Value: \");
  Serial.println(val);

  digitalWrite(ledPin, HIGH); // Turn LED ON
  delay(val);                 // Wait for time based on potentiometer value
  digitalWrite(ledPin, LOW);  // Turn LED OFF
  delay(val);                 // Wait again for same duration
}

Instruction Details

Wiring: Connect potentiometer outer pins to 5V and GND, middle (wiper) to Analog Pin A0.
Library: Not required (built-in).
Upload Code: Tools → Board → Arduino Uno. Tools → Port → select your COM port. Click Upload button.
View Output: Open Serial Monitor (Tools → Serial Monitor) at 9600 baud. Values 0–1023 display. Rotate knob to see values change. Use for LED brightness, servo control, etc.

How to Use

  1. Connect the required components as per the Pin Configuration above
  2. Open Arduino IDE and create a new sketch
  3. Copy and paste the code above
  4. Select your Arduino board and COM port from Tools menu
  5. Click the Upload button to upload the code to your Arduino
  6. Open Serial Monitor (if applicable) to see the output

Components Required

  • Arduino Uno
  • 10kΩ Potentiometer
  • LED
  • 220Ω Resistor
  • Breadboard
  • Jumper Wires

Category: Arduino Basics