Hackster will be offline on Monday, June 15 from 5pm to 7pm PDT to perform some scheduled maintenance.
Arnov Sharma
Published © LGPL

Capacitive Touch Arduino WITHOUT using TTP223 sensor

Turn an LED high or low with your body capacitance. (with simple RC circuit)

BeginnerFull instructions provided9 minutes6,608

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Resistor 1M ohm
Resistor 1M ohm
×1
Power MOSFET N-Channel
Power MOSFET N-Channel
×1
UTSOURCE Electronic Parts
UTSOURCE Electronic Parts
everything above can be found here for a low price
×1

Story

Read more

Schematics

sch

sch

Code

code

C/C++
#include <CapacitiveSensor.h>

CapacitiveSensor   cs_2_4 = CapacitiveSensor(2,4); // 1M resistor between pins 2 & 4, pin 4 is sensor pin, add a wire and or foil

int in = 2; 
int out = 4;  
int state = LOW;  
int r;           
int p = LOW;    
long time = 0;       
long debounce = 200;
void setup()
{
  pinMode(4, INPUT);
  pinMode(3, OUTPUT);
}
void loop()                    
{
 
  r = digitalRead(4);
  if (r == HIGH && p == LOW && millis() - time > debounce) {
    if (state == HIGH)
      state = LOW;
    else 
      state = HIGH;
    time = millis();    
  }
  digitalWrite(3, state);
  p = r;
}

Credits

Arnov Sharma
383 projects • 418 followers
I'm Arnov. I build, design, and experiment with tech—3D printing, PCB design, and retro consoles are my jam.

Comments