Comparing siren sounds to trigger an alarm

I agree, this could be a far more involved project than I originaly antisepated

Thank you, probably the best way forward, that’s if I can dismantle it without doing any damage, In which case I can ditch the sounder completely and put together a simple relay driver circuit to complete the task. Regards Jevray

Hi Wawa, just replying regarding the KY sound module, I have several of these, the one I’m using here has been altered to set the opamp gain, easier for me than building from scratch. Jevray.

@xfpd, I’m conversant with all aspects of what you have posted, some modules I have to hand, have been modified to suit my needs, and therefore work to for fill my own requirements at the time I use them. Regards Jevray.

The intension was to create and store using software created to run on an Arduino a finger print taken from the audible siren built into the window camera, the stored print matches that of the sirens signal via a mic whenever an intruder is detected. The match then triggers a relay, all other noises picked up are consequently ignored. Hope I’ve clarified your questions. Regards Jevray.

You will have to define that a bit more so someone can understand what you mean.

Do you have a link for that camera ?

@Paul_KD7HB

My intruder alarm set up consists of the following components:-

  1. A model PC340 indoor window mounted camera. Marketed by Outinput.

  2. Arduino esp32 or possibly Nano to be decided.

  3. Miniature microphone and suitable audio pre amplifier module

  4. A relay switch to operate an external intruder warning device
    Working principle of linked components

    The PC340 window camera uses a downloadable app incorporating a range of functions and settings, including a human intruder motion detector, when motion is sensed a built in siren is sounded for a set period of time. The siren can be disabled completely via the app. I intend to use the sirens audible signal in my project.

    Method

  5. By whichever’s the easiest, make an audible copy of the active sirens rhythmic pattern, the repetition of sound is very short.

  6. Using the recorded audio clip, the analog signal requires processing to extract and store the vital components of the sample ( frequencies, amplitude and time periods) to be used within a dedicated program.

  7. A miniature microphone and suitable amplifier module is used to pick up the sound from the cameras built in siren, the fixture must be either on or close to the camera.

  8. A separate analog input is needed to accept the cameras siren signal in the event of an intruder motion. The program has to process this signal in such away that a sample of this signal can then be compared to that of the stored siren sample. If the samples match then the relay contacts close activating the external warning device.

    Note… the PC340 window camera cannot directly communicate motion detection to any devices i.e. smart plugs, Google or Alexa.

In general, comparing sounds and making a reliable identification is an extremely challenging and computationally intensive task, not much different from voice recognition. It is not something that an inexpensive Arduino can do.

At this point in time do you know for certain that the siren is a pure sine wave or a complex of many different frequencies?

Some time ago I built a clap‑recognition system that was robust enough not to trigger on my dogs barking. The whole project is described in detail in the link below. I believe the approach could be adapted quite easily to recognize the sound of your siren as well.

Very useful, I’ll visit the site, thank you for sharing. The only other thoughts I had was to somehow compare a stored copy of the sirens sound as a reference, then as the camera siren sounded it’s alert, the mic signal could be reversed phased and then combined with the stored sample, passed through a comparator, the output would be near zero as a result of phase cancellation. This result would trigger the relay, any other random sounds picked up on the cameras mic would be ignored. The two phases needs to be in sync with each other for cancellation to be effective. (this is just a thought as an alternative) Jevray

Use a MAX9814 microphone instead of the KY-037 to get a clean analog reading. and can use the long of signal instead of compunds of signal

Why this method is effective for your purpose:

  • Filters out impulsive noises: A cough, a slamming door, or a barking dog will exceed the VOLUME_THRESHOLD, but they will never last for 3 continuous seconds (MINIMUM_DURATION). The code will ignore them by resetting the timer.
  • Hardware simplicity: The Automatic Gain Control (AGC) of the MAX9814 will prevent the microphone from saturating too easily when the siren is close, providing a much more stable duration reading compared to the KY-037.

A simpler approach that might be within an Arduino's capability assumes that your 'siren' sound includes at least two periods with a steady frequency lasting at least say 100 ms. Please post an MP3 or WAV of a recording of it from the camera so that we can see if it's worth pursuing.

Thanks for the tip, the spec is excellent so I may order one.

Will do, I’ll post back with a sample. Thanks for posting. Jevray

@Terrypin This is the mp3 you requested. Regards Jevray
Siren Sample.zip (106.6 KB)

Thanks I'll take a look hopefully later today. But I unzipped and listened to it on my iPhone while lunching in the garden and I'm pessimistic. I don't need my oscilloscope to know that It doesn't get close to my assumption "...at least two periods with a steady frequency lasting at least say 100 ms."!

I would test if I could produce a pulse train from the amplitude peaks of the siren sound and measure the repetition rate to see if that is regular enough to use as a trigger.

Yes, that's basically what I had in mind. And treating detection of a few peaks closely similar in amplitude, within a short time, as a reliable trigger point.

But alternatively @Jevray could just amplify the original for the external deterrent. Unless a radically different one is needed, perhaps recorded on mSD for a DFR MP3 player. Loudly barking dog(s), or explicit message, etc.

Yes I already have an external amplified barking dog deterrent, to the rear using pir sensors, but prone to false triggering. Not good during the early hours when you’re fast asleep. If I could dismantle the camera easily without damage then the job is straight forward, disconnect the siren from the camera and connect directly to the main alarm system. Using a mic means insulating it from unwanted noises creating false triggering. The idea of comparing the cameras siren, to a stored siren copy and producing a matched output, eliminates any possibility of noise interference.