HTTM Series Capacitive Touch Sensor Features
This touch module is available in different series with a variety of backlight colors. It features low price, high efficiency and long lifespan. The sensor part can also be placed on glass and thin plastic.
Its output is on trigger mode which works like a switch. That is, when it is touched, its will be HIGH and remains HIGH until the next touch.
The input voltage is 2.7 to 6 V and output pin voltage is 3.3 V.
You can download the datsheet of this module here.
HTTM Capacitive Touch Module Datasheet
HTTM Capacitive Touch Module Pinout
This Module has 3 pins:
- VCC: Module power supply – 2.7/ 6 V
- GND: Ground
- OUT: Digital output
You can see the pinout of this module on the first side in the image below.
Required Materials
Hardware Components
Software Apps
Note
You need to provide only one of these sensors.
Interfacing HTTM Capacitive Touch Module with Arduino
Step 1: Circuit
The following circuit shows how you should connect Arduino to this sensor. Connect wires accordingly.
Step 2: Code
Upload the following code to Arduino.
/*
HTTM-Series-Touch-Switch
made on 21 oct 2020
by Amir Mohammad Shojaee @ Electropeak
Home
*/
const int SENSOR_PIN = 2;
// Variables will change:
int lastState =LOW;
int currentState;
void setup() {
Serial.begin(9600);
// initialize the Arduino's pin as aninput
pinMode(SENSOR_PIN, INPUT);
}
void loop() {
// read the state of the the input pin:
currentState = digitalRead(SENSOR_PIN);
if(lastState == LOW && currentState == HIGH)
Serial.println("Sensor is ON");
if(lastState == HIGH && currentState == LOW)
Serial.println("Sensor is OFF");
// save the the last state
lastState = currentState;
}
If the digital output changes from LOW to HIGH (sensor turns on), “Sensor is ON” appears in Serial Monitor. And if the opposite happens and output changes from HIGH to LOW, “Sensor is OFF” appears.
The code output is as follows. If touched, turns on, and if touched again, turns off.