Skip to content

SolderedElectronics/Audio-Amplifier-Warning-Sensor-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Audio Amplifier Warning Sensor

This project uses a Dasduino CONNECTPLUS (ESP32), an Ultrasonic Distance Sensor, and a MAX98357A I²S Audio Amplifier to create an intelligent sound warning system.
When the ultrasonic sensor detects an object at approximately 40 cm (±3 cm) for more than 5 seconds, it plays a custom audio file (done.wav) from a microSD card through two connected speakers.

The project can also be manually controlled over the Serial Monitor, allowing you to:

  • Play the sound once
  • Enable/disable looping playback
  • Enable/disable ultrasonic detection
  • Adjust audio volume in real time

It’s ideal for industrial automation, machine status indication, or any system where a clear, audible feedback signal is required.


What you'll need


Software Requirements


Setting up

  1. If you haven’t already, install Arduino IDE
  2. Download this repository and extract it
  3. Open the Arduino sketch:
    audio-amplifier-warning-sensor-project/audio-amplifier-warning-sensor-project.ino
  4. Open the Boards Manager and search for ESP32 by Espressif Systems, then install it
  5. Under Tools → Board, select ESP32 Dev Module and the correct serial port
  6. Set:
    • PSRAM: Enabled
    • Partition Scheme: No OTA (Large APP)
  7. Install all of the libraries listed under Software Requirements
  8. Place your audio file on a FAT32-formatted SD card and rename it to done.wav
    (You can use any .wav file you like — a beep, tone, alert, or even a short melody. Just make sure it’s 16-bit PCM, 44.1 kHz.)
  9. Wire the components as described below and upload the sketch

No credentials or additional configuration are needed for this project.


Expected behavior

  • Upon startup, the serial monitor (115200 baud, No line ending) displays available commands.
  • You can control the system using the following single-character commands:
    Command Action
    p Play the sound once
    l Start loop playback (every 5 seconds)
    s Stop loop playback
    u Enable ultrasonic detection
    z Disable ultrasonic detection
    0–21 Set volume (0 = mute, 21 = max)
  • When ultrasonic detection is active and an object stays at ~40 cm ±3 cm for 5 seconds, the system plays /done.wav.
  • You can monitor the measured distance in real time through the serial output.
  • Adjust volume or stop/start detection at any time.
  • Replace done.wav anytime to change the sound the device plays.

Wiring (Quick Reference)

Component Pin on Dasduino Notes
MAX98357A VCC 5V Power
MAX98357A GND GND Common ground
MAX98357A BCLK GPIO26 I²S bit clock
MAX98357A LRCLK GPIO25 I²S left/right clock
MAX98357A DIN GPIO27 I²S audio data
microSD VCC 3.3V (or 5V if supported) Power
microSD GND GND Common ground
microSD MOSI GPIO23 SPI data output
microSD MISO GPIO19 SPI data input
microSD SCK GPIO18 SPI clock
microSD CS GPIO33 Chip select
Ultrasonic (easyC) Qwiic/easyC port Uses I²C (GPIO21/22)
Speakers L+, L– / R+, R– Connect to amplifier outputs

About Soldered

soldered-logo

At Soldered, we design and manufacture a wide selection of electronic products to help you turn your ideas into acts and bring you one step closer to your final project. Our products are intended for makers and crafted in-house by our experienced team in Osijek, Croatia. We believe that sharing is a crucial element for improvement and innovation, and we work hard to stay connected with all our makers regardless of their skill or experience level. Therefore, all our products are open-source. Finally, we always have your back. If you face any problem concerning either your shopping experience or your electronics project, our team will help you deal with it, offering efficient customer service and cost-free technical support anytime. Some of those might be useful for you:


Open-source license

Soldered invests vast amounts of time into hardware & software for these products, which are all open-source. Please support future development by buying one of our products.

This repository is under the MIT license. Long story short: use these open-source files for any purpose you want, as long as you apply the same open-source licence to it and disclose the original source.
No warranty — all designs in this repository are distributed in the hope that they will be useful, but they are provided “AS IS” without warranty of any kind.
The entire quality and performance of what you do with the contents of this repository are your responsibility.


Have fun!

And thank you from your fellow makers at Soldered Electronics.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages