Siren Generator - German Fire Truck Air Horn

I²S Siren Generator - Seamlessly Looping Short Audio Samples to Simulate a Fire Truck Air Horn

In this mini project, I am using a cheap ESP32-S2 Mini and a MAX98357A I²S Amplifier to create a German Firtruck Air Horn Player.

Since all signal processing is done digitally, the microcontroller can seamlessly loop a short audio sample to create emergency sounds of arbitrary length.

The hardware picked in this example was for convenience only: by coincidence, the pins of the ESP32-S2 Mini and the MAX98357A` I²S Amplifier overlap perfectly, so simple header pins are sufficient to mount the two PCBs back-to-back. You can of course use any I²S-capable MCU and combine it with any I²S amplifier board.

Overview

When you play back music tracks, gap-less looping is no issue at all. That’s why dedicated audio playback modules such as the popular DFPlayer Mini work extremely well for many scenarios. And even if you want to loop tracks, the DFPlayer Mini has a little-known AutoPlay Loop Mode so you can listen to your favorite music track all day long.

When it comes to emergency sirens, though, gap-less looping does become an issue. If you sample an audio signal like a siren or air horn, looping must work seamless. You can’t have a short click noise or period of silence after each wail. So with DFPlayer Mini and similar approaches, your only choice is to sample the audio for as long as you want it to run. That’s wasteful and awkward.

I²S and DMA

With I²S, seamless looping is no problem: the MCU controls the audio data that is transferred to I²S devices, and ESP32 MCUs support fast DMA (direct memory access) so a short sample can be loaded into a memory buffer and served to I²S over and over again.

Parts

Only a few parts are needed for this project:

I²S-compatible MCU board

In this project, I am using an affordable ESP32-S2 Mini. You can use any I²S-compliant microcontroller, however the automatic firmware uploader expects an ESP32-S2 Mini, and if you use a different MCU, you’d have to adjust the firmware yourself.

I²S Amplifier

I am using a low-cost MAX98357A breakout board. Any I²S amplifier board will do. This board takes the I²S input from the MCU and outputs a signal that can drive a 4-8 Ohms speaker.

Push Button

Any simple push button will do. The push button turns the air horn on and off.

Speaker

One speaker suitable for your I²S amplifier. Typically, the speaker needs to be 4-8 ohms. 4 ohm speakers produce more volume than 8 ohms speaker.

If you can get your hand on a real emergency vehicle air horn speaker, then this increases volume by about factor 5 which can make all the difference between a toy and a serious emergency sound generator. Such horns are available for cheap on second hand markets.

Wiring

Wiring is straight-forward, you just need some header pins and can mount MCU board and I²S amplifier board back-to-back:

Before you solder the MAX98357A to the ESP32-S2 board, add the speaker wires.

Use header pins to connect both boards. Do not connect pins GAIN and SD.

Add Push Button

To control the air horn, connect a push button to 39 and 3V3:

Add Speaker

To complete the setup, add a speaker.

When you add a regular speaker, the sound volume is on a toy level. When you add a professional horn speaker, sound volume is increased enormously due to the high acoustic efficiency, and the tiny 1-2 W I²S amplifier produces a warning sound so loud that it hurts the ears.

Installing Firmware

Connect the S2 Mini board to a USB port on your PC, then use the installation wizard to install the firmware, or click the button below:

Follow the instructions precisely: the S2 Mini is somewhat special in that it exposes two USB connections.

The connection shown by default cannot be used to upload firmware.

When the wizard opens the dialog with the available USB connections, on the S2 Mini board, hold button 0 and press button RST shortly to switch the S2 Mini to bootloader mode. The USB connections available in the browser dialog change, and a new connection called ESP32 S2 becomes visible visible. Select this one to upload the firmware.

Test Drive

Once the firmware is uploaded, press the push button. You should now hear a German fire truck air horn. It tuns continuously until you press the button again.

Note that the air horn isn’t turned off immediately. By German law, fire horns must play at least two cycles before they can be turned off.

Source Code

The complete source code as well as technical documentation can be found on github.

Slow Website?

This website is very fast, and pages should appear instantly. If this site is slow for you, then your routing may be messed up, and this issue does not only affect done.land, but potentially a few other websites and downloads as well. Here are simple steps to speed up your Internet experience and fix issues with slow websites and downloads..

Comments

Please do leave comments below. I am using utteran.ce, an open-source and ad-free light-weight commenting system.

Here is how your comments are stored

Whenever you leave a comment, a new github issue is created on your behalf.

  • All comments become trackable issues in the Github Issues section, and I (and you) can follow up on them.

  • There is no third-party provider, no disrupting ads, and everything remains transparent inside github.

Github Users Yes, Spammers No

To keep spammers out and comments attributable, all you do is log in using your (free) github account and grant utteranc.es the permission to submit issues on your behalf.

If you don’t have a github account yet, go get yourself one - it’s free and simple.

If for any reason you do not feel comfortable with letting the commenting system submit issues for you, then visit Github Issues directly, i.e. by clicking the red button Submit Issue at the bottom of each page, and submit your issue manually. You control everything.

Discussions

For chit-chat and quick questions, feel free to visit and participate in Discussions. They work much like classic forums or bulletin boards. Just keep in mind: your valued input isn’t equally well trackable there.

  Show on Github    Submit Issue

(content created Dec 02, 2026)