ESP32 C3 Super Mini - Sound Sensor

Sound sensors detect the presence of sound and enable your ESP32 C3 Super Mini to create interactive, sound-responsive projects like clap-activated lights or voice-triggered devices. This tutorial will show you how to connect and program a sound sensor with your ESP32 C3 Super Mini board.

In this tutorial, you'll learn:

ESP32 C3 Super Mini sound sensor

After completing this tutorial, you can modify the code to trigger actions when sound is detected - turn on an LED, activate a relay to control lights, or rotate a servo motor based on sound input.

Hardware Preparation

1×ESP32 C3 Super Mini
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×Digital Sound Sensor
1×Analog Sound Sensor
1×Breadboard
1×Jumper Wires
1×Optionally, 5V Power Adapter for ESP8266

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of Sound Sensor

A sound sensor is a detection module that senses sound waves in the surrounding environment and converts them to electrical signals.

Two types of sound sensor modules:

  • Digital sound sensor module: Outputs a digital signal (HIGH/LOW or ON/OFF)
  • Analog sound sensor module: Outputs both analog values (sound level) and digital signals (sound detected/not detected)

Key features:

  • Adjustable sensitivity using built-in potentiometer
  • Works with 3.3V to 5V microcontrollers like ESP32 C3 Super Mini
  • LED indicators for power and sound detection status
  • Perfect for beginners learning sound detection projects
  • Low cost and easy to integrate

The Digital Sound Sensor Pinout

The digital sound sensor has three connection pins for easy wiring.

  • VCC pin: Connect to power supply (3.3V to 5V)
  • GND pin: Connect to ground (0V)
  • OUT pin: Digital output pin - outputs HIGH when quiet, LOW when sound is detected - connect to ESP32 C3 Super Mini digital input pin
Sound Sensor Pinout
image source: diyables.io

Additional features:

  • Built-in potentiometer for adjusting sound sensitivity threshold
  • Power LED indicator shows when the sensor is powered
  • Status LED indicator lights up when sound is detected

The Analog Sound Sensor Pinout

The analog sound sensor has four connection pins offering both digital and analog outputs.

  • + pin: Connect to 5V power supply
  • G pin: Connect to ground (0V)
  • DO pin: Digital output - outputs HIGH when quiet, LOW when sound detected - connect to ESP32 C3 Super Mini digital input pin
  • AO pin: Analog output - outputs analog voltage representing sound level - connect to ESP32 C3 Super Mini analog input pin
analog sound sensor Pinout
image source: diyables.io

How It Works

The sound sensor module detects sound and converts it to electrical signals your ESP32 C3 Super Mini can read.

Digital output behavior:

  • When sound is detected: Output pin goes LOW
  • When no sound (quiet): Output pin stays HIGH
  • Sensitivity threshold adjustable via onboard potentiometer

How to adjust sensitivity:

  • Rotate the potentiometer clockwise to decrease sensitivity (require louder sounds)
  • Rotate counterclockwise to increase sensitivity (detect quieter sounds)
  • Test and adjust until the sensor responds to your desired sound level

Wiring Diagram

Connect your sound sensor to the ESP32 C3 Super Mini following the diagram below.

Important notes:

  • Note: Double-check all connections before powering on to avoid damaging your components
  • Note: The digital sound sensor uses 3 wires while the analog sensor uses 4 wires
The wiring diagram between ESP32 C3 Super Mini Sound Sensor

This image is created using Fritzing. Click to enlarge image

Sound Sensor Pin ESP32 C3 Super Mini Pin
VCC 3.3V or 5V
GND GND
OUT (or DO) D3 (GPIO3)

How To Program For Sound Sensor

Programming the ESP32 C3 Super Mini to read a sound sensor involves two simple steps.

What the code does:

  • Configures the ESP32 C3 Super Mini pin as a digital input
  • Reads the sound sensor state (HIGH or LOW)
  • Determines if sound is detected based on the pin state
  • Displays the detection status on Serial Monitor

Step 1 - Initialize the pin:

pinMode(D3, INPUT);

Step 2 - Read the sensor state:

int soundState = digitalRead(D3);

ESP32 C3 Super Mini Code - Detecting the sound

/* * This ESP32 C3 Super Mini code was developed by newbiely.com * * This ESP32 C3 Super Mini code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-c3/esp32-c3-super-mini-sound-sensor */ #define SENSOR_PIN D3 // The ESP32 C3 SuperMini pin D3 connected to the OUT pin of the sound sensor int prev_sound_state = HIGH; // The previous state from the input pin int sound_state; // The current reading from the input pin void setup() { // Initialize the Serial to communicate with the Serial Monitor. Serial.begin(9600); // initialize the ESP32's pin as an input pinMode(SENSOR_PIN, INPUT); } void loop() { // read the state of the the ESP32's input pin sound_state = digitalRead(SENSOR_PIN); if (prev_sound_state == HIGH && sound_state == LOW) Serial.println("The sound has been detected"); else if (prev_sound_state == LOW && sound_state == HIGH) Serial.println("The sound has disappeared"); // save the the last state prev_sound_state = sound_state; }

Detailed Instructions

  • New to ESP32 C3 Mini? Complete our Getting Started with ESP32 C3 Mini tutorial first to set up your development environment.
  • Check the wiring: Verify all connections match the wiring diagram above
  • Copy the code: Copy the provided code and open it in Arduino IDE
  • Select your board: Choose ESP32 C3 Super Mini from the boards menu
  • Upload the code: Click the Upload button to transfer code to your ESP32 C3 Super Mini
  • Open Serial Monitor: Set baud rate to 9600 in the Serial Monitor
  • Test the sensor: Clap your hands or make noise near the sound sensor
  • Observe the output: Check the Serial Monitor for sound detection messages
  • Adjust sensitivity: If needed, turn the potentiometer to fine-tune detection threshold
  • Pro Tip: If the status LED stays constantly on or off regardless of sound, adjust the potentiometer slowly while making noise until the LED blinks in response to sound.
Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32C3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32C3 Dev Module' on 'COM15')
New Line
9600 baud
14:23:15.342 - The sound has been detected 14:23:16.891 - The sound has disappeared 14:23:18.127 - The sound has been detected 14:23:19.004 - The sound has disappeared 14:23:21.556 - The sound has been detected 14:23:22.332 - The sound has disappeared
Ln 11, Col 1
ESP32C3 Dev Module on COM15
2

If the LED indicator stays constantly on or off even when sound is present, rotate the potentiometer to adjust the sound sensitivity threshold until the sensor responds correctly.

Now you can customize the code to trigger actions when sound is detected - activate an LED, control a relay to switch lights, or rotate a servo motor in response to sound. Check the application ideas and challenge sections below for inspiration.

Application and Project Ideas

Use your ESP32 C3 Super Mini sound sensor setup to create interactive sound-responsive projects.

  • Build a clap-activated light switch using a relay module
  • Create a sound-level meter display with LED bar graph
  • Design a knock-detection door lock system
  • Make a sound-triggered pet feeder or treat dispenser
  • Build a noise monitoring system for quiet zones
  • Create a voice-activated notification system with buzzer alerts

Video Tutorial

Watch the video below for a visual walkthrough of this project.

Challenge Yourself

Take your ESP32 C3 Super Mini sound sensor skills to the next level with these challenges.

  • Easy: Add an LED that lights up when sound is detected and turns off when quiet
  • Easy: Display the sound state on an LCD screen instead of Serial Monitor
  • Medium: Create a clap counter that counts the number of claps detected within a time window
  • Medium: Combine the sound sensor with a relay to build a clap-activated lamp
  • Advanced: Build a sound pattern recognition system that responds to specific clap sequences (e.g., double-clap vs triple-clap)

Troubleshooting

If your ESP32 C3 Super Mini sound sensor isn't working properly, try these solutions.

Common issues and fixes:

  • Reduce vibrations: Mount the sound sensor on a stable, vibration-free surface - mechanical vibrations and wind noise interfere with detection accuracy
  • Check sensing range: This sound sensor detects sound within approximately 10 inches - move closer to the sensor when testing
  • Verify power supply: Ensure clean, noise-free power - the sound sensor's analog components are sensitive to power supply interference
  • Adjust sensitivity: Rotate the potentiometer while testing until the sensor responds appropriately to your sound level
  • Check wiring: Verify all connections match the wiring diagram - loose or incorrect connections cause erratic behavior
  • Test LED indicators: Power LED should be on constantly; status LED should blink when sound is detected

Function References

Learn More

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!