Robojax

Using TTP223B touch module and relay to control AC/DC load with Arduino

دروس آردوینو به فارسی

TTP223B Capacitive Touch with Relay and AC load code

This video shows you how to turn AC load like bulb ON and off using TTP223B touch module with a relay. This demonstration and code will shows how to use it with Arduino and without arduino. You will also learn how to connect if your relay is different. The last section of the video shows you how to control the time, the AC bulb or load is ON. download the code and datasheet: http://robojax.com/learn/arduino/
  1. download TTP223B Capacitive Touch Manual
  2. 
     /*
     * This is the Arduino code for TTP223B  Capacitive Touch switch with relay
     * the output pen 10 is connected to relay 
     * by touching the touch pad TTP223B or TTP223N-BA6 the relay will be turned ON
    
     * 
     * Written by Ahmad Nejrabi for Roboja Video
     * Date: Dec 04, 2017, in Ajax, Ontario, Canada
     * Permission granted to share this code given that this
     * note is kept with the code.
     * Disclaimer: this code is "AS IS" and for educational purpose only.
     * 
     */
    
    
     int LD = 200; // Loop Delay. Controls how long after release the bulb is ON
    
    void setup() {
        Serial.begin(9600);
        // out pins
        pinMode(10, OUTPUT);// LED for button 1
              
    
        // input pins
        pinMode(2, INPUT);// Button 1 input pin 2  
               
    
    
        Serial.println("Robojax Test: TTP223B touch");
    
    }
    
    void loop() {
    
        // button 1 action
        if(digitalRead(2)){
          Serial.println("Button Touched "); 
          digitalWrite(10, LOW); // Turn the LED ON     
          delay(LD); 
        }else{
          digitalWrite(10, HIGH);// Turn OFF the LED
        }
    
    
    }// loop