Simulator

A touch sensor simulator: a TTP223 pad on an Arduino

Mokxi is a free online TTP223 touch sensor simulator that runs in your browser, with nothing to install and no account needed. A TTP223 capacitive touch pad on pin 2 of an Arduino Uno, beside a temperature and humidity sensor and an LCD. Touch the pad and the display flips between Celsius and Fahrenheit: one touch, one flip, every time.

  • 505parts on the bench
  • 45boards running now
  • 1.00xreal time, on every board
Arduino Uno: a touch pad that flips the unitslive0.000 s 0.00x
Hold the button
Click the circuit to open it in the editor, then hold the pointer on the touch pad. The LCD switches between °C and °F.

What you can do here

In the circuit above, or in the editor it opens.

  • Touch the pad and read it with digitalRead, like a button
  • See a clean output with no bounce and no pull-up resistor
  • Measure the 60 ms the chip takes to decide
  • Switch the pad to toggle mode, where each touch latches
  • Flip the output to active low
  • Replace any pushbutton in a sketch with a touch pad

What the running circuit shows

A button with no moving parts.

The pad runs from the Uno’s 3.3 V pin and its signal goes to pin 2. Untouched, the signal is at 0 V. Put a finger on it and, about 60 ms later, it goes to 3.30 V and stays there until you let go, when it drops back to 0 V. The sketch watches for the rising edge and flips the LCD between Celsius and Fahrenheit.

That 60 ms is the chip making sure. It measures the pad’s capacitance over and over and only reports a touch that lasts, which is why the output never chatters the way a pushbutton’s contacts do. The sketch has no debounce code and does not need any. And 3.3 V is enough for a 5 V Uno to read as HIGH, so no level shifting is needed either.

How the TTP223 is modeled

The timing and the two solder jumpers.

The model has the chip’s response time, 60 ms to register a touch and the same to register a release, and the half second it spends calibrating itself at power-on, when it ignores the pad. The two options a real module sets with solder jumpers are properties here: toggle, where each touch flips the output and it stays, and active low, where the output idles high.

What it leaves out is the physics of the pad: touching through glass or plastic, wet fingers, and the slow drift the real chip corrects for. Here a touch is a touch.

How it works

Three steps from a blank tab to a running circuit.

  1. Open the editor

    It runs in your browser tab. Nothing to install, and you need no account to start.

    Your first project
  2. Wire it and write the code

    Drag parts onto a breadboard, run each wire from pin to pin, and write the sketch beside it.

    Wiring
  3. Press Run

    Your sketch compiles in the tab and runs on a model of the chip, with the Serial Monitor beside it.

    Run and serial
Reviews

What makers say about Mokxi.

“The AI checker helps check and correct my circuits, and it has way more components than Tinkercad. As a student I really appreciate the tool.”

ChloeEngineering student

“I’d been looking for a real online electronic simulator that was intuitive and complete when I found Mokxi. I was able to quickly import a Fritzing file and my Arduino sketch and start testing. Mokxi has all of the makings for the best online Arduino simulator I have been able to find!”

JayModel builderFeatured in his DioramaOS post

“I’m using Mokxi to develop and simulate an STM32-based four-wheel-drive robot car before building the actual hardware. It allows me to experiment with DC motor control, PWM, RPM measurement using photointerrupters, and different acceleration, braking, and reversing strategies, helping me understand and refine the system before implementing it in real life.”

NusretRobot car builder, Hamburg

Share your story

FAQ

Questions, answered.

Is it free?

Yes. The circuit on this page, every part in it and the editor it opens in are on the free plan, with no card.

Do I need an account?

No. The circuit runs the moment the page does, and the editor opens without one. A free account is only for saving a project to the cloud and sharing it by link.

How do I use a TTP223 touch sensor with an Arduino?

Three wires: VCC to 3.3 or 5 V, GND to ground and SIG to any digital pin. Read it with digitalRead. It is HIGH while touched, unless the module is set to active low.

Does a touch sensor need debouncing?

No. The TTP223 decides inside the chip, taking about 60 ms, and its output switches once per touch. A mechanical button needs debounce; this does not.

Can a TTP223 work as an on/off switch?

Yes, in toggle mode: each touch flips the output and it holds. On a real module that is a solder jumper; here it is a property of the part.

More simulators

Each one opens on a circuit that is already running.

Touch the pad

Open the circuit, touch the pad and watch the units flip. Nothing to install, and no account needed.