In a previous question i was told that you can put a capacitor between the Arduino and a jack connector speaker so that the signal changes between +2.5V and -2.5V. But if I do the same thing with a mosfet and a 12V power supply, it no longer works.
Since I only had n-channel mosfets I tried those two circuits:
If you use the circuit without the capacitor everything works fine, but the speaker isn't loud enough.
For the speaker I haven't found a datasheet. The only thing I know is that the speaker has 4 Ohm and 4 Watts. The article number is 7064-001 and its from Grundig.
Do I need to use a p-channel mosfet or another resistor? Or is that just not possible at all?
The loudness is being reduced by the 220 Ohm resistor. You've got a 4/220 voltage divider! Most of the voltage is going to the resistor. (You NEED a resistor to limit current if you're driving a speaker directly from the Arduino but not with the MOSFET unless it's too loud.)
The capacitor makes a high-pass filter. DC is "zero Hz" so that's why you need it, but it needs to pass the frequencies you're generating. You probably need a higher value capacitor (more uF). The cutoff frequency will be higher when you take-out the resistor.
Thank you very much (again) for your answer. The resistor was a big mistake in consideration.
With the first circuit (capacitor in the negativ side) everything works as expected. But still it isn't loud enough.
I want the speaker to make as much way as possible (to move something mounted on it). With the calculator you sent me I calculated those values:
But I don't have a 2mF capacitor, so I can't test it now. But would it make the sound louder if I used this instead of a 10uF (biggest I have at the moment) or doesn't it make a big different.