Categories

Follow

Wemos Mini and a TTP223 Capacitive Touch Sensor

In this example we will connect a TTP223 Capacitive Touch Sensor to our Wemos Mini. The TTP223 is a touch pad detector IC which offers 1 touch key.

ttp223

 

 

Connection

The TTP223 Capacitive Touch Sensor has to be connected to Wemos Mini as follows:

Vcc to 3v3
Gnd to Gnd
SIG to digital pin 0

 

Code

#define touchPin D0 // Pin for capactitive touch sensor
 
void setup() 
{
  Serial.begin(9600); 
  pinMode(touchPin, INPUT);
}
 
void loop() 
{
  int touchValue = digitalRead(touchPin);
  if (touchValue == HIGH)
  {
    Serial.println("TOUCHED");
  }
  else
  {
    Serial.println("not touched");
  } 
  delay(500);
 
}

 

Testing

Open the serial monitor and touch the sensor

not touched
not touched
TOUCHED
TOUCHED
TOUCHED
not touched
not touched
TOUCHED
TOUCHED
not touched
not touched

 

Links

TTP223 Capacitive Touch Sensor Switch Digital Touch Module For Arduino

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  

  

  

*