Current draw with speaker using ToneAC library

I have got a simple system using a hall sensor to detect the opening of a door and trigger a speaker to play a small jingle.
However I am concerned about the speakers current draw. From my understanding the Uno can safely supply a max of 40mA, but 20mA is ideal.
When measuring current through the dc port, it sits at 25mA idle and shoots up to about 80mA when the speaker is making noise, so the speaker is drawing 55mA.

The speaker is being powered by the ToneAC library however, and so is connected through 2 pins, as shown.


Would I be correct in assuming that the 55mA is being distributed evenly between the 2 pins, meaning safe operation?

Also does the Nano have the same limitations? As that is what this project will actually be running on.

No, each pin has to handle the full 80mA and is overloaded.

Edit: 55mA if 25mA is for the controller itself.

I wonder what kind of speaker you are using. A piezo is better suited for direct drive by the controller, otherwise an audio amplifier is required.

If its a Piezo, it should technically work. If its a speaker, the MCU cant provide enough current over its pins for it. A simple Transistor circuit should work. Something like this:
Unbenannt

The current is the same if you connect things in series and this is what you did

Oh, I see. But wouldn't it be 55mA since 25mA is being used by the Arduino itself? I am measuring total current draw in the whole system.

A piezo doesn't have anywhere near the volume of the speaker I currently have hooked up
It seems a transistor with an external power source is necessary.

Yes, same chip, same limitations. Other chips usually have even lower limits, for example most 32-bit chips like SAMD21 and ESP8266 have limits of only around 10~12mA

Those are electromagnetic speakers. What is the coil resistance? Generally you would place a resistor in series with the speaker if driving directly from Arduino pins. This would reduce the volume but avoid damaging the Arduino pins.

Maybe, but @Caelanj is using the ACtone library, which achieves higher volume by giving the speaker/piezo an AC square wave signal, moving the cone or diaphragm through a larger range of positions. A simple transistor circuit like the one shown can only move the cone in one direction, but move it further by using more current. With that circuit, @Caelanj might as well use the standard tone function, there is no point using the AC tone library with such a simple circuit.

It's 8 ohm.
Yes I am aware, but the volume isn't quite enough with a resistor. That's why I am looking for an alternative.

Yeh, it seems my best bet is to use that circuit with an external power source, and just use the regular tone library.
Thanks for the detailed reply

Ohm's Law says Current = Voltage / Resistance.
5V / 8-Ohm = 625mA.

But what's happening is that the Arduino can't put-out that much current. It's being "stressed" and it's not able to put-out 5V with the low-impedance load.

You better use an audio amplifier or an H-bridge for best use of your speaker.