Arduino Nano 33 IoT - Buzzer

In this lesson, we’ll learn how to use the Arduino Nano 33 IoT to control a 12V active buzzer that makes a loud noise. If you need to control a 5V active or passive buzzer, please check out this Arduino Nano 33 IoT Piezo Buzzer tutorial.

Hardware Preparation

1×Arduino Nano 33 IoT
1×Micro USB Cable
1×Relay
1×12V Active Buzzer
1×12V Power Adapter
1×Optionally, DC Power Jack
1×Breadboard
1×Jumper Wires
1×Recommended: Screw Terminal Expansion Board for Arduino Nano
1×Recommended: Breakout Expansion Board for Arduino Nano
1×Recommended: Power Splitter for Arduino Nano

Or you can buy the following sensor kits:

1×DIYables Sensor Kit (30 sensors/displays)
1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of 12V Active Buzzer

The 12V active buzzer makes a loud noise, which makes it great for alarm systems.

Pinout

Arduino Nano 33 IoT 12V Active Buzzer Pinout

A 12-volt active buzzer normally comes with two pins.

  • Negative (-) pin (black): Connect this to the ground (GND) of your DC power supply.
  • Positive (+) pin (red): Connect this to the 12V output of your DC power supply.

How to Control 12V Active Buzzer

If you connect a 12V active buzzer to a 12V power supply, it will produce sound. To make the buzzer work with an Arduino Nano 33 IoT, you need to connect a relay between them. The Arduino Nano 33 IoT can control the buzzer through the relay. If you are not sure about what a relay is, how its pins work, or how to program it, check out the Arduino Nano 33 IoT - Relay tutotial.

Wiring Diagram

The wiring diagram between Arduino Nano and 33 IoT 12V Active Buzzer

This image is created using Fritzing. Click to enlarge image

Arduino Nano 33 IoT Code

This code repeatedly turns the 12V active buzzer on for one second and then off for two seconds.

/* * This Arduino Nano 33 IoT code was developed by newbiely.com * * This Arduino Nano 33 IoT code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-nano-iot/arduino-nano-33-iot-buzzer */ #define RELAY_PIN 2 // The Arduino Nano 33 IoT that connects to relay to control the 12V buzzer // The setup function runs once on reset or power-up void setup() { // initialize digital pin as an output. pinMode(RELAY_PIN, OUTPUT); } void loop() { digitalWrite(RELAY_PIN, HIGH); delay(1000); digitalWrite(RELAY_PIN, LOW); delay(2000); }

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 paste it into the Arduino IDE.
  • Click the Upload button to send the code to the Arduino Nano 33 IoT.
  • Check the status of the 12V active buzzer.

Code Explanation

You can find the explanation in the comments of the Arduino code above.

Video Tutorial

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!