How to achieve max. power of speaker

Hey guys,
my first language is German, so don't be surprised by English mistakes.

I'm beginner/early intermediate and I played with some random speaker I demounted from an old subwoofer.
The 9V power supply includes a watt meter so I expected the speaker to draw 9W.
But no matter which value the resistor has, the max. power consumption is only about 3W to 4W (I switched the resistor with a potentiometer and adjusted the restistance... the wattage is the same).
I'm using an Arduino Uno.
How can I achieve a greater power consumption?

Canon_in_D.ino (5.61 KB)

You are probably "loosing" too much voltage across the transistor. If you have a multimeter, measure the voltage directly across the speaker and also across the transistor. A MOSFET driver usually has lower on-resistance so you don't loose as much voltage and the MOSFET runs cooler.

Did you try connecting the speaker directly to 9VDC? (Don't leave it connected too long!)

The DC resistance of the voice coil is usually less than the rated AC impedance so you might get more power than calculated with continuous DC.

And the transistor may be overheating... If it's too hot to touch that's a "warning sign".

Be careful with speaker ratings - A 15W speaker is supposed to handle regular voice or music program material where the peaks occasionally hit 15W and a much lower average power. (If you "play" a square wave with that circuit, it's off half of the time so that's only half of the continuous DC power, but it might still be too much.)

That is a very bad circuit because the speaker can only move the cone from the rest position to one side. That at a stroke halves the amount of signal you can get from the speaker.
And putting a flyback diode across it makes sure that any signal is clipped.

That sort of amplifier is called a class A amplifier. To do that correctly you need to replace the speaker with an 8R resistor, and connect the speaker from the collector of the transistor through a large capacitor to ground.

That will allow the cone to move both ways. You will never see the power reflected in the current reading unless your meter is capable of measuring current at the frequency of the signal, which is not possible on ordinary DVMs.

You are losing over 20% of your power in the transistor. Replace it with a logic level UIS rated MOSFET. With that you will not need the diode. The lower the RDSon the colder it will operate. You should be able to run this without a heat sink and hold a TO220 version of the MOSFET in your fingers. I remember this from another post or is this possibly a class assignment; It had the same schematic and question.

With a 9V single supply and single-ended analog amp I'd expect an 8 ohm speaker to draw up to 1.25W
maximum with an ideal amplifier and sinusoidal signal, and upto 2.5W with a square wave.

Certainly not 9W... An AC signal constrained to a peak-to-peak range of 9V is not a 9V signal

As you have a 15W rated speaker I'd imagine you want to get the most out of it.

For this you'll need to use a bridge-mode amplifier, so you can get upto 18V peak-to-peak
and a sinusoidal power of upto 5W and square wave upto 10W

For best efficiency a class-D amplifer module capable of handling 9V supply would be a good

You then have to condition the signal into the class D amp to be basically analog and of the
right level.

You could take a square wave signal directly and feed it through a suitable MOSFET motor driver
H-bridge to drive the speaker - this is effectively digital input class-D.

Your decision to use a free-wheel diode is understandable - however speaker coils
are much more resistive than inductive and it is not generally needed for analog audio, and
is unlikely to be needed for digital switching of a speaker either.