Assignments
Group Assignment:
- Probe an input device(s)'s analog levels and digital signals.
- Document your work on the group work page and reflect on your individual page what
you learned.
Individual Assignment:
- Measure something: add a sensor to a microcontroller board that you have designed
and read it.
Week 9. Input Devices
Group Reflection
In this group assignment, I collaborated with Evelyn Cuadrado to explore and compare analog and digital signals using an oscilloscope. Analog signals appear as continuous waveforms that represent gradual changes over time, while digital signals alternate between fixed HIGH and LOW states.
We organized a virtual session to present our sensors and show live signal readings. During the meeting, we analyzed the 4-pin LDR sensor and the TTP223 touch sensor, observing how each behaved under real conditions.
LDR Sensor – Analog & Digital Modes
The LDR, or light-dependent resistor, outputs an analog signal that varies with light intensity. As we moved a hand closer, the oscilloscope showed smooth voltage changes. In digital mode, the same sensor produced sharp transitions between LOW and HIGH levels depending on the light threshold, illustrating how a physical input can produce different types of data.
TTP223 Touch Sensor – Digital Signal
The capacitive touch sensor generated a stable LOW signal when untouched. Upon contact, the signal quickly changed to HIGH, confirming accurate detection. This type of signal is perfect for systems where binary interaction is required without physical switches.
Overall, this hands-on comparison helped us better understand signal behavior and gave us confidence in using oscilloscopes to verify sensor outputs. It also clarified when to use analog versus digital sensors based on the application context.
Introduction
In the context of embedded systems, input devices are essential to enable interaction
between the physical world and digital environments. These devices, also known as input
devices, function to detect environmental variables such as touch, distance, light, or
temperature and translate them into electrical signals that a microcontroller can
interpret. These signals can be digital, based on binary states (on or off), or analog, when
representing a continuous variation.
The microcontroller used for this activity is an ESP32-S3, a powerful processing unit with
Wi-Fi and Bluetooth connectivity, ideal for real-time interaction and monitoring projects.
The board housing this microcontroller was designed during Week 6 (Electronics Design) of Fab Academy using the Fritzing tool,
which allowed for intuitive circuit schematic creation and PCB layout. Later, in Week 8 (Electronics Production), the machining files were prepared
using Fusion 360 to generate milling paths for PCB production via CNC.
TTP223 Touch Sensor
The TTP223 is a capacitive touch panel detector integrated circuit (IC) that emulates the functionality of a physical button using capacitive technology. It is designed to replace traditional switches with a more durable solution without moving parts and greater design flexibility. Through a sensitive area (metal pad or PCB), the TTP223 detects human body proximity or contact reliably.

Operating Principle
The sensor works by measuring changes in the capacitance of the environment near its sensitive
surface. When a finger approaches or touches this area, an electric field variation occurs,
which the IC detects and interprets as a touch signal, generating a digital output easily read
by a microcontroller like the ESP32-S3.
The TTP223 features automatic calibration, with a recalibration period of about 4 seconds when
no touch is detected, ensuring precise detection over time and despite environmental changes.
Signal Types and Operating Modes
By default, the module provides a digital CMOS output (Q pin) that goes HIGH when a touch is detected and stays LOW otherwise. It is highly versatile and configurable via option pads on the PCB:
- Output modes: active HIGH or active LOW (AHLB pin).
- Response modes: momentary (active only while touched) or toggle (changes state with each touch) via TOG pin.
- Power modes: fast or low consumption (LPMB pin).
- Open drain output available on the OPDO pin.
- Sensitivity adjustment: using an external capacitor (0–50 pF) between input and ground.
Technical Specifications
- Operating voltage: 2.0 V to 5.5 V (3.3 V compatible with ESP32-S3).
- Very low standby current, ideal for battery-powered projects.
- Response time: ~60 ms (fast mode), ~220 ms (low power mode at 3 V).
- Module size: 15 mm x 11 mm.
- Startup stabilization time: ~0.5 s (do not touch during this period).
- Max allowed touch duration: 100 seconds (MOTB pin).
Simulating the TTP223 with App Designer (MATLAB)
To realistically emulate the touch sensor’s behavior, an application was developed in MATLAB’s
App Designer. It allows users to configure operational modes interactively, similar to using
physical jumpers on the sensor board.
The simulation includes:
- Default signal state: HIGH (1) or LOW (0).
- Activation mode: Momentary (signal changes only while touched) or Toggle (signal toggles on each touch).
Sensor Behavior Simulation
The App Designer simulation replicates both momentary and toggle configurations:
- Momentary: signal pulse occurs during touch only.
- Toggle: signal flips on each touch and stays until the next one.
Integration of TTP223 with ESP32-S3 and RGB LED
To visually verify the touch detection, the TTP223 was connected to an ESP32-S3 board and a common anode RGB LED. The sensor’s output pin was linked to the microcontroller, and the RGB LED was configured to turn white upon touch detection by setting all cathodes LOW.
Component | Pin | ESP32-S3 |
---|---|---|
TTP223 | VCC | 3V3 |
TTP223 | GND | GND |
TTP223 | I/O | 2 |
RGB LED | Red cathode | 4 |
RGB LED | Green cathode | 5 |
RGB LED | Blue cathode | 6 |
Validating TTP223 Behavior with Oscilloscope
A digital oscilloscope was used to monitor the sensor’s output in real time. The probe was connected to the TTP223’s output pin, and GND was connected to the circuit’s ground. Observations showed:
- Normal (untouched): signal remains LOW (~0 V).
- On touch: signal quickly jumps to HIGH (~3.3 V).



This matches the default active-high configuration and confirms theoretical and simulated behavior.
System Programming and Behavior
The implemented code detects capacitive touch and controls the RGB LED reliably. A
ledState
logic was added to prevent flickering and ensure toggling only on valid
state transitions. This creates a stable, touch-activated interface.
ESP32-S3 – TTP223 Touch Sensor Code
This code detects touch from the TTP223 sensor (pin 2) and toggles a white RGB LED (pins 4, 5, 6).
#define TOUCH_PIN 2
#define RED_PIN 4
#define GREEN_PIN 5
#define BLUE_PIN 6
bool ledState = false;
void setup() {
Serial.begin(115200);
pinMode(RED_PIN, OUTPUT);
pinMode(GREEN_PIN, OUTPUT);
pinMode(BLUE_PIN, OUTPUT);
pinMode(TOUCH_PIN, INPUT);
digitalWrite(RED_PIN, LOW);
digitalWrite(GREEN_PIN, LOW);
digitalWrite(BLUE_PIN, LOW);
}
void loop() {
int touchValue = digitalRead(TOUCH_PIN);
Serial.print("Touch value: ");
Serial.println(touchValue);
if (touchValue == 0) {
if (!ledState) {
ledState = true;
digitalWrite(RED_PIN, HIGH);
digitalWrite(GREEN_PIN, HIGH);
digitalWrite(BLUE_PIN, HIGH);
Serial.println("LED turned ON!");
}
} else {
if (ledState) {
ledState = false;
digitalWrite(RED_PIN, LOW);
digitalWrite(GREEN_PIN, LOW);
digitalWrite(BLUE_PIN, LOW);
Serial.println("LED turned OFF!");
}
}
delay(100);
}


This experiment successfully demonstrates how a capacitive touch sensor can be integrated into an embedded system to provide real-time digital input with visual feedback. By using both simulation and physical measurements, the sensor’s behavior was confirmed to match theoretical expectations. This highlights its reliability and usefulness for interactive embedded applications.
Conclusions