Featured Video Play Icon

Knock Sensor Module KY-031 as a toggle switch with Arduino

Today, I am experimenting with knock module KY-0131 using Arduino.


The Knock Sensor Module

The Knock Sensor Module is used to detects the knock or taps.

Parts Needed

You need to have the following parts

  • Arduino (Any version)
  • 1x KY-031
  • 1x One-Channel Relay module 5V
  • Jumper Wires

For Arduino

Wiring Photo Interrupter Module

Pin Wiring KY-010 to Arduino
OUT Digital Pin – 2

Wiring Relay

Pin Wiring relay to the Arduino
S DIgital Pin – 13
+ 5V

Schematics For Arduino

Assemble all the parts by following the schematics below:


Connect the light lamp to the relay.

Coding Arduino

  • Upload the code to the Arduino.
  • knock the sensor to turn on the light.

Leave a Reply

Close Menu
%d bloggers like this: