Making a piezo buzzer louder


#1

I recently bought this mini speaker from Pimoroni to use with my BBC:Microbit.
I’m trying to create a loud beep but the audio level is disappointingly low but according to the data sheet it has a typical output of 95db. To test it I’ve been using this simple code and it’s so faint:

import music
music.play(music.NYAN)

Am I doing something wrong? ( I read somewhere that buzzers/speakers have a resonate sound which might make it louder if I knew what that was).

Many thanks,

Julian


#2

It’s likely a combination of two things, the low output signal of the Micro Bit and the “mini” speaker.
I switched to this, https://shop.pimoroni.com/products/thin-speaker and its not bad. It’s like whats in those talking greeting cards.
You still won’t get really loud sound unless you switch to an amplified speaker though, Maybe something like this,
https://shop.pimoroni.com/products/speaker-for-micro-bit
I say “maybe” because I don’t currently own one.

The one you linked too looks more like a piezo buzzer than speaker. It states it audible around the 2K Hz range so try sounds more at that frequency.


#3

Great. Thank you for the advice. I’ll give this a go,


#4

How are you powering your Micro-Bit? I ask because when powered by USB you are very limited by how much current you can draw. You’ll get much better results if powered by batteries via the JST jack.
https://tech.microbit.org/hardware/
Scroll down to the power supply section. Basically, if you power it via the USB port, 5V gets regulated down to 3V , but that regulator is very limited in how much current it can supply. Power it via the battery jack and you bypass the regulator. There are still some limits on current per output pin but your total current draw can be a lot more if running on battery.


#5

Looking at the product page, you might be better off trying to drive it directly with write_analog(511)

This applies a 50% duty cycle which according to the product page should get you closer to the 95dBA you’re looking for.

Here’s the link to Microbit’s PWM docs for reference.


#6

I’ve only ever done the music.play . And to be honest, I haven’t touched my Micro-Bits in ages. Might be time to dust them off and get back at it.


#7

Thanks for the suggestion to try using write_analog(511). I’ve read the docs but am struggling with code, how to actually play a tone using write_analog(511)? Any clues you could give me?
pin0.write_analog(511) gives me a low buzz.

This gives me an ok tone that does sound more resonant.
tune = [“C7:40”]
music.play(tune)


#8

Many thanks. I’ve been using usb but have now been trying with my battery pack. Still working on the code to try and make a tone before I know if it’s louder.


#9

Just compared my Piezo buzzer from this kit, https://shop.pimoroni.com/products/sidekick-basic-kit-v2 with the thin mini speaker I have and loudness wise they are about the same. The speaker definitely sounded better but wasn’t really any louder. Not that my ears could tell. I can hear it quit plainly from a few feet away though.
music.play(music.BIRTHDAY,pin=microbit.pin0, wait=True, loop=False)


#10

Mine is definitely a buzzer more so than a speaker. If I connect it to the +3V and ground it emits a continuous tone. So that explains why my speaker sounds better.
http://wiki.seeedstudio.com/Sidekick_Basic_Kit_for_Arduino_V2/
A buzzer is an audio signaling device, which may be mechanical, electromechanical, or Piezoelectric. It produces various audio signal based on the oscillation of the material used in it. They are commonly used in alarms and timers.
The buzzer can be connected to digital outputs, and will emit a tone when the output is high. Alternatively, it can be connected to an analog pulse-width modulation output to generate various tones and effects.