Ships worldwide · rates shown at checkout
Free help & advice · we reply within 24 hours
30-day returns · 12-month warranty on faults
Import VAT and customs duties may be charged to the buyer on delivery.

06 - Potentiometer

Lonely Binary |

# Potentiometer (Variable Resistor) ![Potentiometer](/配件/LB-COMPONENT-SET/images/components/potentiometer.jpg) ## What is Potentiometer Potentiometer is a resistor with continuously adjustable resistance, changed by rotating the knob. ### Potentiometer Features - **Continuous Adjustment**: Resistance can change smoothly - **3 Pins**: Two fixed ends, one sliding end - **Wide Applications**: Commonly used for dimming, volume control, parameter adjustment, etc. ## Pin Description Potentiometer has 3 pins: - **Pin1**: One end (fixed end) - **Pin2**: Middle sliding end (output end) - **Pin3**: Other end (fixed end) ## Working Principle When the knob is rotated, the sliding end moves on the resistor strip, changing the resistance distribution with the two ends, but total resistance remains unchanged. ``` Pin1 ──[Resistor]── Pin2 ──[Resistor]── Pin3 ↑ Sliding End ``` ### Resistance Changes - **Pin1 to Pin2**: Resistance changes with knob position (0Ω to nominal value) - **Pin2 to Pin3**: Resistance changes with knob position (nominal value to 0Ω) - **Pin1 to Pin3**: Total resistance unchanged (equals nominal value) ## Usage Methods ### Potentiometer Dimming Circuit (Direct Visual Effect) ![Potentiometer Circuit Diagram](/配件/LB-COMPONENT-SET/images/circuits/potentiometer_led.png) ### Connection Instructions (Potentiometer Dimming) According to the diagram above, connection order is: ``` VCC (5V) → Potentiometer Pin1 Potentiometer Pin2 (middle pin) → LED anode → 220Ω resistor → GND Potentiometer Pin3 → GND ``` **Working Principle**: - Rotate knob, potentiometer Pin2 output voltage varies from 0V to VCC - **Clockwise Rotation**: Output voltage increases, LED brightens - **Counterclockwise Rotation**: Output voltage decreases, LED dims - Can continuously adjust LED brightness **Effect**: Rotate potentiometer knob, LED brightness changes accordingly, can directly see dimming effect ### As Variable Resistor Use only Pin1 and Pin2 (or Pin2 and Pin3), resistance varies from 0Ω to nominal value. ## Common Resistance Values | Resistance | Application Scenarios | |-----------|---------------------| | 100Ω, 220Ω | Current adjustment | | 1KΩ, 4.7KΩ, 10KΩ | Voltage division, dimming (most common) | | 1MΩ | High-impedance circuits | ## Arduino Example Code ### Basic Example: Read Potentiometer Value ```cpp const int potPin = A0; // Potentiometer connected to A0 void setup() { Serial.begin(9600); pinMode(potPin, INPUT); } void loop() { int value = analogRead(potPin); // Read 0-1023 Serial.println(value); delay(100); } ``` ### Connection Method - **Pin1** → **VCC (5V)** - **Pin2** → **Arduino A0** - **Pin3** → **GND** ### Code Explanation - `analogRead(pin)`: Read analog value, range 0-1023 - 0 corresponds to 0V, 1023 corresponds to 5V - Can convert to other ranges using `map()` function ### Advanced Example: Potentiometer Controls LED Brightness ```cpp const int potPin = A0; const int ledPin = 9; // PWM pin void setup() { pinMode(potPin, INPUT); pinMode(ledPin, OUTPUT); } void loop() { int potValue = analogRead(potPin); // 0-1023 int brightness = map(potValue, 0, 1023, 0, 255); // Convert to 0-255 analogWrite(ledPin, brightness); delay(10); } ``` **Explanation**: `map()` function maps 0-1023 to 0-255 for PWM control of LED brightness. ## Common Questions and Answers ### Q1: Potentiometer Reading Unstable? - Check if connection has good contact - Potentiometer may be worn, try cleaning or replacing - Add software filtering (read multiple times and average) ### Q2: How to Choose Potentiometer Resistance Value? - **Dimming, Volume Control**: Use 10KΩ (most common) - **Current Adjustment**: Use small resistance values (100Ω - 1KΩ) - **High-Impedance Applications**: Use large resistance values (100KΩ - 1MΩ) ### Q3: Can Potentiometer Be Used as Fixed Resistor? Yes, but wastes adjustment function. Use only two pins (1 and 2, or 2 and 3), resistance is fixed. ## Safety Precautions ⚠️ **Important Notes**: - Do not exceed maximum power (usually very small) - Do not rotate too forcefully to avoid damage - Pay attention to pin connections to avoid short circuit ## Practical Applications Potentiometers are commonly used for dimming, volume control, parameter adjustment, sensor calibration, etc. In Arduino projects, commonly used to provide analog input signals, control LED brightness, motor speed, etc.