Lesson 10 Buzzer Module

Share for us
Share on facebook
Share on twitter
Share on pinterest
Share on whatsapp

Introduction

Buzzers can be categorized as active and passive ones (See the following picture).

Required Components

 1 * Raspberry Pi

– 1 * Breadboard

– 1 * Passive buzzer module

– 1 * Active buzzer module

– 1 * 3-Pin anti-reverse cable

Experimental Principle

Place the pins of two buzzers face up and you can see the one with a green circuit board is a passive buzzer, while the other with a black tape, instead of a board, is an active buzzer.

The difference between an active buzzer and a passive buzzer is:

An active buzzer has a built-in oscillating source, so it will make sounds when electrified. But a passive buzzer does not have such source, so it will not beep if DC signals are used; instead, you need to use square waves whose frequency is between 2K and 5K to drive it. The active buzzer is often more expensive than the passive one because of multiple built-in oscillating circuits.  

The schematic diagram of the module is as shown below:

Experimental Procedures

Active Buzzer

Note: 

The active buzzer has built-in oscillating source, so it will beep as long as it is wired up, but it can only beep with fixed frequency. 

Step 1: Build the circuit.

For C Users:

Step 2: Change directory. 

    cd /home/pi/SunFounder_SensorKit_for_RPi2/C/10_active_buzzer/

Step 3: Compile.

    gcc active_buzzer.c -lwiringPi

Step 4: Run.

    sudo ./a.out

For Python Users:

Step 2: Change directory. 

    cd /home/pi/SunFounder_SensorKit_for_RPi2/Python/

Step 3: Run.

    sudo python3 10_active_buzzer.py

Now you can hear the active buzzer beeping.

Passive Buzzer

Step 1: Build the circuit. 

Raspberry PiGPIO Extension BoardPassive Buzzer Module
GPIO0GPIO17SIG
3.3V3V3VCC
GNDGNDGND

For C Users:

Step 2: Change directory. 

    cd /home/pi/SunFounder_SensorKit_for_RPi2/C/10_passive_buzzer/

Step 3: Compile.

    gcc passive_buzzer.c -lwiringPi

Step 4: Run.

    sudo ./a.out

For Python Users:

Step 2: Change directory. 

    cd /home/pi/SunFounder_SensorKit_for_RPi2/Python/

Step 3: Run.

    sudo python3 10_passive_buzzer.py

Now you can hear the passive buzzer playing music..