Arduino Buzzer Connection Circuit

A buzzer can be directly connected to an Arduino if it operates at the same voltage as the Arduino (usually 5V) and does not need to draw more current than an Arduino pin can deliver.

But what if the buzzer operates at a different voltage to the Arduino and / or needs to draw more current than the Arduino pin is capable of supplying? One solution is to use a transistor to interface the buzzer to the Arduino. The Arduino buzzer transistor connection circuit on the Starting Electronics website shows how to connect the buzzer to the Arduino using an NPN transistor.

Note that the piezo buzzer used in the circuit is not a plain piezo element, but sold as a piezo buzzer that has built-in circuitry that makes the buzzing sound when power is applied to it.