Connecting TTP223B Touch Module to Esp8266

In the realm of DIY electronics, adding touch-sensitive controls to your projects can elevate functionality and user experience. One such component, the TTP223B touch module, offers a simple and effective way to incorporate touch sensing into your projects. In this guide, we’ll walk through the process of connecting a TTP223B touch module to a Wemos D1 Mini, a popular and versatile microcontroller board based on the ESP8266.

Understanding the Components

TTP223B Touch Module: This module is a capacitive touch sensor module based on a touch detection IC (TTP223B). It requires minimal external components and offers stable and reliable touch detection.

Wemos D1 Mini: The Wemos D1 Mini is a small yet powerful microcontroller board based on the ESP8266 chipset. It comes with built-in Wi-Fi capabilities, making it ideal for IoT projects and rapid prototyping.

Components Needed

  1. ESP8266 Development Board (such as NodeMCU) (Affiliate) –
  2. TTP223B Touch Module (Affiliate) –
  3. Breadboard and jumper wires (Affiliate) –

Wiring Diagram

Before we start connecting the components, let’s understand the pinouts of both the TTP223B module and the Wemos D1 Mini:

TTP223B Module Pinout:



  • VCC: Power supply (3.3V – 5V)
  • GND: Ground
  • OUT: Digital output signal (HIGH when touched, LOW when not touched)

Wemos D1 Mini Pinout:



  • 3V3: 3.3V power output
  • GND: Ground
  • D1 (GPIO5): Digital pin for data transmission (can be changed if needed)

Wiring Instructions:

  1. Connect the VCC pin of the TTP223B module to the 3V3 pin of the Wemos D1 Mini.
  2. Connect the GND pin of the TTP223B module to any GND pin on the Wemos D1 Mini.
  3. Connect the OUT pin of the TTP223B module to the D1 (GPIO5) pin of the Wemos D1 Mini.




Code Implementation


// Define the pin for the touch module
const int touchPin = D1; // D1 (GPIO5) pin on Wemos D1 Mini

void setup() {
  // Initialize Serial communication for debugging

  // Set the touch pin as input
  pinMode(touchPin, INPUT);

void loop() {
  // Read the state of the touch pin
  int touchState = digitalRead(touchPin);

  // Print the touch state (1 for touched, 0 for not touched)

  // Add a small delay to avoid flooding the Serial monitor


Testing the Setup

  1. Connect your Wemos D1 Mini to your computer via USB.
  2. Open the Arduino IDE and paste the above code into a new sketch.
  3. Select the correct board (Wemos D1 Mini) and COM port from the Tools menu.
  4. Upload the sketch to your Wemos D1 Mini.
  5. Open the Serial Monitor (Tools > Serial Monitor) to view the output.




You’ve successfully connected a TTP223B touch module to a Wemos D1 Mini and tested its functionality using a simple Arduino sketch. From here, you can integrate touch sensing into your projects, whether it’s controlling LEDs, triggering actions, or any other creative application.