Another illustration that demonstrate how to use the buzzer both passive and active. The difference between an active and passive is. The active buzzer has a built in oscillating source that will make a sound when amplifying a power compare to passive buzzer does not have such a source so it means that no beep or sound will generate when it plug to the power source on this case you need to use a square wave frequency to make a sound between 2k and 5k. As you can see diagram below there are two option to wire up the buzzer.
The active buzzer has onboard oscillating source it will beep as long as it is wired up but it can only beep with fixed frequency.
Required Component
- Raspberry Pi / Banana Pi / Orange Pi (If your using Banana Pi or Orange Pi See first the GPIO Pins)
- Buzzer Active / Passive Module
- Solder Less Breadboard
- Jumper Wire / DuPont Wire
Wiring Manually
- 10k Resistor /
- NPN Transistor (2N222)
- External Battery (5~9v)
Wiring Diagram
Uploading the Code
WiringPi Code for Active Buzzer
[crayon-673fa088b7f27677683776/]
Python Code for Active Buzzer
[crayon-673fa088b7f32213913814/]
WiringPi Code for Passive Buzzer
[crayon-673fa088b7f38273918061/]
Python Code for Passive Buzzer
[crayon-673fa088b7f3e112209697/]