This sound alternator is designed to simulate the effects of a police siren, combining sound and light to create a dynamic audio-visual experience. It uses an ESP32, a small speaker, and two red LEDs to alternate between sound signals and blinking lights.
Control is achieved through code written in the Arduino IDE or MicroPython, utilising the GPIO pins of the ESP32.
The ESP32 regulates the sound frequency, enabling the speaker to mimic the distinct tones of a police siren.
Simultaneously, it controls the voltage across the LEDs, causing them to alternate in illumination.
Fig. 1 showcases the prototype on a breadboard, with the required components listed in the Bill of Materials table.
Bill of Materials | |
Components | Quantity |
ESP32 (MOD1) | 1 |
0.5W speaker (SP1) | 1 |
BC547 transistor (T1) | 1 |
10µF, 16V capacitor (C1) | 1 |
100kΩ resistor (R3) | 1 |
100Ω resistor (R1, R2) | 2 |
5mm red LEDs (LED1, LED 2) | 2 |
Sound Alternator Circuit and Working
Fig. 2 shows the circuit diagram of the sound alternator, which is built using the ESP32 board, BC547 transistor, two red LEDs, a speaker, and other components.
The circuit includes a transistor connected to a breadboard. A 100k resistor is placed across the base and collector junction of the transistor. The capacitor’s negative terminal is connected to the base of the transistor, and its positive terminal is linked to pin G21 of the ESP32.
One terminal of the speaker is connected to the 5V pin of the ESP32, while its other terminal is connected to the collector of the transistor.
The emitter of the transistor is grounded by connecting it to the ESP32’s ground pin. The LEDs are also grounded via 100-ohm resistors (R1 and R2) to limit the current.
The anode of LED1 is connected to pin G4 of the ESP32, while the anode of LED2 is connected to pin G0. The ESP32 controls both LEDs and the speaker.
The code can be developed in IDEs such as MicroPython, Arduino IDE, or similar. SmowCode has been used here to create the code for the device.
As shown in Fig. 3, code blocks are joined. The board should be selected as ESP32-S2, and the code should be uploaded to the device.
Construction and Testing
To construct and test the device, download the firmware in .bin format from the website or create code by modifying the nodes.
Once the code blocks are set (refer to Fig. 3), upload the code to the ESP32 board after selecting the correct COM port and board.
Assemble the device on the breadboard as per the wiring diagram in Fig. 4.
Power the device. Once powered, the LEDs will alternate in illumination, and the speaker will produce a sound mimicking a police siren.
Also Check: Police and Ambulance Siren Generation Using Arduino
Shaikh Faiza is a passionate electronics engineer.