กลับไปหน้ารวมไฟล์
sound-sensor-activated-leds-with-lcd-for-sound-level-data-283bad-en.md

Project Overview

The "Interactive Sound Visualizer" is an engaging electronic project that provides a real-time visual representation of ambient sound intensity. Using a KY-038 Microphone Sound Sensor and an Arduino UNO, the system continuously samples the surrounding audio environment. The project classifies sound levels into three distinct tiers—represented by Yellow, Green, and Red LEDs—and simultaneously displays the raw analog values on a 16x2 LCD screen. This is an excellent introductory project for exploring analog signal processing, sensor calibration, and visual feedback loops.

This project is about monitoring the sound level data that is being released, produced or outputted(?) by the speakers.

Aaah... this is a product of curiosity and boredom.

I used a [KY-038] microphone sound sensor module to pickup the values that I then gathered from the Serial Monitor, transferred to a spreadsheet, arranged to ascending order then chose the values that occurs more repetitively than others or just the ones that I like.

I picked a number of variables from the lowest range to the mid and high range.

The variables from the lowest range of values will activate the Yellow LEDs, the mid range ones will activate the Green LEDs and the high range ones will activate the Red ones.

The LEDs will be activated or turned on when the certain sensorValue is reached or detected by the sound sensor.

I also included an optional LCD to view the values in real time just for fun.

I basically just upgraded this code

Added some codes from here

And here

The LCD Codes are from my previous project

And Username MAS3's Comment here

I encountered a problem where the data that is appearing on the LCD have some leftover digits from the past sensorValue. Like, when the current value is supposed to be 619 which is what is on the Serial Monitor, but it becomes 6194, because the past value was 1234.

Download the .cpp and .h files here.

******************************************************************************

Social Media Links To Follow (I mean, if you want to):

Facebook - https://fb.me/HeathenHacks

Twitter - https://twitter.com/HeathenHacks

Instagram - https://instagr.am/HeathenHacks

******************************************************************************

https://drive.google.com/file/d/15NRocdFjr-DG7Hu2zyyvSvRz7bcncvU7/

You can also check the video.

https://youtube.com/@HeathenHacks

Technical Deep-Dive & Hardware Strategy

  • KY-038 Sound Sensor Mechanics: The KY-038 module contains a condenser microphone and an LM393 Comparator. It provides two outputs:
    • Analog Output (AO): Gives a continuous voltage signal corresponding to the audio waveform. This is what the Arduino samples via its 10-bit ADC to determine sound volume.
    • Digital Output (DO): Acts as a high/low switch that triggers when a specific noise threshold (adjustable via an onboard potentiometer) is exceeded.
  • Calibration & Sampling: Audio signals are essentially oscillations. To get a reliable volume reading, the code must sample the analog pin quickly and find the peak-to-peak amplitude or the average magnitude over a small window (e.g., 50ms). This prevents the LEDs from flickering too rapidly due to the nature of sound waves being zero-crossing signals.
  • LCD Character Ghosting Solution: When updating numerical values on an LCD, a common issue is "digit trailing" (e.g., 1023 turning into 9993 because the last '3' was never overwritten). The engineering solution is to print several blank spaces after each number: lcd.print(sensorValue); lcd.print(" ");. This clears any leftover digits from longer previous values.
  • LED Protection: Each LED requires a current-limiting resistor to prevent burnout. Since different colors have different Forward Voltage ($V_f$) drops—typically 1.8V for Red/Yellow and 3.2V for Green/Blue/White—using specific resistor values (220Ω to 330Ω) ensures consistent brightness across the entire spectrum.
  • Strobe and Pulse Logic: The project includes a strobe effect. This is achieved by rapidly toggling the digitalWrite() states during high-peak sound events, creating a "visual explosion" synchronized with the beat of the music.

ข้อมูล Frontmatter ดั้งเดิม

title: "Sound Sensor Activated LEDs with LCD for Sound Level Data!"
description: "Just a basic sound sensor activated LEDs with an optional LCD for sound level data. ***STROBE LIGHT EFFECT AT AROUND 8:45 MINUTE MARK!***"
author: "Heathen_Hacks-v2"
category: "Lights & LEDs"
tags:
  - "audio"
  - "lights"
  - "entertainment system"
  - "monitoring"
views: 36128
likes: 18
price: 699
difficulty: "Easy"
components:
  - "1x 9V to Barrel Jack Connector"
  - "4x 5 mm LED: Green"
  - "1x Standard LCD - 16x2 White on Blue"
  - "1x Arduino UNO"
  - "8x Resistor 100 ohm"
  - "2x 5 mm LED: Red"
  - "4x Resistor 220 ohm"
  - "4x 5 mm LED: Blue"
  - "1x Sound Sensor Module KY-038"
  - "1x Male/Male Jumper Wires"
  - "1x Solderless Breadboard Full Size"
  - "1x Male/Female Jumper Wires"
  - "2x 5 mm LED: Yellow"
  - "4x Resistor 330 ohm"
  - "4x 5 mm LED: White"
  - "1x 9V battery (generic)"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles: []
documentationLinks: []
passwordHash: "88c9cbf18a2745bdaec0a98fece8529466a4fbcb54f61f5f63c9020f307d91b8"
encryptedPayload: "U2FsdGVkX18gfR1fQ86H+Mn0jH1AoUWxg/ggJCNhLO84VzFh+iHoIiTOH0l7a20jwTlXv7XHHw24flBqqwdH7+FwY48jqmMQYk6LAFLbL9M="
seoDescription: "Basic project using a Sound Sensor to control LEDs with an optional LCD for sound level data monitoring."
videoLinks:
  - "https://www.youtube.com/embed/QwDQgP_fGNo"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/sound-sensor-activated-leds-with-lcd-for-sound-level-data-283bad_cover.jpg"
lang: "en"