Touch Switch Module Features
A touch sensor is a type of switch that needs to be touched by an object to operate. Touch sensors work completely similar to a switch.
Note
When this switch is touched, the output voltage will be HIGH, otherwise is LOW.
Note
The output current is very low (about 40 mA). If you want to connect a higher current device to this switch, you must add a relay or transistor to your circuit.
Note
There is a jumper on the board. If you change the status of the jumper, the output voltage level will reverse. That is, when the sensor is touched, the output will be LOW.
Touch Switch Module Pinout
This Module has 3 pins:
- VCC: Module power supply – 3-5V
- OUT: Digital output
- GND: Ground
You can see the pinout of this module in the image below.
Required Materials
Hardware Components
Software Apps
Interfacing Touch Switch Module with Arduino
Step 1: Circuit
The following circuit shows how you should connect Arduino to this module. Connect wires accordingly.
Step 2: Code
Upload the following code to Arduino. This code reads the status of the switch and displays it on the serial monitor.
/*
Touch Sensor
modified on 26 Oct 2020
by Mohammad Reza Akbari @ Electropeak
Home
*/
void setup() {
pinMode(2, INPUT);
Serial.begin(9600);
}
void loop() {
if (digitalRead(2) == HIGH) {
Serial.println("You touched me!");
delay(750);
}
de }
When the sensor is touched, the output is as follows.