One piezo speaker, two pins (Arduboy)

I'm working on an Arduboy clone. The original schematics show that a speaker is attached between pins 5 and 13:

...along with a 4.7 µF capacitor.

The Arduboy lib has two sound objects, one operating on pin 5 and the other on pin 13. Does that really work? One can send a simple square wave on either and the single buzzer beeps that tone. And if both pins send their own frequency, some kind of mean wave will operate on the piezo element, creating a sound with both frequencies audible?

That's taken into consideration for the specific ArduboyTones library.

Tone can specify that it's to be played at either normal or a higher volume. High volume is accomplished by taking advantage of the speaker being wired across two pins and toggling each pin opposite to the other, which will generate twice the normal voltage across the speaker. For normal volume, one pin is toggled while the other is held low.

The capacitor is completely pointless as piezo elements are already capacitors, and
an antiphase signal like this is already DC-free.

What would be nice is a 150 ohm resistor in series to limit the current from the pins
to within specification.

Not impressed by this bit of circuit design in the Arduboy!

And yes if you drive each pin with a different frequency you'll get a mix of both at
the speaker. But please use a resistor...

1 Like

I think they know it, they either saved a few cents because that was kinda working and did not know better when designing the circuit...

they say in the blog:

Piezo Speaker
Two pins, A2 and A3 directly drive a piezoelectric element inside of a small black plastic housing. Caution there is no circuit protection these pins: Theoretically there could be some problems with driving both pins as outputs, we suggest configuring one pin to input. In practice this has not caused any issues to date but please comment if you have any issues!

Of course the camel's back is really robust in practice (until the last straw is added, that is!)

1 Like

:slight_smile: indeed

a piezo has high resistance.
toneAC library uses speaker or piezo wired to two pins. it allows higher volume and volume levels

They are constructed more like a capacitor with no DC resistance, just an AC impedance. If you apply a voltage across a discharged capacitor you'll get a high current demand and you are stressing the arduino’s output pin. That's why a resistor is useful (to stay below the 40mA). But because the camel's back is robust (@MarkT ™) , it's usually not a problem

A piezo is a capacitor, so it has a very low impedance to logic edges on the timescale
of nanoseconds.

Ceramic decoupling caps and piezo elements are the same sort of material, ferro-electric ceramics. A piezo element can have several nF of capacitance.

so what does it mean for AC at sound frequency (around 2 kHz) between two pins?

I just avoid stressing the component above its "absolute maximum ratings" in the datasheet, leads to predictable outcome and no worries.

Maybe the chip can take it - but to prove that means characterizing it which is a
time-consuming and tedious process which has to be repeated everytime new
silicon is released - best to leave that to the manufacturer unless its economically
worth it to you. One resistor is easy, cheap, and might save you from other issues
like someone replacing the piezo with an 8 ohm speaker!

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