Active piezo buzzers wont work on pin HIGH, but do work on the output 3.3 voltage

Hi,
I'm using a arduino nano 3.3 BLE.

I'm trying to power an active piezo buzzer with a digital pin. But it wont make a sound, just a small click when it changes from high or low.

But if it connect the buzzer from GND straight to +3.3V pin, it do make a high pitch sound. When i set a pin to high, they also provide 3.3V but the buzzer don't want to make a sound then.

What am I doing wrong? This works on my UNO.

void setup() {
  pinMode(2, OUTPUT);    // sets the digital pin 13 as output
}

void loop() {
  digitalWrite(2, HIGH); // sets the digital pin 13 on
  delay(1000);            // waits for a second
  digitalWrite(2, LOW);  // sets the digital pin 13 off
  delay(1000);            // waits for a second
}

I've also tried using tone(); but it wont make as high a sound.

Does the plastic case have a "+" molded into case? If so, are you connecting that pin to the Arduino control pin and the other piezo pin to the Arduino ground?

Yes it does, but for the sake of ruling things out i've tested both ways.

The pins of an Uno can source up to 40mA before they become damaged. (That should be kept to 20~30mA for long life).

The pins of a Nano 33 BLE cannot provide as much current, only 10mA before they become damaged. That is probably not enough to operate your sounder. You may have already damaged the Nano by connecting it.

You probably need to use a transistor to provide the current for the sounder, so the Nano pin only needs to provide a small current to operate the transistor.

The active buzzer may require more current than the Arduino can supply. (The I/O pins are rated for 40mA "absolute maximum".)

Usually a passive piezo will work but an active buzzer needs "power" to drive it's internal tone generator.

If you don't have the specs and if you do have a multimeter, write a high with nothing but the meter connected and you should get around 5V. Then connect the buzzer to see if the voltage holds-up. It will probably drop a little but it shouldn't drop to 3.3V or less.

Or if you don't have a meter, try pin 13 and if the built-in LED dims when you connect the buzzer, that's the problem.

Not for Nano 33BLE.

Again, not for Nano 33BLE.

You probably need to use a transistor to provide the current for the sounder, so the Nano pin only needs to provide a small current to operate the transistor.

You are most likely right. Thank you, I'm really shit a the electrical points of things, but I'm trying to learn.
Will try this out!

Yes that worked!!
Thank you so much!

Luckily enough i had some transistors in my old start up kit. Just have never used them or known what they were for. You learn something new every day :slight_smile:
Now i can finally finish my project.

Then you really should post a schematic showing how you connected the transistor, Nano and sounder, in case you are still damaging to the Nano's pin, even though the sounder is working now. Don't forget to include the model of transistor you are using.

It's an NPN transistor. PN2222

Left "foot" to ground
Middle foot goes to Pin 2 on the arduino board.
Right foot to the buzzers - side

Buzzers + side goes to 3.3V.

Does that sound right?

Would it work with 5V?

EDIT:
Hmm after looking at the datasheet, I think it should be switched between left and right from how I tested it.

Don't get caught by the difference between between a 2N2222 and PN2222!

  • List item

The electrical world is so confusing xD
But I'm pretty sure i have pn2222 and is what I'm looking at to wire it.
Thanks for the heads up.

The "middle foot", the base, of an N-P-N must be connected to the Arduino pin using a resistor. Without the resistor, too much current will flow and the Arduino pin will be damaged. Resistor should be at least 330R.

Alright, thank you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.