Comparing siren sounds to trigger an alarm

I want to use a KY-037 mic module to listen for an audible alarm siren from a window camera detecting motion, the camera motion detected siren will be compared with that of a DFPlayers pre recorded mp3 identical sirens sound. All other sounds are ignored other than that of the mp3 players recording, the resulting match will in turn trigger an external intruder deterrent. I want to keep the project as simple as possible, thoughts and help with code appreciated.

I will use the KY as a mic preamp which has a digital and analog output.

.

This calls for a few questions:

What do you want the DFPlayer to actually do in your project? Is it there to play a deterrent sound when the camera siren is detected, or did you have something else in mind for it?

Do you have access to the camera's motion detection notifications, for example through an app, API, or any kind of output signal? This could make the whole thing much simpler and more reliable than using a microphone to listen for the siren.

What microcontroller are you planning to use (audio signal matching can be compute intensive)? And what do you want the intruder deterrent to actually be, a sound, a light, or a relay triggering something else?

Where will the KY-037 mic be positioned relative to the camera? Is it in the same room or somewhere else in the building?

This device is a sound level sensor, not an audio receiver. It will sense sound level, or if that level is above or below an adjustable threshold. How to Use Microphones on the Arduino

Is the siren not a deterrent?

I believe you have not read about audio, band filters, and the capabilities of the devices you have.

Note that that module has no audio preamp and therefore can only detect loud sounds.
The digital output has no sound information at all (is just an on/off square wave).

Thanks for reply, the DFPlayer has the sound of the window cameras built in siren recorded on it, the mic is attached to the camera’s body and listens for an alarm signal, if the signal picked up by the mic matches that of the mp3 player it then triggers a relay. Unfortunately there is no app available to use with the cameras anlerts other than a reminder of the event sent to iPhone or iPad. The internal siren is not load enough a such hence the need to trigger maybe an outdoor alarm. I have Arduino Nano and ESP32.

You are not reading, or are not understanding, the responses. Which is it?

And how do you plan to use that ?

Your science classes taught you that sound is a compression wave that has frequency and phase. Your recorded mp3 is a digital compressed file. There is nothing there to compare one to the other!

Time to think of another solution.

So your window opens and causes an alarm to sound. The alarm is built into the camera. You want the program to listen for the alarm and use the program to trigger a relay. Is that right?

I am not sure what your siren sounds like but HERE is a product that listens for sirens and opens gates for emergency vehicles. I have used these.

OR...could you simply wire into the existing alarm system somewhere to trigger the program to trigger the relay? Maybe put a relay in the wiring run to the siren? The electric going to the siren can trigger the relay coil, thus closing or opening the relay, providing an input to your MCU.

OR...Remove the existing siren that isn't loud enough and wire a relay directly to it which can trigger a louder alarm.

High thank for your reply and sensible comments. The window camera is made to where to the inside of your home window and comes with fixing pads. In my case it is mounted to the window frame on an adjustable bracket and looks out onto the rear of the property, in my case it’s set to activate it’s internal siren, the loudness of which can be adjusted. However ideal as a warning in the occupied room but at night asleep it wouldn’t be heard. Now you’ve made some sensible solutions for me to consider, one idea would be to dismantle it and simply link out the sounder, and using a simple circuit operate a relay, which in tern can switch on a flood light or an external sounder. I have already thought of doing this as an alternative solution.

I will clarify and highlight on some of the previous comments made. I have used this forum on a number of past occasions, but I never open by first mentioning I have a number of distractive and physical disabilities which limit my abilities to undertake certain technical tasks, not to mention I’m the wrong side of 80 to learn new things. Programming I struggle with but I get by from those who have assisted me in the past on this forum, so I’m great full.

Many years ago I designed test systems for the aerospace and automotive industry, programmable chips were yet to be introduced, as technology advanced companies used outside sources for programmable chips sets to assist in the technical designs. My background therefore is associated with electronics. I mentioned the DFPlayer, I can use this to record the siren and include the sound file for analysis to measure the signal frequency variations and consequent amplitude and period timing. My idea was to store this information as a digital finger print. I could use the ky module with it’s built in mic to mount on the cameras casing, the out put signal would be converted and stored and used as a comparison output signal to operate a relay, any other sounds picked up is ignored. This method can be done by programming, it may be simple or very complicated, while I do have the knowledge to put together circuits, and have a basic idea and understanding of what I’m trying to achieve, you guys hold the answers.

Sometimes the most complicated of projects have a very simple and practical answer. If this is not the case then I will attempt to dismantle it. Thanks for your replies.

The DFPlayer won’t record. It can only decode and play an MP3 (or other supported audio format) stored on the SD card, then output the audio to a loudspeaker/amp. You don’t have programmatic access to the SD card contents.

First thing I would test is to attach the microphone directly near the speaker of the camera and set the threshold high enough so that typical sounds in the room don't trigger anything but if the camera alarm rings, then it triggers.

Adding masking tape to hold the sensor straight to the speaker and possibly a bit of sound insulation around the microphone can possibly help.

Then there is no pattern matching code or whatever, you can even get rid of the arduino and coding : when the microphone triggers, a pin goes HIGH which could be the input to your relay.

Two people have already said that it is useless for your application and I will be the third.

unless this works

Yes my bad, I can put recorded and converted mp3 files onto a DFPlayer which is handy and convenient on my test bench for me to analyse the data. Was also thinking maybe using the player as the stored signal source may be, should it be simpler than storing it within software.

The siren has of course a repeating audio pattern of frequencies and amplitudes these could be stored to provide a reference fingerprint, as the sound pattern doesn’t change. Your idea of securing it with tape and sound proofing may work if it shields the mic from exterior noises, good point.

I’m using it purely as a means of amplifying the sirens sound signal and being able to adjust the audio output signal, this project is experimental, using devices and modules I have to hand. The signals can be processed as necessary to be stored as a digital footprint within a program.

OK. I guess it's worth a try and could indeed work.

So let’s assume we have a digital footprint stored on our Arduino, this samples period could be say 2 seconds. Next we have our mic secured onto the camera, only the sound of the cameras built in siren are we interested in. All sounds will be picked up and converted into digital samples, but only that of the siren matches the stored sample. This match triggers the relay and wards off an intruder via an external sound, could be a barking dog maybe.

So this is what I’m trying to achieve, how simple or complicated relies on programming an Arduino. This might be beyond my skill level, in which case a simpler alternative can be deployed. Does this make sense and within the realms of possibility.

AI generated. Why do you post machine-generated pulp where humans read? What if every response to you was paragraphs of AI slop?

@fxpd, What are you talking about ?

There are good arguments for a simpler approach. Assuming you can get a "good" sample from listening to the window camera to compare to your standard, the actual comparison and decision making about a match is probably better handled by a more powerful computer like an Arduino UNO Q. I would recommend you take the advice from several here and just use the presence or absence of some sound from the window cam speaker to trigger a louder or more usable alert.