Generating a sound signal is a common goal in many DIY projects, which is why makers need to use various devices to create that sound. One device you can use is a small speaker, although that's not ideal if you're only sending an electrical signal, as it will produce a characteristic crackling or popping sound due to the diaphragm's vibration, but it won't be very loud. Therefore, it's best to use a buzzer.
The size is usually much smaller than conventional speakers, and what's more, the buzzer will generate a beep or sound that will attract more attention than the sound of a speaker without an audio signal. So, if you're a maker and want to generate any kind of alert for an event in your project, the device we're presenting today will be perfect for you…
What is a buzzer or buzzer?

A buzzer is an electronic device that acts as a transducer . Its function is to produce a high-pitched sound or buzz when it is supplied with current. This makes it ideal for integration with Arduino, because when an event occurs that you want to be notified about, you can program the microcontroller to send a signal to the buzzer, alerting you with that sound.
For example , if you've used a temperature sensor and want it to alert you when it exceeds 100°C, you can use the buzzer as the alert device. Arduino will then send an electrical signal to the buzzer when the temperature sensor reaches that reading. Clearly, the applications you'll find for this are incredibly varied…
In your home, you'll find many devices that contain buzzers , such as alarm clocks. Many of these clocks use buzzers to emit sounds, especially the smaller ones, although some may use speakers to wake you up with the radio, a melody, etc. The truth is, you don't have to take anything apart to get a buzzer ; in fact, they're very cheap and easy to find.
Types of buzzers
You can find several types , apart from those that use an electromagnet coil or piezoelectric disc you can also find:
- Those who do not integrate oscillator: in this case an external oscillator is required for it to work well.
- Those who integrated oscillator- The built-in oscillator makes it easy to operate, simply apply a voltage to the buzzer or buzzer terminals and you will have the sound.
It's important to remember that there are also special modules for Arduino with the buzzer and everything needed for easy connection to your favorite DIY board.
Operation
Its construction is simple: it only has an electromagnet or piezoelectric disc (depending on the type of buzzer) and a steel metal sheet. That's all it needs to emit sound when current is supplied to the piezoelectric element or electromagnet, causing the metal sheet to vibrate.
The most common type is piezoelectric, which consists of a metal plate bonded to a ceramic plate. When a voltage is applied between the two, the plate arcs and emits a click. When the voltage is removed, they return to their normal state. However, if clock or alternating pulses are generated, they will emit the audible beeps we are looking for.
Integration with Arduino

Its integration with Arduino couldn't be simpler; whether you buy a regular buzzer or a passive module for Arduino, it can be connected very easily, and the code you have to write in the Arduino IDE is truly simple too (the basics, then it will depend on what you want to add).
As for a simple code example , it could be the following, in which the buzzer emits sound for 1 second and stops, then emits sound again for 1 second, and so on:
/* Programa simple para emitir pitidos de 1 segundo intermitentes */ const int buzzer = 9; //El pin al que se conecta el buzzer es el 9 void setup(){ pinMode(buzzer, OUTPUT); // Pin 9 declarado como salida } void loop(){ tone(buzzer, 50); // EnvÃa señal de 1Khz al zumbador delay(1000); noTone(buzzer); // Detiene el zumbador delay(1000); //Espera un segundo y vuelve a repetir el bucle }More information – Arduino programming manual
Table of Contents