
The YL-99 covers the same ground as the KY-031 knock sensor we just looked at — a small mechanical switch that trips on impact — with the main practical difference being how its output is read rather than how it physically detects a hit.
How it works
Like the KY-031, the YL-99 relies on an internal mechanical contact rather than a piezo element — a hard enough impact briefly connects two internal pins, changing the output state. The exact internal switch design isn't detailed by the manufacturer, but the behavior matches other spring or ball-based impact switches.
Components needed
An Arduino Uno, a YL-99 impact switch module, and jumper wires.
Wiring it up
Three connections: VCC to 5V, GND to ground, and OUT to a digital pin — pin 2 in a typical setup. The module is read using Arduino's internal pull-up resistor for a stable resting state.
Programming it
With the pull-up enabled, the pin normally reads HIGH; an impact pulls it LOW momentarily. The sketch checks for that LOW state with digitalRead() and prints "Impact detected" when it occurs, and "No impact detected" otherwise.
How this compares to the KY-031
Functionally, the YL-99 and KY-031 solve the same problem in nearly the same way — both are simple mechanical impact switches read as a clean digital signal, differing mainly in whether the project relies on the module's own pull-up behavior (YL-99) or a straightforward HIGH-normally output (KY-031). Either works well for basic knock or impact detection; which one to use often comes down to whichever module you already have on hand.
Where this is used
The article mentions security systems, vehicle-impact alarms, and robotics as common uses — the same general category of projects as the KY-031, since both modules serve the same underlying purpose.
You can find YL-99 impact switch modules at Juthour Tech.
اترك تعليقا