Data Sheet

UCTRONICS Ultimate Starter Leaning Kit for Raspberry Pi #K0064
59 www.uctronics.com
8.3 Project 3: Passive Buzzer
8.3.1 Overview
In this lesson, we will learn how to program the Raspberry Pi to make a passive buzzer sound
with different frequency.
8.3.2 Requirement
Raspberry Pi ×1
Passive buzzer ×1
1 kΩ Resistor ×1
NPN Transistor (S8050) ×1
Breadboard ×1
Several Jumper wires
8.3.3 Principle
1. What
s Active Buzzer ?
Please refer to chapter 3.17 Buzzer
2. Key functions
Python user:
GPIO.cleanup( )
At the end any program, it is good practice to clean up any resources you might have used.
This is no different with RPi.GPIO. By returning all channels you have used back to inputs with
no pull up/down, you can avoid accidental damage to your RPi by shorting out the pins.
Note that this will only clean up GPIO channels that your script has used. Note that
GPIO.cleanup() also clears the pin numbering system in use.
p = GPIO.PWM(channel, frequency)
To create a PWM instance
p.start(dc)
To start PWM.
p.ChangeFrequency(freq)