Need help with a simple touch sensing circuit

I’m trying to use this captouch library to make the D7 LED turn on and off with touch.

The circuit is just one 10M resistor between D3 and D6. I’m testing by touching the side of the resistor.

I’m using Arduino’s Serial Monitor to see what it’s reading. The values are all over the place and the events it’s reporting are totally inaccurate.

Is there a problem with the library I’m using? I’m not sure where to go from here…

#include <captouch.h>
#include "application.h"

#define pTouch	D3
#define pSense	D6
#define CAPTOUCH_DEBUG true

CapTouch Touch(pTouch, pSense);

void setup(){
        pinMode(D7, OUTPUT); 


void loop(){
        CapTouch::Event touchEvent = Touch.getEvent();

    if (touchEvent == CapTouch::TouchEvent) {
                	digitalWrite(D7, HIGH); // LED on

    } else if (touchEvent == CapTouch::ReleaseEvent) {
                	digitalWrite(D7, LOW);  // LED off


That’s not enought.
Here you can find a schematic to show how it should look like.

The search feature of this forum may have helped locate that link
This is where I found it via the search term: captouch.h

I would suggest you put a capacitive touch controller on the pin if you want to make your life easy. The controllers run calibration and will provide a clean output. You can pick up a single touch pad and controller on a little PCB for $1 or less.


Thanks for the help! I think going the easy route and getting a capacitive touch breakout board is the right solution for me.

1 Like