Touch Sensor Interfacing Raspberry Pi

 ðŸŸ¦ 1. Introduction

Touch sensors are modern input devices that detect human touch. In this project, we interface a capacitive touch sensor (TTP223) with Raspberry Pi to control an LED.


🟦 2. Components Required

  • Raspberry Pi
  • TTP223 Touch Sensor Module
  • LED
  • 220Ω Resistor
  • Breadboard
  • Jumper Wires

🟦 3. Circuit and Connections

Raspbery Pi
Raspberry Pi Pinout Diagram
TTP223 Touch Sensor Module Pinout Diagram
TTP223 Touch Sensor Module Pinout Diagram
🔌 Connections:

  • VCC → 3.3V (Pin 1)
  • GND → GND (Pin 6)
  • OUT → GPIO17 (Pin 11)
  • LED + → GPIO18 (Pin 12)
  • LED – → GND (via resistor)

🟦 4. Detailed Step-by-Step Working

  1. The touch sensor detects finger touch using capacitance.
  2. When touched, the OUT pin becomes HIGH.
  3. Raspberry Pi reads this signal through GPIO17.
  4. If HIGH → LED turns ON
  5. If not touched → LED OFF

🟦 5. Libraries to be Included

import RPi.GPIO as GPIO
import time

🟦 6. Python Program

import RPi.GPIO as GPIO
import time

sensor = 17
led = 18

GPIO.setmode(GPIO.BCM)
GPIO.setup(sensor, GPIO.IN)
GPIO.setup(led, GPIO.OUT)

while True:
if GPIO.input(sensor):
GPIO.output(led, True)
print("Touch Detected")
else:
GPIO.output(led, False)
time.sleep(0.1)

🟦 7. Output

  • When you touch the sensor → LED turns ON
  • When you release → LED turns OFF

🟦 8. Applications

  • Touch-controlled lights
  • Smart switches
  • Home automation
  • Security systems

🟦 9. Conclusion

Touch sensors provide a modern alternative to push buttons. This project helps beginners understand human-machine interaction using Raspberry Pi.

à´¤ുà´Ÿà´•്à´•à´•്à´•ാർക്à´•ാà´¯ുà´³്à´³ ഇലക്à´Ÿ്à´°ോà´£ിà´•്à´¸് ലളിതമാà´¯ി പഠിà´•്à´•ാം.

Empowering students in Kerala with hands-on technical skills.