Arduino Nano 33 IoT - Siren
In this guide, we will learn how to use the Arduino Nano 33 IoT to control a siren that makes a warning sound and/or light.

Hardware Preparation
Or you can buy the following sensor kits:
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Overview of Siren
Depending on the maker, a siren may make a loud noise or show a warning light, so it works well in an alarm system. It also works with different power levels. In this lesson, we will use a 12V siren, but the other power options work in much the same way.
Pinout

A 12-volt siren normally has two metal connectors.
- Black wire (negative): connect this to the GND (ground) terminal on the DC power source.
- Red wire (positive): connect this to the 12V terminal on the DC power source.
How to Control a Siren
If you connect a 12V siren to a 12V power source, it will make noise or flash a warning light. To control this siren with an Arduino Nano 33 IoT, you need to use a relay between the Arduino and the siren. The Arduino can then turn the siren on and off through the relay. If you are not familiar with relays (their pins, how they work, how to program them, etc.), please check out the Arduino Nano 33 IoT - Relay tutorial.
Wiring Diagram

This image is created using Fritzing. Click to enlarge image
Arduino Nano 33 IoT Code
The code below continuously switches a 12V siren on for three seconds and off for five seconds.
Detailed Instructions
If you are new to the Arduino Nano 33 IoT, be sure to check out our Getting Started with Arduino Nano 33 IoT tutorial. Then, follow these steps:
- Connect the components to the Arduino Nano 33 IoT board as depicted in the diagram.
- Use a USB cable to connect the Arduino Nano 33 IoT board to your computer.
- Launch the Arduino IDE on your computer.
- Select the Arduino Nano 33 IoT board and choose its corresponding COM port.
- Copy the code above and open it in the Arduino IDE.
- Click the Upload button in the Arduino IDE to send the code to your Arduino Nano 33 IoT.
- Check the siren to see if it is working.
Code Explanation
Please check the comments in the Arduino code above for the explanation.