Generate a buzzing sound using Raspberry Pi + Piezo drum disc sounder + RPi-PDDB gem

A photo of a piezo drum disc sounder with milk bottle top sound amplifier

To run the following code I hooked up a piezo drum disc sounder with the red wire connected to pin 4 and the black wire connected to ground on the Raspberry Pi. To amplify the sound I placed the buzzer in an old plastic milk bottle top.

Example code

require 'rpi-pddb'

r = RPiPDDB.new(4)
r.buzz

Output

Listen to the buzz generated below.

Resources