Lesson 24 Touch Switch

Share for us

Introduction

A touch sensor operate with the conductivity of human body. When you touch the metal on the base electrode of the transistor, the level of pin SIG will turn over.

Required Components

 1 * Raspberry Pi

– 1 * Breadboard

– 1 * Touch sensor module

– 1 * Dual-Color LED module

– 2 * 3-Pin anti-reverse cable

Experimental Principle

In this experiment, touch the base electrode of the transistor by fingers to make it conduct as human body itself is a kind of conductor and an antenna that can receive electromagnetic waves in the air. These electromagnetic wave signals collected from the human body are amplified by the transistor and processed by the comparator on the module to output steady signals. The schematic diagram:

Experimental Procedures

Step 1: Build the circuit.

Raspberry PiGPIO Extension BoardTouch Sensor Module
GPIO0GPIO17SIG
3.3V3V3VCC
GNDGNDGND
Raspberry PiGPIO Extension BoardDual-Color LED Module
GPIO1GPIO18R
GNDGNDGND
GPIO2GPIO27G

For C Users:

Step 2: Change directory. 

    cd /home/pi/SunFounder_SensorKit_for_RPi2/C/24_touch_switch/

Step 3: Compile.

    gcc touch_switch.c -lwiringPi

Step 4: Run.

    sudo ./a.out

For Python Users:

Step 2: Change directory. 

    cd /home/pi/SunFounder_SensorKit_for_RPi2/Python/

Step 3: Run.

    sudo python3 24_touch_switch.py

Now, touch the metal disk, you can see the LED change its colors and “ON” and “OFF” printed on the screen.