कला
सौंदर्य और कल्याण
हस्तशिल्प
संस्कृति और इतिहास
मनोरंजन
पर्यावरण
खाद्य और पेय
हरित भविष्य
रिवर्स इंजीनियरिंग
विज्ञान
खेल
प्रौद्योगिकी
पहनने योग्य
Reading a Soft Potentiometer — SIK Circuit 10
Ed

द्वारा बनाया गया

Ed

17. March 2026

Reading a Soft Potentiometer — SIK Circuit 10

Use a soft potentiometer (touch strip) to control RGB LED color. Slide your finger along the strip to smoothly transition through the color spectrum.

निर्देश

1

Parts & Introduction

A soft potentiometer is a thin, flexible strip that acts as a variable resistor based on where you press. Combined with an RGB LED, you can create an intuitive color picker — slide your finger to change colors!

Parts Needed

  • 1x Arduino Uno + USB cable
  • 1x Breadboard
  • 1x Soft Potentiometer
  • 1x RGB LED (Common Cathode)
  • 3x 330Ω Resistors
  • 1x 10KΩ Resistor (pull-down)
  • 9x Jumper Wires
2

Hardware Hookup

Wiring Instructions

Soft Potentiometer
  1. Connect the middle pin to Analog Pin A0.
  2. Connect one side pin to 5V.
  3. Connect the other side pin to GND.
  4. Add a 10K pull-down resistor from Analog Pin A0 to GND.
RGB LED (pin order from flat edge: Red, GND, Green, Blue)
  1. Connect Red through 330Ω resistor to Pin 9.
  2. Connect GND (longest pin) to GND rail.
  3. Connect Green through 330Ω resistor to Pin 10.
  4. Connect Blue through 330Ω resistor to Pin 11.
3

Arduino Code

Open the Arduino IDE and upload the following sketch to your Arduino board.

soft_potentiometer.inoarduino
/*
SparkFun Inventor's Kit
Example sketch 10 — SOFT POTENTIOMETER

Use the soft potentiometer to change the color of the RGB LED.

Hardware connections:
  Soft pot: middle pin to analog 0, one side to 5V, other to GND
  10K resistor from analog 0 to GND
  RGB LED: RED->330ohm->pin 9, COMMON->GND, GREEN->330ohm->pin 10, BLUE->330ohm->pin 11

This code is completely free for any use.
*/

const int RED_LED_PIN = 9;
const int GREEN_LED_PIN = 10;
const int BLUE_LED_PIN = 11;

const int SENSOR_PIN = 0;

int redValue, greenValue, blueValue;

void setup()
{
  // No setup needed
}

void loop()
{
  int sensorValue;
  sensorValue = analogRead(SENSOR_PIN);
  setRGB(sensorValue);
}

void setRGB(int RGBposition)
{
  int mapRGB1, mapRGB2, constrained1, constrained2;

  // Red peak, centered at 0
  mapRGB1 = map(RGBposition, 0, 341, 255, 0);
  constrained1 = constrain(mapRGB1, 0, 255);
  mapRGB2 = map(RGBposition, 682, 1023, 0, 255);
  constrained2 = constrain(mapRGB2, 0, 255);
  redValue = constrained1 + constrained2;

  // Green peak, centered at 341
  greenValue = constrain(map(RGBposition, 0, 341, 0, 255), 0, 255)
             - constrain(map(RGBposition, 341, 682, 0, 255), 0, 255);

  // Blue peak, centered at 682
  blueValue = constrain(map(RGBposition, 341, 682, 0, 255), 0, 255)
            - constrain(map(RGBposition, 682, 1023, 0, 255), 0, 255);

  analogWrite(RED_LED_PIN, redValue);
  analogWrite(GREEN_LED_PIN, greenValue);
  analogWrite(BLUE_LED_PIN, blueValue);
}
4

Test & Experiment

What You Should See

The RGB LED changes color as you slide your finger along the soft potentiometer strip. The color smoothly transitions through the spectrum: red → green → blue → red.

Troubleshooting

  • LED dark or wrong color: Four pins close together are easy to misplace. Verify each RGB LED connection.
  • Bizarre color jumps: Pressing the soft pot in multiple spots simultaneously gives unpredictable results. Use one finger.

Experiments to Try

  • Add Serial output to see the raw sensor values as you slide.
  • Map the soft pot to servo position instead of color.

सामग्री

  • SparkFun Inventor's Kit - V3.2 - 1 kitNOK 999.20
    देखें
  • Arduino Uno R3 - 1 pieceप्लेसहोल्डर
    देखें
  • Breadboard - 1 pieceप्लेसहोल्डर
    देखें
  • Soft Potentiometer - 1 pieceप्लेसहोल्डर
    देखें
  • RGB LED (Common Cathode) - 1 pieceप्लेसहोल्डर
    देखें
  • 330 Ohm Resistor - 3 piecessNOK 24.00
    देखें
  • 10K Ohm Resistor - 1 pieceNOK 24.00
    देखें
  • Jumper Wires - 9 piecessNOK 39.20
    देखें

आवश्यक उपकरण

  • Computer with Arduino IDE

CC0 पब्लिक डोमेन

यह ब्लूप्रिंट CC0 के तहत जारी किया गया है। आप बिना अनुमति माँगे इस कार्य को किसी भी उद्देश्य के लिए कॉपी, संशोधित, वितरित और उपयोग करने के लिए स्वतंत्र हैं।

उनके ब्लूप्रिंट के माध्यम से उत्पाद खरीदकर मेकर का समर्थन करें जहाँ वे मेकर कमीशन कमाते हैं जो विक्रेताओं द्वारा निर्धारित होता है, या इस ब्लूप्रिंट का नया संस्करण बनाएँ और राजस्व साझा करने के लिए इसे अपने ब्लूप्रिंट में कनेक्शन के रूप में शामिल करें।

चर्चा

(0)

लॉग इन करें चर्चा में शामिल होने के लिए

टिप्पणियाँ लोड हो रही हैं...