Grove Touch Sensor Features
This sensor uses TTP223-B IC. When your finger approaches this sensor, the capacitance of the metal surface will change. So you don’t need to touch sensor completely. Besides, you can put this sensor under a non-metallic surface and touch it. This sensor is waterproof, and it has a variety of applications.
Note
There are two red and black wire that have been connected to this sensor. If you want to increase the fingerprint sensitivity, you can remove the black wire.
You can download the datasheet of this module here.
Grove Touch Sensor Datasheet
Grove touch Sensor Pinout
This sensor has 26 pins. 5 pins are for connecting to microcontroller and 21 pins for communicating to fingerprint sensor.
- VCC: Module power supply – 3 to 5 V
- GND: Ground
- SDA: I2C interface
- SCL: I2C interface
- INT: Interrupt pin
You can see the pinout of this module in the image below.
Required Materials
Hardware Components
Software Apps
Interfacing Grove Touch Sensor with Arduino
Step 1: Circuit
The following circuit shows how you should connect Arduino to this sensor. Connect wires accordingly.
Step 2: Installing Library
Download the relevant library here and copy it to the library section where you have installed the Arduino.
Tip
If you need more help with installing a library on Arduino, read this tutorial: How to Install an Arduino Library
Step 3: Code
Upload the following code to Arduino.
/*
I2C-Multi-Touch-Sensor-Grove
modified on 18 oct 2020
by Amir Mohammad Shojaee @ Electropeak
Home
Based on wiki.seeedstudio.com Example
*/
#include <Wire.h> // include I2C library
#include <i2c_touch_sensor.h>
#include <MPR121.h>
// include our Grove I2C touch sensor library
// initialize the Grove I2C touch sensor
i2ctouchsensor touchsensor; // keep track of 4 pads' states
//boolean padTouched[4];
long previousMillis = 0;
long interval = 100;
void setup()
{
Serial.begin(9600); // for debugging
Serial.print("begin to init");
Wire.begin(); // needed by the GroveMultiTouch lib
touchsensor.initialize(); // initialize the feelers // initialize the containers
}
void loop()
{
unsigned char MPR_Query=0;
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval)
{
previousMillis = currentMillis;
touchsensor.getTouchState();
}
for (int i=0;i<12;i++)
{
if (touchsensor.touched&(1<<i))
{
Serial.print("pin ");
Serial.print(i);
Serial.println(" was touched");
delay(100);
}
}
}
This code uses I2C interface to communicate with Arduino. Also, If you touch each sensor, you will see the number of that sensor at the output. For this example, we have used 4 fingerprint sensors called 0 to 3.
The output is as follows. Touch sensor 0 to 3 respectively.