# 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. – combo Sep 12 '17 at 3:50

Without a more detailed spec sheet I can't say for sure, but this is my understanding: The buzzer has a self-drive circuit is rated for input 6V max, at which point it will pull 45mA and oscillate at 300-500Hz. You don't need to explicitly limit the current into the buzzer, however 3.3V may not be enough to turn on the drive circuit.

I also recommend enabling in software the pull-down resistor of the pin you will be using.

Putting a resistor between the output pin and the buzzer will decrease the voltage across the buzzer and limit the current through it, which will reduce the volume. It can also cause unwanted ringing without the use of a capacitor in parallel. See page 31 of this document for an example.

• Thanks @Gouda (+1) - I will have to check to see if it is possible to enable the pull-down resistor at the software layer. I have a few questions if you don't mind: (1) what strength resistor do you recommend I use (how many ohms)? (2) I assume you're recommending the capacitor because the GPIO output pin may always be sending a little bit of signal to the buzzer, and you're saying the capacitor will help prevent that yes? If so, what size capacitor do you recommend? – smeeb Sep 16 '17 at 9:20
• 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. – Gouda Sep 17 '17 at 0:05