Component Documentation: 1K ohm 16mm Rotatory Variable Potentiometer (Pack of 5)
The 1K ohm 16mm Rotatory Variable Potentiometer is a type of variable resistor that allows for precise control over the resistance value. It features a rotating shaft that changes the resistance linearly with the angle of rotation, making it an ideal component for various IoT and robotics applications. This pack of 5 potentiometers is perfect for prototyping, development, and deployment of IoT devices.
The potentiometer has three terminals:
1. Terminal 1 (T1): One end of the resistive track
2. Terminal 2 (T2): Wiper terminal (connected to the rotating shaft)
3. Terminal 3 (T3): Other end of the resistive track
Electrical Characteristics
Resistance: 1 k
Power rating: 0.5 W
Operating temperature: -20C to +70C
### Example 1: Analog Input Using Arduino
Connect the potentiometer to an Arduino board to read the analog value and control an LED's brightness.
```c++
const int potPin = A0; // Potentiometer connected to analog pin A0
const int ledPin = 9; // LED connected to digital pin 9
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
int potValue = analogRead(potPin); // Read analog value from potentiometer
int brightness = map(potValue, 0, 1023, 0, 255); // Map to 0-255 range
analogWrite(ledPin, brightness); // Set LED brightness
delay(10);
}
```
### Example 2: Feedback Control Using Raspberry Pi (Python)
Use the potentiometer as a feedback mechanism to control a servo motor's position using a Raspberry Pi.
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Potentiometer connected to GPIO 17 (Analog input)
pot_channel = 17
# Servo motor connected to GPIO 18 (PWM output)
servo_channel = 18
# Set up servo motor
GPIO.setup(servo_channel, GPIO.OUT)
servo = GPIO.PWM(servo_channel, 50) # 50 Hz frequency
servo.start(0) # Initial duty cycle 0%
try:
while True:
# Read analog value from potentiometer
pot_value = GPIO.input(pot_channel)
# Map to 0-100% duty cycle range
duty_cycle = int(pot_value / 255.0 100)
servo.ChangeDutyCycle(duty_cycle) # Update servo position
time.sleep(0.1)
except KeyboardInterrupt:
servo.stop()
GPIO.cleanup()
```
When using the potentiometer with a microcontroller, ensure that the analog input pins are configured correctly and the voltage levels are within the recommended range.
To avoid mechanical damage, avoid excessive rotation or force on the potentiometer's shaft.
Use appropriate decoupling capacitors and noise filtering techniques to minimize electromagnetic interference (EMI) and ensure stable operation.