Arduino KY-038 Sound Sensor: Build Clap Switches, Knock Locks & Sound-Activated Projects

Learn how to use the KY-038 sound sensor with Arduino to build clap switches, knock locks, and sound-activated projects with complete wiring and code.

Some props reach to light. Others react to motion.

But the really suspicious ones…

React to sound.

A single clap can awaken a glowing artifact. A secret pattern of knocks can unlock a hidden compartment. A whisper can slowly brighten an eerie lantern. Or perhaps an unsuspecting visitor pounds on a haunted door… and something inside answers back.

In this session, we explore one of the simplest—and surprisingly versatile—sound sensors for Arduino: the KY-038 microphone module. Although it looks humble, it offers two very different ways to detect sound, each perfect for different kinds of projects.

Together we’ll discover how to:

  • Wire the KY-038 to your Arduino using both the Digital Output (DO) and Analog Output (AO) pins.
  • Understand the strengths, weaknesses, and best uses for each output.
  • Adjust the onboard sensitivity so your project reacts to the sounds you want—instead of every sneeze, dropped screwdriver, and distant thunderclap.
  • Toggle devices on and off with simple claps, knocks, or other loud sounds.
  • Control an LED’s brightness using sound—then learn how the exact same code can control motor speed, servo position, and countless other devices by replacing the LED with your component of choice.
  • Build secret knock triggers that can unlock hidden compartments, activate props, open doors, illuminate treasure chests, or launch an entire sequence of spooky surprises.

Throughout the session, we’ll use a simple LED in our examples because it’s easy to see what’s happening. But don’t let the tiny LED fool you. Once you understand the concepts, you can swap it for relays, motors, servos, animatronics, fog machines, sound effects, or almost anything else your imagination can summon.

By the end of this workshop, your Arduino won’t just wait patiently for instructions.

It’ll be listening.

And once your projects can hear…

…you’ll never look at a simple knock on the door the same way again.

Affiliate Disclosure: Some links here might earn me enough nuts and bolts (aka commission) to keep the LEDs blinking and servos turning. No extra cost to you, just a lil’ fuel for my caffeine-powered nights of DIY-ing. I only present stuff that’s survived my “Did-it-Explode?” test. Build on, and thanks for the recharge!

You’ve Reached the Workshop Door..

The video walkthrough got you this far.

Inside Burnt Breadboard Society, you’ll unlock the complete Project Guide for this build, including everything you need to recreate it with confidence—without constantly pausing, rewinding, or guessing where that one mysterious wire goes.

Inside you’ll unlock:

  • Step-by-step Project Guide
  • Detailed wiring diagrams
  • Copy-and-paste Arduino & ESP32 code
  • Complete parts list with links
  • STL files (when applicable)
  • PCB files (when applicable)
  • Full workshop replay
  • Troubleshooting & common fixes
  • Access to our private community and live Open Lab sessions for personalized help

Whether you’re building spooky props, robots, cosplay electronics, escape room puzzles, or something completely original, Burnt Breadboard Society gives you the tools, guidance, and support to build projects you’ll actually be proud to show off.

Already a member?
LOG IN here to access this Project Guide instantly.