Capacitive Touch Potentiometer (SUPER USEFUL)

by nbaddorf in Circuits > Arduino

229 Views, 1 Favorites, 0 Comments

Capacitive Touch Potentiometer (SUPER USEFUL)

IMG_3639.jpg

I got a look at my churches sound consel and it had really cool screens with potentiometers for adjusting settings. The coolest part was that when you touched the knob, the display changed to show that knobs settings. I wanted to recreate this so I came up with a super simple but effective way using the "Capacitive Sensor" arduino library.

This idea could lead to powerfull projects because the addition of one resistor is so little, but provides so many features.

You could have a small display that showes you detailed information when you touch a knob. There are loads of cool ideas.

Supplies

  • Potentiometer
  • 1M Ohm Resistor
  • Arduino
  • Wires

Make Sure You Have the "Capacitive Sensor" Library Installed

Connect the Resistor

IMG_3640.jpg

Connect one leg of the 1M Ohm resistor to pin 2, and the other leg to pin 4.

For this demo I will only be using 1 capacitive potentiometer, but if you want to use more capasitive sensors, add more 1M Ohm resistors with one leg connected to pin 4, and the other leg to an unused arduino pin.

Connect the Capacitive Touch Wire to the Potentiometer

IMG_3641.jpg

Here you need to connect a wire from pin 2 of the arduino to somewhere on the metal case of the potentiometer. For this test I used aligator clips.

Wire the Potentiometer to the Arduino

Wire the left pin of the potentiometer to ground, and the right pin to 5v. The center pin can be connected to A0.

Code

Here is the code. Copy this to a new Arduino sketch.

#include <CapacitiveSensor.h>

CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        //pin 2 is sensor pin, pin 4 is trigger pin
//CapacitiveSensor   cs_4_7 = CapacitiveSensor(4,7); //this would be if you wanted another sensor

void setup()                    
{
   cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF); 
   Serial.begin(115200);
}

void loop()                    
{
    long cap_value =  cs_4_2.capacitiveSensor(30);
   
    Serial.print(cap_value);                  // print sensor output 1
    Serial.print("\t");
    Serial.print(analogRead(A0));
    Serial.println("\t");

    delay(10);                             // arbitrary delay to limit data to serial port 
}

Upload the Code and Enjoy

Here is the basic code. Open the serial monitor, and on the left you see the values coming from the capacitive sensor. On the right you get the potentiometer value.


Eventually, I would like to buy some conductive 3d printing filament so I can make my own knobs.