CJMCU-0201 Double Touch Sensor Features
A touch sensor is a type of switch that only has to be touched by an object to operate. Touch sensors work completely similar to a switch. This sensor has two separate pads and can be used as two separate switches.
Note
When this switch is subjected to touch, the output voltage will be HIGH, otherwise it 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.
Touch Switch Module Pinout
This Module has 4 pins:
- +: Module power supply – 3-5V
- -: Ground
- OUT1: Digital output for switch 1
- OUT2: Digital output for switch 2
You can see the pinout of this module in the image below.
Required Materials
Hardware Components
Software Apps
Interfacing CJMCU-0201 Double Touch Sensor with Arduino
Step 1: Circuit
The following circuit shows how you should connect Arduino to CJMCU-0201 module. Connect wires accordingly.
Step 2: Code
Upload the following code to Arduino. This code reads the switch state and it will appear on 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);
}
}
The output is as follows.