Sensor Digital

Knock Sensor Module

A KY-031 knock sensor module detects tap or shock events with a contact-style vibration element.

Part images

KY-031 Module Photo. Module Photo for the KY-031 Knock Sensor Module. Image source: Joy-IT SensorKit KY-031 module documentation
KY-031 Pinout / Module Diagram. Pinout / Module Diagram for the KY-031 Knock Sensor Module. Image source: Joy-IT SensorKit KY-031 module documentation
KY-031 Arduino Wiring Diagram. Arduino Wiring Diagram for the KY-031 Knock Sensor Module. Image source: Joy-IT SensorKit KY-031 module documentation
KY-031 Raspberry Pi Wiring Diagram. Raspberry Pi Wiring Diagram for the KY-031 Knock Sensor Module. Image source: Joy-IT SensorKit KY-031 module documentation

What it is

A KY-031 knock sensor module detects tap or shock events with a contact-style vibration element.

How students use it

Students use it for tap codes, knock-to-start projects, reaction games, and event logging.

Pins and power

Signal, VCC, and GND on common KY-031 boards.

Passive/digital tap sensor module. Use Pico-safe pull-up or pull-down wiring.

The signal changes briefly during a tap, so code should debounce, latch, or count pulses deliberately.

Voltage and safety

Keep signal wiring Pico-safe.

Tap the surface, not the bare electronics. Do not strike the board hard.

Module internals

Main component: Knock/vibration switch element.

Knock sensor contact, resistor/support parts, PCB, and header.

Datasheet notes

It detects events, not calibrated impact strength.

Common libraries

Use machine.Pin, interrupts, and debounce timing.

Common mistakes

Missing short pulses, no debounce, mounting loosely, and expecting the same sensitivity in every enclosure.