TTP224 4-Channel Touch Sensor to Turn AC/DC Loads with Relay

TTP224 4-Channel Touch Sensor to Turn AC/DC Loads with Relay

The TTP224 capacitive touch module is a versatile component that allows users to control AC and DC loads (like light, fan, motor) through touch inputs. In this tutorial, we will demonstrate how to connect the TTP224 to an Arduino to operate a relay, which can switch your lights or other devices on and off with just a touch. By the end of this guide, you will have a fully functional touch-sensitive control system for your electrical devices. For a visual walkthrough, be sure to check out the video (in video at 00:00).
TTP224 touch module

Hardware Explained

The main components used in this project include the TTP224 capacitive touch module, an Arduino board, and a relay module. The TTP224 module detects touch through capacitive sensing, meaning it can register a touch by measuring changes in capacitance when a finger is placed near its pads. This module has four outputs that correspond to four different touch inputs, allowing you to control multiple devices. The relay module acts as a switch that can control high voltage AC loads safely. The relay used in this tutorial is LOW-Level triggered meaning when signal at the input of relay module is LOW,the relay turns ON and when signal is HIGH, the relay turns OFF. When the relay is activated, it connects the common terminal to the normally open terminal, allowing current to flow to the connected device. The relay is controlled by the Arduino, which reads the outputs from the TTP224 and activates the relay accordingly.

Datasheet Details

ManufacturerVishay
Part numberTTP224
Logic/IO voltage2.2 – 5.5 V
Output current (per channel)10 mA (max)
Input logic thresholds0.3 V (low), 0.7 V (high)
Package16-pin DIP
Notes / variantsFour touch channels

  • Ensure the module is powered within 2.2 – 5.5 V for proper operation.
  • Monitor the output current to avoid exceeding 10 mA per channel.
  • Use decoupling capacitors near the module to filter power supply noise.
  • Keep wiring short to reduce interference and improve signal quality.
  • Use pull-down resistors on the input pins if not using Arduino for control.

Wiring Instructions

Arduino wiring for  TTP224 Touch with 4 Channel relay
Arduino wiring for TTP224 Touch with 4 Channel relay
To wire the TTP224 touch module and relay to the Arduino, start by connecting the power. Connect the VCC pin of the TTP224 to the 5V output of the Arduino, and connect the GND pin to the Arduino's ground. Next, connect the four output pins of the TTP224 (labeled as OUT1, OUT2, OUT3, OUT4) to the digital pins on the Arduino. For example, connect OUT1 to pin 2, OUT2 to pin 3, OUT3 to pin 4, and OUT4 to pin 5. For the relay, connect its VCC pin to the 5V output of the Arduino and the GND pin to ground. The control pin of the relay should be connected to pin 10 on the Arduino. Ensure that one of the relay’s common terminals is connected to the AC or DC load, while the normally open (NO) terminal connects to the power source. If you want the relay to turn on when a touch is detected, you will connect it to the common terminal and the NO terminal will connect to the load.

Code Examples & Walkthrough

The Arduino code begins by setting up the output pins for the relay and the input pins for the touch sensors. The code initializes the serial communication for debugging as well.
void setup() {
    Serial.begin(9600);
    pinMode(10, OUTPUT); // LED for button 1
    pinMode(11, OUTPUT); // LED for button 2
    pinMode(12, OUTPUT); // LED for button 3
    pinMode(13, OUTPUT); // LED for button 4            
    pinMode(2, INPUT); // Button 1 input pin 2  
    pinMode(3, INPUT); // Button 2 input pin 3  
    pinMode(4, INPUT); // Button 3 input pin 4  
    pinMode(5, INPUT); // Button 4 input pin 5              
}
This setup function configures the pins for the touch sensors and relay outputs. It initializes the serial monitor to track button presses. The loop function continually checks the state of each touch sensor. When a button is pressed, it turns on the corresponding relay output and prints a message to the serial monitor.
void loop() {
    if(digitalRead(2)){
      Serial.println("Button 1 Touched "); 
      digitalWrite(10, LOW); // Turn the LED ON     
    } else {
      digitalWrite(10, HIGH); // Turn OFF the LED
    }
    // Similar checks for buttons 2, 3, and 4...
}
This loop reads the state of each button and activates the corresponding relay pin. If button 1 is pressed, the message "Button 1 Touched" is printed, and the relay connected to pin 10 is activated. Finally, to modify how long the relay stays activated, you can easily change the delay value in the code. This allows for more flexibility in how you control your devices.

Demonstration / What to Expect

When powered on, the system will allow you to control the connected load by touching the respective pads on the TTP224. For instance, touching pad one will turn on the relay connected to pin 10, which can power your light 💡. If you release the touch, the light 💡 will turn off (in video at 03:00). Be cautious about the wiring; ensure the relay is connected correctly to prevent any short circuits or damage to your devices. If the relay does not activate as expected, check all connections and verify that the Arduino code matches the intended pin configuration.

Video Timestamps

  • 00:00 - Introduction
  • 01:30 - Hardware Setup
  • 03:00 - Code Overview
  • 04:30 - Demonstration
4 Channel 5V relay module - top view

Bilder

TTP224 touch module
TTP224 touch module
Arduino wiring for  TTP224 Touch with 4 Channel relay
Arduino wiring for TTP224 Touch with 4 Channel relay
4 Channel 5V relay module - bottom view
4 Channel 5V relay module - bottom view
4 Channel 5V relay module - top view
4 Channel 5V relay module - top view
20-TTP224 4-Channel Capacitive Touch Arduino with Relay Code
Sprache: C++
Kopiert!

Ressourcen & Referenzen

Noch keine Ressourcen vorhanden.

Dateien📁

Datenblatt (pdf)