(DKHK100200)Lesson9-Touch Sensor module for arduino
We need Switch to control electronics or electrical appliances or some thing, Some time electrical switches will give a shock when we use electrical switches with wet hand and then touch to control electrical or electronic load is much interactive than ordinary switches, may be some projects needs touch switch.
In this lesson, we will show what is Digital Touch Sensor Module and how to use it with the Arduino board.
Arduino IDE (version 1.6.4+)
-Control Interface : A total of three pins (GND, VCC, SIG), GND to ground , VCC is the power supply , SIG digital signal output pin ;
-Power Indicator : Green LED, power on the right that is shiny ;
-Touch area : Similar to a fingerprint icon inside the area , you can touch the trigger finger .
-Positioning holes : 4 M2 screws positioning hole diameter is 2.2mm, the positioning of the module is easy to install , to achieve inter- module combination ;
TTP223 is 1 Key Touch pad detector IC, and it is suitable to detect capacitive element variations. It consumes very low power and the operating voltage is only between 2.0V~5.5V. The response time max about 60mS at fast mode, 220mS at low power mode @VDD=3V. Sensitivity can adjust by the capacitance(0~50pF) outside.
Connect Vcc pin of Sensor breakout board to Arduino’s +5V pin and GND to GND. Connect Signal (SIG) pin to Arduino Digital pin D2.
const int SensorPin = 2; // the number of the pushbutton pin const int ledPin = 13; // the number of the LED pin // variables will change: int SensorStatue = 0; // variable for reading the pushbutton status void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(SensorPin, INPUT); Serial.begin(9600); } void loop() { // read the state of the pushbutton value: SensorStatue = digitalRead(SensorPin); // check if the pushbutton is pressed. If it is, the SensorStatue is HIGH: if (SensorStatue == HIGH) { Serial.println("TOUCHED!"); digitalWrite(ledPin, HIGH); } else { Serial.println("Not Touched!"); // turn LED off: digitalWrite(ledPin, LOW); } }
You can also download above code from here:
https://osoyoo.com/driver/smarthome/touchsensor.zip
The sketch below provides an output to your serial monitor indicating whether or not the sensor is pressed.
After the uploader , if use finger or metal object touch the metal surface of the transducer , the red LED lights on the UNO will light. Open the Serial Monitor at baudrate 9600, and you will see something as below:
DownLoad Url osoyoo.com