Strange behavior of a Mosfet IRLZ34N

I have the following problem: I would like to use a Mosfet IRLZ34N to switch a small audio amplifier. To test it, I assembled and programmed the whole thing with a 12V LED strip (10 LEDs). Everything works great. I actually only need on/off, but I can even control the pass (1.0V -> 1.95V, 0% -> 100%) cleanly with the DAC.
Perfect. But: If I connect the audio amplifier instead of the LED strip, the Mosfet conducts immediately and I can no longer control it.

It even happens that I leave the LED strip connected and as soon as I only connect the ground of the amplifier (+12V is 'not' connected)... the Mosfet switches on immediately.

            12V LED / Audio Amp
       VCC o-----o->|- o--------o
                                | D
                           G ||-+
  DAC ESP32 PIN 26 o--------o||<-  IRLZ34N
                        |   -||-+
                        |       | S
                       .-.      |
                       | |      |
                2.2kOhm| |      |
                       '-'      |
                        |-------o
                        |
                       ===
                       GND

Is the audio amplifier connected to anything else?
Is the -12V connect to the MOSFET source (S)?

In general, connectiog/disconnecting the ground lead of an external device in order to turn it on/off is a bad idea.

You should use a P MOSFET to control the +12V to the amplifier.

Hello Jim P,
The audio amp and the LED strip only have +12V and GND. It is a small Class-D board (DollaTek TDA7377 Pro²), not -12V.
I usually have the amp connected to +12V and GND to the mosfet (drain). Just because I found the behavior so strange, I reconnected the LED strip and, as a test, briefly connected die AMP GND to the drain (leaving +12V unconected) and the Mosfet switched on immediately. Gate was always at 0-0.1V. Threshold is 1.0-2.0V.
PS: Unfortunately I only have this n-channel Mosfet which switches cleanly at < 3.3V.

Could be picking up GND from the 'audio in'.
How does it go if you don't have 'audio in" connected at all ?

Is the 12V supply ground connected to the MOSFET source?

Is the audio amplifier connected to anything else?

I see that the amplifier has some very big capacitors on it, so it probably draws a lot of current when it first turns on and that can cause some MOSFETs to turn on even when there is no gate drive.
You can prevent this from happening with some additional circuitry on the gate (transistor, diode, resistors, capacitors) but I recommend you buy a relay to switch the +12V

and then holds the voltage as if the MOSFET were ON.

That seems the most obvious reason for the problem. I don't see how this can be true:

How do you know the amplifier is on if it doesn't have anything else connected, such as some form of input and a speaker?

Thank you for the thought. Of course, line-in is connected and also represents a connection. Sorry for the missing information.

Everything works wonderfully without a connected line-in.
The audio amp is switched normally.
To solve the problem "with" line-in connected -> I used a 3.5mm passive interference filter to separate the ground.
Thank you very much.

But to understand: why does the Mosfet switch when there is a ground connection between gate and source?

Having the audio-in GND, which is also system GND in this config, connected brings over and shorts out Drain to Source/GND.

Ohh, of course. My thought process was wrong. The Mosfet does not conduct but the current flows via the audio GND line. :see_no_evil: Therefore I also had a slight PWM noise.
I will take this into account for subsequent projects.
Mass separation always seems to make sense in this case.