1K Preset Potentiometer - (Pack of 5)
==============================================
The 1K Preset Potentiometer is a variable resistance component that allows for precise voltage division in a circuit. This pack of 5 potentiometers is ideal for prototyping and development of IoT projects. The 1K resistance value makes it suitable for use in a wide range of applications, from audio equipment to robotics and automation.
The 1K Preset Potentiometer has three pins:
Pin 1: Center wiper terminal (OUTPUT)
Pin 2: One end of the resistor element (VCC)
Pin 3: Other end of the resistor element (GND)
Resistance value: 1 k
Power rating: 0.25 W
Operating temperature range: -20C to 70C
Rotary angle: 300
### Example 1: Analog Voltage Divider with Arduino
In this example, we'll use the 1K Preset Potentiometer to create an analog voltage divider with an Arduino board. The potentiometer will be used to divide the input voltage and output a varying voltage level to an analog input pin on the Arduino.
```c
const int sensorPin = A0; // Analog input pin on Arduino
int sensorValue = 0; // Variable to store sensor value
void setup() {
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin);
float voltage = sensorValue (5.0 / 1023.0);
Serial.print("Voltage: ");
Serial.print(voltage);
Serial.println(" V");
delay(500);
}
```
Connect Pin 1 (center wiper terminal) of the potentiometer to Analog Input Pin A0 on the Arduino board.
Connect Pin 2 (VCC) to the 5V pin on the Arduino board.
Connect Pin 3 (GND) to the GND pin on the Arduino board.
### Example 2: Control Motor Speed with Raspberry Pi
In this example, we'll use the 1K Preset Potentiometer to control the speed of a DC motor using a Raspberry Pi. The potentiometer will be connected to an analog-to-digital converter (ADC) and the Raspberry Pi will read the voltage value to adjust the motor speed.
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Define motor control pins
motor@Enable = 18
motorDir = 23
# Set up motor control pins as outputs
GPIO.setup(motorEnable, GPIO.OUT)
GPIO.setup(motorDir, GPIO.OUT)
# Set up ADC pin for potentiometer
potPin = 17
try:
while True:
# Read analog value from potentiometer
potValue = read_adc(potPin)
# Calculate motor speed based on potValue
motorSpeed = int((potValue / 1023.0) 100)
# Set motor speed and direction
GPIO.output(motorEnable, GPIO.HIGH)
GPIO.output(motorDir, GPIO.HIGH if motorSpeed > 50 else GPIO.LOW)
time.sleep(0.01)
except KeyboardInterrupt:
GPIO.cleanup()
```
Connect Pin 1 (center wiper terminal) of the potentiometer to ADC Pin 17 on the Raspberry Pi.
Connect Pin 2 (VCC) to the 3.3V pin on the Raspberry Pi.
Connect Pin 3 (GND) to the GND pin on the Raspberry Pi.
Connect the motor control pins to the Raspberry Pi and motor driver IC as per the motor driver's datasheet.
Note: The above code examples assume a basic understanding of the respective microcontrollers and programming languages. You may need to modify the code to suit your specific project requirements.