Calculating the resistor for a buzzer

Please note: Although this question tangentially involves a Raspberry Pi, this is really more just a pure robotics question at heart.

I'm trying to connect my Raspberry Pi 1 Model A to this buzzer. I've seen wiring diagrams of this in action, and believe I need to put a resistor in between the buzzer and the (3.3V) output GPIO pin. If this is incorrect, please begin by correcting me!

My question is: how do I calculate the required ohms of this resistor? This particular buzzer is rated at 6VDC.

• A lazy approach would be to use a current meter and start with a high resistor and work your way down, stopping before you draw 45mA. I would start around 100 ohms. Sep 12, 2017 at 3:50

• You don't need a resistor in series, unless you want to decrease the volume. If that's what you want then it makes sense to have a resistance around the operating resistance of the buzzer which is $\frac{3.3}{(45\times 10^{-3})}=R$ (from $V=IR$). The capacitor is again only needed if you want this series resistance to decrease the volume, in which case a $1\mu F$ capacitor would be enough for this small device. Sep 17, 2017 at 0:05