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

passiv-active-buzzer-raspberrypi-rpi-14core-wiringpi

Uploading the Code

running-c-code-python-in-raspberrypi-cli

WiringPi Code for Active Buzzer

Python Code for Active Buzzer

WiringPi Code for Passive Buzzer

Python Code for Passive Buzzer

Wiring the Passive & Active Buzzer with Raspberry Pi
Facebooktwitterredditpinterestmail
Tagged on:                         

JLCPCBPCBgogoPCBway4pcb

2 thoughts on “Wiring the Passive & Active Buzzer with Raspberry Pi

  • at
    Permalink

    File “/home/pi/SmartHome/passive_buzzer.py”, line 34, in
    GPIO.setup(BuzzerPin, GPIO.OUT) # Set pins’ mode is output
    RuntimeError: Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)

    Reply
  • at
    Permalink

    Python: had to copy setup and setmode commands before the “setup()”. Absolutely no indentation for some reason.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *