In this tutorial to interface the Capacitive Touch buttons module with ESP8266 12E Node MCU and an example we Connect a LCD display. The TTP224 module it has 4 pins for the different outputs, they are digital, and for the power it can be powered by 3.3V or 5V from the Arduino. The module has 4 built-in LEDs, they light up whenever the respective button is touched
The TTP224 touch controller is the exact non-contact alternative to traditional button switches.
Components Required
TTP224 Capacitive Touch Module
ESP8266 12E
LCD 16X2 with I2c Module
TTP224
TTP224 is a four-channel touch detector IC that could be used as a 4-touch key driver. It is a useful interface when replaced with a traditional button key. It has a low power consumption with a wide range of operating voltage.
TTP224 has an auto-calibration feature for life and it has a re-calibration period of about 4.0 seconds. The sensitivity can be adjusted using an external capacitor of 0 to 50 pF, 4 input features fewer component counts during the integration in the system.
Features and Specification of TTP224
Four-channel touch key sensing
2.5V - 5.5V Operating Voltage
Operating current 2.5uA typically in low power mode. Maximum operating current 9.0uA at Fast mode.
Response time - 100ms at fast mode and 200ms at low power mode.
Adjustable sensitivity using an external capacitor (0-50 pF)
Stable touch detection of the human body
All output modes can be configurable for high or active low by pad options.
Direct mode and Toggle mode selection pin available
Auro calibration feature for life. The re-calibration period is about 4.0sec when the key has not been touch.
Provides one output pin TPQ0D that has no diode protection circuit inbuilt and it is active low
Provides fast mode and low power mode selection by pad optional (LPMB pin).
Provides direct mode or toggle mode, CMOS output, or open-drain output. active high or active low by option (TOG/AHLF/OD pin).
Circuit Connection
TTP224 out1 to out4 Pins are interfaced with D5 through D8 of NodeMCU
TTP224 VCC Pin are interfaced with Vin of NodeMCU.
TTP224 GND Pin are interfaced with GND of NodeMCU
LCD VCC Pin are interfaced with Vin of NodeMCU.
LCD GND Pin are interfaced with GND of NodeMCU
LCD SCL Pin are interfaced with D1 of NodeMCU.
LCD SDA Pin are interfaced with D2 of NodeMCU.
Subscribe and Download code.
arduino code
//WWW.DOFBOT.COM
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
void setup() {
Serial.begin(9600);
// input pins
pinMode(14, INPUT); // TTP224 out1
pinMode(12, INPUT); // TTP224 out2
pinMode(13, INPUT); // TTP224 out3
pinMode(15, INPUT); // TTP224 out4
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(0,0);
lcd.print(" TTP224 Module ");
}
void loop() {
if(digitalRead(14)){
Serial.println("LED D1 ON"); // Turn the LED ON
lcd.setCursor(0,1);
lcd.print(" KEY1 Touched ");
}else{
Serial.println("LED D1 OFF");
}
// button 2 action
if(digitalRead(12)){
Serial.println("LED D2 ON"); // Turn the LED ON
lcd.setCursor(0,1);
lcd.print(" KEY2 Touched ");
}else{
Serial.println("LED D2 OFF");
}
if(digitalRead(13)){
Serial.println("LED D3 ON"); // Turn the LED ON
lcd.setCursor(0,1);
lcd.print(" KEY3 Touched ");
}else{
Serial.println("LED D3 OFF");
}
if(digitalRead(15)){
Serial.println("LED D4 ON"); // Turn the LED ON
lcd.setCursor(0,1);
lcd.print(" KEY4 Touched ");
}else{
Serial.println("LED D4 OFF");
}
}
Good work