ToolSphere
All perfboard layouts

Arduino Piezo Driver Perfboard Layout

An Arduino-compatible 5 V GPIO switches a passive piezo through an NPN. The piezo connects through a two-pin header; its real mounting geometry is not invented.

Arduino NPN piezo driver perfboard layoutJ1 ARDUINOJ2 5VBZ1 PASSIVE PIEZOQ1 2N3904R1 1k8R2 220RR3 10kR4 100kC1 100n
Open this layout in the simulator Connection check: no shorts, 6 named nets

Red wires carry power, white is ground, yellow and blue are signals. Every hole is an isolated pad; connections are the wires shown. In the simulator you can move parts, add your own and re-run the check.

Parts list

As an Amazon Associate, ToolSphere earns from qualifying purchases.

How it works

The GPIO drives the base through 1.8 kΩ, the emitter is grounded, and the collector switches the piezo's lower terminal. R2 limits feed current; R3 sits across the piezo so its capacitance can discharge when the transistor turns off. A passive piezo needs a changing signal such as tone(), not a permanently high GPIO.

For the stated 5 V supply, assumed VCE(sat) = 0.2 V and 220 Ω feed resistor, the switch library computes an initial current-limit estimate of 21.82 mA. At forced beta 10, it requests 2.182 mA base current and selects 1.8 kΩ from E12 below the calculated maximum of 1970.8 Ω. With an assumed 0.7 V base-emitter drop, that resistor supplies 2.389 mA before the small 100 kΩ pulldown current. These are nominal switch-design calculations, not a measured piezo waveform or a universal transistor guarantee.

R3 is 10 kΩ across the capacitive piezo load; omitting it leaves the discharge behavior dependent on the transducer and leakage. Actual acoustic output depends on the piezo's capacitance, resonance, mounting and drive frequency. The feed resistor also affects the waveform. This is not an audio amplifier or a magnetic-buzzer coil driver.

Check the actual 2N3904 E/B/C package order and the controller's GPIO voltage/current limits. A 3.3 V GPIO needs its own base-drive calculation. Connect controller ground to the supply ground. Use isolated-pad perfboard and insulated underside jumpers; no track cuts are needed.

Building it, step by step

  1. Fit the NPN using the actual E/B/C pinout. Connect its emitter, both ground headers and the base pulldown return to GND.
  2. Wire the Arduino signal header through the 1.8 kΩ base resistor. Connect the 100 kΩ pulldown from base to ground.
  3. Run +5V through the 220 Ω feed resistor to the piezo positive header terminal. Connect its other terminal to the collector.
  4. Fit the 10 kΩ resistor across the piezo terminals and the local supply bypass capacitor.
  5. Check the unpowered connections. Drive the selected Arduino output with a tone or square wave; choose a controller pin compatible with the rest of your project.

Tools for this build

Frequently asked questions

Why is there a resistor across the piezo?

A passive piezo behaves partly as a capacitor. The parallel resistor provides a defined discharge path between switching pulses; the actual waveform still depends on the transducer.

Will holding the GPIO high make a continuous sound?

A passive piezo needs an alternating drive. A steady signal generally produces a transition click rather than a sustained tone.

Can I substitute a magnetic buzzer?

Not without redesigning for its current and inductive behavior, including an appropriate clamp where needed. This circuit is explicitly for a passive piezo load.

Can I use a lower-voltage microcontroller?

Recalculate the base drive for the actual output voltage and check the controller limits. The published resistor example assumes a 5 V logic high.