Touch Sensor Light Switch
Components
• Arduino
• Joystick module (with X, Y analog output)
• 2 LEDs
• 2 resistors
• Breadboard and jumper wires
Connection
Component Arduino Pin
TTP223 VCC 5V
TTP223 GND GND
TTP223 OUT D2
LED Anode D9 (via 220Ω resistor)
LED Cathode GND
Working Principle
• Moving the joystick left/right controls one
LED; up/down controls the other.
• The joystick outputs analog values that the
Arduino reads using analogRead().
Code
const int touchPin = 2;
const int ledPin = 9;
bool ledState = false;
void setup() {
pinMode(touchPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
static bool lastTouch = LOW;
bool currentTouch =
digitalRead(touchPin);
if (currentTouch == HIGH &&
lastTouch == LOW) {
ledState = !ledState;
digitalWrite(ledPin, ledState);
delay(300); // Debounce delay
}
lastTouch = currentTouch;
}
Circuit Diagram
Outcome
• Understanding analog signals
• Mapping analog input to output action
• Basic control interface
Application
• Touch-based night lamps
• DIY smart switches
• Interactive exhibits
• No-contact switches for hygiene purposes

Touch Sensor Light Switch using Arduino .pptx

  • 1.
  • 2.
    Components • Arduino • Joystickmodule (with X, Y analog output) • 2 LEDs • 2 resistors • Breadboard and jumper wires
  • 3.
    Connection Component Arduino Pin TTP223VCC 5V TTP223 GND GND TTP223 OUT D2 LED Anode D9 (via 220Ω resistor) LED Cathode GND
  • 4.
    Working Principle • Movingthe joystick left/right controls one LED; up/down controls the other. • The joystick outputs analog values that the Arduino reads using analogRead().
  • 5.
    Code const int touchPin= 2; const int ledPin = 9; bool ledState = false; void setup() { pinMode(touchPin, INPUT); pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop() { static bool lastTouch = LOW; bool currentTouch = digitalRead(touchPin); if (currentTouch == HIGH && lastTouch == LOW) { ledState = !ledState; digitalWrite(ledPin, ledState); delay(300); // Debounce delay } lastTouch = currentTouch; }
  • 6.
  • 7.
    Outcome • Understanding analogsignals • Mapping analog input to output action • Basic control interface
  • 8.
    Application • Touch-based nightlamps • DIY smart switches • Interactive exhibits • No-contact switches for hygiene purposes