October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk13 min

How to Wire a TTP223 Touch Sensor to an Arduino

Connect a typical TTP223 breakout’s supply, ground, and signal to an Arduino, then read its touch state with a simple digital-input sketch.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a typical three-pin TTP223 touch-sensor breakout, connect VCC or VIN to a supported supply pin, GND to Arduino GND, and SIG, OUT, or I/O to a digital input such as D2. In the common Uno example, that means 5 V, GND, and D2. Check the labels and jumper configuration on your particular board before powering it: breakout layouts and settings vary.

The basic circuit is simple: the module receives power, shares a ground reference with the Arduino, and sends a digital output that the sketch can read. The main details to verify are the module’s pin labels, supported supply, and output mode. The common default is momentary active-HIGH, but some boards can be configured differently.

As an Amazon Associate I earn from qualifying purchases.

Connections for a typical three-pin module

Use these connections as a starting point for a standard TTP223/TTP223B breakout. The signal pin is a digital output for the Arduino to read; it is not a supply pin. Connect the module’s supply and ground first, then connect its output to a digital input.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
TTP223 module pin Arduino connection Purpose
VCC or VIN A supply pin supported by the breakout; 5 V in the common Uno example Powers the module
GND GND Shared electrical reference
SIG, OUT, or I/O A digital input, such as D2 Carries the touch-state output for the Arduino to read

D2 is only an example: use another available digital input by changing both the wire and the pin number in the sketch. The ShillehTek module manual describes this three-connection arrangement and the common Uno example; it does not establish one pin order for every breakout sold as TTP223B.

#1 Best Overall
5PCS TTP223 Capacitive Touch Switch Module TTP223B Digital Touch Sensor Module Capacitive Touch Sensor Switch
  • Capacitive type touch switch module The module is based on a touch detection IC (TTP223B)'s. Under normal conditions, the module output low, low-power mode to mode; touch of a finger when the corresponding position, the module will output high, the mode is switched to fast mode; when for 12 seconds without touching, the mode and switch to low power mode.
  • For Jog type: the initial state is low, high touch, do not touch is low (similar touch of a button feature)
  • Power supply for 2 ~ 5.5V DC
  • Control Interface: A total of three pins (GND, VCC, SIG), GND to ground, VCC is the power supply, SIG digital signal output pin;
  • Power Indicator: Green LED, power on the right that is shiny;

Think of the three wires by their jobs rather than by where they sit on the board. VCC or VIN supplies the breakout, GND provides the shared reference, and SIG/OUT/I/O is the information line that changes state. A module can have the same three functions as another module while arranging the connector differently, so identify each label before matching it to an Arduino header.

For the common Uno example, the connection map is:

  1. Module VCC or VIN → Arduino 5 V. This is the example supply connection for the Uno setup, provided the particular breakout supports it.
  2. Module GND → Arduino GND. The two boards need a shared ground for the Arduino to read the module’s output in context.
  3. Module SIG, OUT, or I/O → Arduino D2. D2 is the selected digital input in the sample sketches below.

Do not treat the pin names or their physical order as universal. If a board’s labels differ from an illustration or listing, follow the documentation for the board in hand. The common connection pattern explains the functions, while the module documentation determines which physical pad performs each function.

Before you connect power

  1. Read the board labels. Find the power, ground, and signal labels printed on your module. Do not assume their physical order matches another board or a product photo.
  2. Check the board’s supply requirements. Tontek Design Technology Ltd. specifies a 2.0–5.5 V operating supply range for the TTP223-BA6 controller. That is the controller specification, not a guarantee that every breakout has the same circuitry or accepts every voltage in that range. Follow the documentation for your actual breakout.
  3. Check any solder jumpers. Some boards have back-side solder jumpers that alter output mode or polarity. Their pad positions and labels are not universal, so use the instructions for your specific board rather than copying a jumper pattern from a different module.
  4. Make the three connections with power off. Connect module ground to Arduino ground, then connect the supply and signal pins. Confirm the signal wire goes to the digital pin selected in your sketch.

The TTP223-BA6 controller’s 2.0–5.5 V range is useful context when choosing a supply, but it is not a blanket promise for every TTP223 breakout. A board may include other circuitry, and its own specifications govern the board-level connection. In other words, distinguish the controller’s stated operating range from the allowable input for the assembled module you purchased.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a compatible breakout used with a 3.3 V logic board, powering it from 3.3 V keeps the signal at the supply level. Confirm that the breakout supports that supply and that it suits your controller’s input requirements before connecting it. The controller’s 2.0–5.5 V specification alone does not verify the limits of the complete breakout.

Before applying power, compare your wiring with the labels one last time. The supply wire should go to the module’s documented supply connection, the ground wire to GND, and the signal wire to the pin you intend the code to read. This quick check is especially useful when the board’s pin order differs from a reference photo or when you have moved the signal connection from D2 to another digital input.

What the output does

The common default described in the ShillehTek module guide is momentary active-HIGH: the output goes HIGH while the sensor is touched and LOW when idle. The Arduino reads that signal as a digital input. Some TTP223 boards can instead be configured for toggle behavior, active-LOW output, or both; check the particular board’s documentation and jumpers.

Rank #2
hiBCTR 10-Pack TTP223B Capacitive Touch Switch Module, 2-5.5V
  • Momentary Touch Control​​: TTP223B chip enables instant on/off response (60ms touch mode) with auto low-power switching after 12s idle.
  • ​​Wide Voltage Compatibility​​: Operates at 2-5.5V DC (3V typical) with 0.8VCC high/0.3VCC low TTL output for Arduino/Raspberry Pi integration.
  • ​​Non-Metallic Installation​​: Detect touch through glass/plastic/paper (≤3mm) via 24×24mm PCB with four M2 screw holes for secure mounting.
  • ​​Ultra-Low Power Design​​: Consumes <1.5μA in standby mode (220ms wake-up time), ideal for battery-powered IoT devices.
  • Bulk DIY Bundle​​: 10x touch modules (24×24×7.2mm each) for stair lighting, smart mirrors, and capacitive control panels.
Configuration Typical meaning What the sketch should expect
Momentary, active-HIGH Output is HIGH during touch and LOW at rest Treat HIGH as touched
Momentary, active-LOW Output is LOW during touch and HIGH at rest Treat LOW as touched
Toggle, active-HIGH A touch changes the output state; it remains in that state until the next toggle Read HIGH or LOW as the current stored state, not as proof that a finger is currently on the pad
Toggle, active-LOW A touch changes the output state with reversed polarity Interpret the state according to the board’s polarity setting

The table describes the configuration choices documented for some modules, not a promise that every board supports every combination. A sketch written for momentary active-HIGH will appear inverted on an active-LOW board and will not behave like a momentary touch detector if the board is in toggle mode.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Momentary versus toggle describes what happens over time. In momentary mode, the output represents the current touch condition: it changes for a touch and returns to idle when the touch ends. In toggle mode, a touch changes the output to another state and that state remains after the touch; another touch changes it again. Thus, a reading in toggle mode is best understood as the module’s stored output state, rather than a direct indication that a finger is currently resting on the sensor.

Active-HIGH versus active-LOW describes which digital level means active. With active-HIGH momentary behavior, HIGH means touched and LOW means idle. With active-LOW momentary behavior, the meanings are reversed. These are separate configuration axes: a board’s mode concerns momentary or retained state, while its polarity concerns the level used to represent that state. The actual choices available and the jumper settings depend on the breakout.

When the observed result seems opposite to the example, first establish which mode and polarity the board uses before rewriting the entire sketch. A reversed momentary response calls for changing which level the code treats as touched. A retained response calls for recognizing that the board may be in toggle mode. Do not copy jumper positions from another manufacturer’s board: the source material does not establish shared jumper labels or pad positions across modules.

Test it with digitalRead

The Freenove TTP223 tutorial and Handson Technology example use a digital input and digitalRead for basic interaction. A dedicated library is not established as necessary for this simple digital-output use. The following illustrative sketch prints the input state and reports a touch for a module in the common momentary active-HIGH mode.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const int touchPin = 2;

void setup() {
  pinMode(touchPin, INPUT);
  Serial.begin(9600);
}

void loop() {
  int state = digitalRead(touchPin);

  if (state == HIGH) {
    Serial.println("Touched");
  } else {
    Serial.println("Idle");
  }

  delay(100);
}
  1. Upload the sketch with the signal wire connected to D2.
  2. Open the Arduino IDE Serial Monitor and set its baud rate to 9600, matching Serial.begin(9600).
  3. With a common momentary active-HIGH configuration, the monitor should report “Idle” when untouched and “Touched” while the sensor is touched.

This is an illustrative code example, not a claim of physical testing. If your board is active-LOW, reverse the comparison so LOW means touched. If it is configured to toggle, treat the reading as a retained state; do not label every HIGH reading as a finger currently touching the pad.

Rank #3
Ferwooh 10PCS TTP223B Digital Touch Sensor Capacitive Touch Switch Module Inching Tact Switch DIY
  • This module is capacitive type jog mode touch switch module that is based on a touch detection IC (TTP223B). Allows you to remove the worry of conventional push-type keys.
  • In the normal state, the module output low, low power consumption, but when a finger touches the corresponding position, the module output high, if not touched for 12 seconds, switch to low-power mode.
  • Positive and negative can be used as a touch surface,can replace the traditional touch button.
  • Low power consumption.Power supply: 2-5.5V DC.
  • Four M2 screws positioning holes for easy installation.Module can be installed in such as surface plastic, glass of non-metallic materials.

The pin number must agree in both places: the signal wire goes to D2, and touchPin is set to 2. If you choose a different Arduino digital input, update the constant to that number and move the signal wire to the matching pin. The rest of this simple example can remain the same when the module still uses momentary active-HIGH output.

The serial messages are a straightforward way to see what the Arduino is reading without adding another output component. They also help separate a wiring or pin-selection mistake from an interpretation mistake: the sketch prints the raw digital state as “Touched” or “Idle” only under the stated common mode. If the board is active-LOW or toggle-configured, change the interpretation to match its actual output behavior.

There is no need to start by adding a dedicated TTP223 library for the documented basic setup. The cited beginner examples read the module as a digital input using digitalRead. The essential software steps are to configure the chosen input, read its state, and make the code’s HIGH/LOW interpretation agree with the module’s mode and polarity.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Optional: switch an Arduino-controlled LED

If you want a visible output instead of serial messages, the same input can control an LED connected to a digital output. Use an LED with an appropriate current-limiting resistor, and choose an output pin that is not also being used by the touch sensor. The example below uses D13 as the LED output; adjust it to match your board and LED wiring.

const int touchPin = 2;
const int ledPin = 13;

void setup() {
  pinMode(touchPin, INPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  int state = digitalRead(touchPin);
  digitalWrite(ledPin, state == HIGH ? HIGH : LOW);
}

This simple LED response assumes momentary active-HIGH output. For active-LOW, change the condition so LOW turns the LED on. With a toggle configuration, the LED will follow the module’s retained output state until another touch changes it. The Freenove and Handson Technology examples support the general digital-input approach; the exact behavior still depends on the breakout configuration.

The touch module remains connected to a digital input, while the LED uses a separate Arduino output. In the example, D2 reads the sensor and D13 drives the LED. Keep those roles distinct if you select different pins: define the touch input and LED output separately, and make sure the wires match the numbers used in the code. The LED is an optional way to observe the input response, not a required part of the sensor circuit.

Rank #4
HiLetgo 10pcs TTP223B Capacitive Touch Switch Module Touch Sensor Switch Digital Capacitive Touch Sensor Switch DC 2~5.5V
  • This is the "momentary" variety of the touch sensor - touch and it turns on, release and it turns off.
  • Positive and negative can be used as a touch surface,can replace the traditional touch button.
  • Four M2 screws positioning holes for easy installation.Module can be installed in such as surface plastic, glass of non-metallic materials.
  • In addition to the thin paper ( non-metallic ) covering the surface of the module , as long as the correct location of the touch , you can make hidden in the walls, desktops and other parts of buttons.
  • The module is based on a touch-sensing IC (TTP223B) capacitive touch switch module. In the normal state, the module output low, low power consumption; When a finger touches the corresponding position, the module output high, if not touched for 12 seconds, switch to low-power mode.

For momentary active-HIGH behavior, the LED follows the touch output: it turns on when the input is HIGH and off when it is LOW. For momentary active-LOW behavior, reverse the condition so the LED responds to LOW. If the module is in toggle mode, the LED follows the retained state rather than indicating only whether a finger is currently touching the pad. As with the serial example, the code should reflect the breakout’s documented configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot a sensor that does not respond

Check the wiring, supply compatibility, selected input, and module configuration before changing the code. These checks follow from the module pin and mode documentation; they are not reported hands-on test results.

  • No output change at all: Recheck that VCC/VIN and GND are connected to the matching Arduino supply and ground pins, and that the module is powered at a voltage its board supports.
  • Arduino appears to ignore touches: Verify the signal wire is connected to the same digital pin named in touchPin. If you moved the wire from D2, update the constant in the sketch.
  • “Touched” appears while idle, or the response seems reversed: Check whether the board is configured for active-LOW output. In that mode, LOW—not HIGH—indicates the active touch state for momentary behavior.
  • The output seems to stay on after a touch: Check whether the module is set to toggle mode. In toggle mode, a changed output state is retained; that is different from the momentary behavior assumed by the basic sketch.
  • Your pin labels or jumper markings do not match an example: Do not infer connections or solder-jumper changes from a different board’s layout. Consult the documentation for the exact breakout, then adapt the signal pin and logic to its labels and settings.
  • You are using a 3.3 V controller: Confirm the breakout supports 3.3 V operation and that its signal level is appropriate for the controller. The TTP223-BA6’s supply specification does not by itself establish the electrical details of every breakout.

A useful order for troubleshooting is to verify physical connections first, then confirm the selected signal pin, then check the module’s supply and configuration. This avoids treating every mismatch as a code problem. If the connection labels are unclear, pause and identify the specific board rather than relying on a generic pin-order diagram.

If the Arduino reports a state but its “Touched” and “Idle” labels seem reversed, the digital input may still be reading the output correctly; the sketch may simply assume active-HIGH while the board is active-LOW. If the state remains changed after a touch, compare that behavior with the board’s toggle setting before deciding that the sensor or code is faulty. Mode and polarity determine how to interpret the same HIGH/LOW readings.

For a 3.3 V controller, revisit both sides of the connection: whether the breakout supports a 3.3 V supply and whether its output level is appropriate for the controller input. The TTP223-BA6 controller specification is not a substitute for the complete breakout’s specifications. When the module’s exact voltage requirements are not available, do not assume that a controller-level specification resolves them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What you need

  • A TTP223/TTP223B breakout with accessible power, ground, and output connections.
  • An Arduino or other controller with a compatible digital input.
  • Three connections: supported supply, common ground, and signal output.
  • Optionally, a breadboard and male-to-male jumper wires if they suit the breakout’s connections. These are convenience items, not mandatory for every assembly.

An Arduino Uno-compatible development board is a suitable example controller for the common 5 V, GND, and D2 walkthrough, but the circuit only requires a compatible digital input. If you already have a controller with a supported supply and input, the same three-wire principle applies; D2 is an example, not a special requirement of the TTP223.

Best Value
6Pcs TTP223B Digital Capacitive Touch Sensor Switch Module DC 2~5.5V for Arduino Raspberry Pi DIY
  • 【TTP223B Digital Capacitive Touch Sensor Switch Module】:Positive and negative can be used as a touch surface,can replace the traditional touch button.
  • 【Supply Voltage】:2~5.5V DC
  • Support low power consumption, In the normal state, the module output low, when a finger touches the corresponding position, the module output high, not touched for 12 seconds, switch to low-power mode.
  • Support module is mounted in the surfaces of non-metallic materials such as plastic, glass, acrylic, you can make the keys hidden in the walls and desks.
  • Support Positive and negative can be used as a touch surface,can replace the traditional touch button.

A breadboard and male-to-male jumper wires may make it easier to connect a bare module, depending on its connector style. They are optional rather than components required by the sensor’s basic circuit. Likewise, the LED and its current-limiting resistor are only needed for the optional LED demonstration; the serial-monitor test does not require them.

The essential circuit is just a module supply, a shared ground, and a signal wire to a digital input. The exact breakout documentation determines the safe supply connection and how to interpret its output.

Frequently Asked Questions

How do I wire a TTP223B to an Arduino?

Connect the module’s VCC or VIN pin to a supply supported by that breakout, connect GND to Arduino GND, and connect SIG, OUT, or I/O to a digital input. A common Uno example uses 5 V, GND, and D2. Check the labels and documentation for your exact board because pin order and board details vary.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does the TTP223 output go HIGH or LOW when touched?

The common default described in the cited module guide is momentary active-HIGH: HIGH while touched and LOW while idle. Some boards can be configured for active-LOW polarity or toggle behavior, so confirm the jumper configuration and adjust the sketch’s interpretation accordingly.

Do I need an Arduino library for a TTP223?

The cited beginner examples use a digital input and digitalRead for basic interaction. They do not establish a need for a dedicated library for this simple digital-output use.

What voltage should I use for a TTP223 module?

Tontek specifies a 2.0–5.5 V operating supply range for the TTP223-BA6 controller. That is not a guarantee that every breakout accepts that entire range. Follow the specifications for your particular module; for a compatible breakout used with a 3.3 V logic board, powering it at 3.3 V keeps its signal at the supply level.

Why does my TTP223 seem to stay on after I touch it?

The board may be configured for toggle behavior, in which a touch changes the output state and the state remains until another toggle. That differs from momentary mode, where the output reflects the touch condition. Check the specific board’s jumper documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What should I check if the sensor does not respond?

Recheck VCC/GND orientation and supply compatibility, verify that the signal wire reaches the same digital pin named in the sketch, and check the module’s jumper configuration. If the response is reversed, confirm whether the board is active-LOW; if the state remains after a touch, check for toggle mode.

The Bottom Line

For a typical TTP223 breakout, connect its supported supply, GND, and signal output to the Arduino’s corresponding supply, ground, and a digital input such as D2. Read the input with digitalRead; the common default is momentary active-HIGH, but verify the exact breakout’s voltage requirements, labels, and jumper configuration before powering it or interpreting its output.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.