Problem driving a 12v active buzzer with a Nano


I’m trying to use a Nano to drive a 12v active buzzer, the data sheet for which can be found here.

If I apply 12v directly to the buzzer it emits a tone, so I’m fairly confident it is working as expected.

However when I deploy it in the circuit attached, I only get a faint clicking sound when the output pin is driven high.

I’m powering both the Nano and the buzzer from a 12v 2A supply, using the Vin pin on the Nano.

I’ve checked the current into the transistor base and it is 1mA when the pin is high, with 12v across the buzzer.

If I understand correctly, the 1mA base current should be more than sufficient to allow the buzzer to draw the (max) 30mA the data sheet indicates that it will consume.

To confound matters, if I switch out the Nano and put an Uno in it’s place, the circuit works perfectly.

In all other respects the Nano seems to be working fine and I’ve tried a couple, all of which demonstrate the same behaviour.

Is there something I am overlooking with the operation of the Nano?

Any suggestions on how to get this working would be greatly appreciated.



Check the voltage across collector to emitter when the transistor is on. I think you’ll find you need more base current to turn the transistor hard on than you are providing . Just try 1k from the Arduino to the base, and no resistor to ground.

You should have ground ( 0v)going back to the power supply too, I assume that’s a drawing mistake ....
Check you have the transistor and diode connections right too !


How to post images so we don't have to download them.

Thanks for the reply and to groundFungus for sorting my image.

The voltage between the collector and the emitter is showing as 11.8v when the transistor is on.

The same is true with a 1K resistor between the Arduino and the base with the pulldown resistor removed.

I'm pretty sure everything is wired correctly as it all works perfectly when I swap in the Uno.

The voltage between the collector and the emitter is showing as 11.8v when the transistor is on.

No, the collector - emitter voltage should be near 0V when the transistor is ON.
How do you know the transistor is ON?

When the transistor is ON, you should have nearly 12V ACROSS the buzzer.

On the NANO what voltage do you measure between gnd and the 5V pin?

Can you post a picture of your project with UNO and then with NANO in circuit so we can see your component layout?

Thanks.. Tom... :slight_smile:

between the collector and the emitter is showing as 11.8v when the transistor is on.

That means that the transistor is not conducting. It is not "on". Vce(sat) (the voltage from collector to emitter when the transistor is saturated or fully on) is listed in the data sheet and if you look you will see that Vce(sat) is low (0.3 to 1.0V). Drop the base resistor to, say, 220 to 180 Ohms and try that.

From the 2N2222
Collector−Emitter Saturation Voltage (Note 1)
(IC = 150 mAdc, IB = 15 mAdc) 0.3Vdc
(IC = 500 mAdc, IB = 50 mAdc)1.0Vdc

You have not posted any code so I'll ask, is pin 12 pinMode set to OUTPUT?
Have you tried a different output pin?

Sorry, you are quite right. My test sketch is based on the standard LED blink, alternating the pin output high and low and I took the measurement at the wrong point in the cycle. When the pin output is permanently set to high I am getting 0v between the collector and emitter and about 11.9v across the buzzer.

The voltage between the GND and 5v pins is showing as around 4.95v.

I get the same result if I use another pin.

Looking at the drawing on the data sheet, I notice that the lengths of the pins are different. That leads me to wonder if the device has polarity. Are there any markings that may show polarity? Have you tried reversing the buzzer (turn it 180 in the breeadboard)?

What voltages do you measure between gnd and D12 on the UNO and NANO as you try to activate the buzzer with your code?

Does your test code cycle the buzzer ON/OFF every couple of seconds for debugging?

Can you post a copy of your test code please?

Thanks.. Tom... :slight_smile:

You seem to have connected collector to ground and emitter to the buzzer.
Rotate the 2N2222A 180 degrees.

4k7 is ok for a 30mA load.
The 10k resistor is not needed for a current driven BJT, can remove.

Thanks to all for the suggestions.

The buzzer does have one leg longer than the other. There are no polarity markings but I've assumed this longer leg to be the positive. Connecting 12v directly to it in this fashion results in a tone. If I reverse the connection I get nothing.

Reducing the value of the base resistor to 220 Ohms makes no difference.

I'm sure the transistor emitter and collector are wired correctly. The different orientation on these to what seems to be the more standard configuration has caught me out in the past. I've also tried switching out the transistor and replacing it with a FQP30N06L MOSFET. Again this works fine on the Uno, still no joy when paired with the Nano.

I get 4.97v between D12 and GND on the Nano, 4.93v on the Uno.

My cycling test code is:

const byte pin = 12;
const int delay_ms = 5000;

void setup() {
  pinMode(pin, OUTPUT);

void loop() {
  digitalWrite(pin, HIGH);
  digitalWrite(pin, LOW);

To clarify, I do not have the Nano/Uno connected to USB when the 12v input supply is attached.

In further testing I've found that if I power the Nano via the USB socket and power the buzzer via the 5v pin it works fine, emitting a tone and switching on and off as expected. It also works if I power the Nano with 12v via the VIN pin and have the buzzer powered from the 5v pin.

I've also tried a different 12v power supply, same results.

I'm almost tempted to concede defeat and run the buzzer at 5v but as this is just a section of a wider circuit with other 12v components I'd really like to get it working, or at least understand what the issue is.

Well after lots more testing I think the buzzer itself must have some sort of fault. Stupidly that was pretty much the only component I hadn't swapped and wouldn't you know it, when I finally thought to replace it (with another one of the same model), it worked perfectly when driven by the Nano.

I don't understand why the original buzzer worked successfully with the Uno but at least I've got something working now.

Thanks to everyone who offered advice.