TOUCH SENSOR

 TOUCH SENSOR

                              A touch sensor is a type of equipment that captures and records physical touch or embrace on devices and objects. It enables a device or object to detect touch, typically by a human user or operator. A touch sensor may also be called a touch detector. Touch switches can be there at homes to operate (ON/OFF) the home appliances.We can interface touch sensor with Arduino to sense the touching.
 


Application:

  • It can be used as Light switches for computers and peripherals.
  • It can be used in Home appliances for Door-lock systems.
  • It is used in Game consoles and toys  in Industrial control.

Sample Project With Arduino:

                           In this we can turn ON/OFF the any appliances using relay whenever the physical touch is sensed in the touch sensor.

Materials required:

  • ARDUINO UNO Board
  • Touch Sensor
  • Relay
  • Bulb

Circuit:



Code:

#define TouchSensor 9   // defining touch sensor in pin 9

int relay = 2;   // initializing relay in pin 2

boolean currentState = LOW;  //initializing current state of touch sensor as LOW

boolean lastState = LOW;  //initializing last state of the touch sensor as also LOW

boolean RelayState = LOW;  //initializing state of the relay as LOW

 void setup() {

  Serial.begin(9600);  // enabling serial communication

  pinMode(relay, OUTPUT);  //defining relay as output

  pinMode(TouchSensor, INPUT);  //defining touch sensor as input

}

void loop() {

  currentState = digitalRead(TouchSensor);  // Read the sensor state and store it in a variable

 if (currentState == HIGH && lastState == LOW)   //Checking the current & last state of the sensor

    {

    Serial.println("pressed");  //if the condition is true, print on serial monitor

    delay(1);

if (RelayState == HIGH)  //Checking condition for state of the relay to be high

{

digitalWrite(relay, LOW);  // writing value LOW to relay

RelayState = LOW;  //now the relaystate is turns LOW

    }

    else

    {

      digitalWrite(relay, HIGH);  // if the condition is not true, write value HIGH to relay

      RelayState = HIGH;  // now the relay state turns HIGH

    }

  }

  lastState = currentState;  // store the current state value as the last state value

}


Comments

Popular posts from this blog

Voice Record & Playback Module

GSM Sim800L

GPS