Question about noise in car and a poor Arduino

Hi, got a Arduino Uno with a Sparkfun Spectrum shield hooked up in a car.
The Arduino controls 3 MOSFET transistors based on the audio input from a 3.5 mm cable before it forwards the audio signal out again to the audio player.
And this works great indoors using a simple 12 V
power supply in the AC socket, but when hooked up to the car's 12 V battery the noise goes crazy, so much that its unbearable.

The car has two batteries, one in the engine room, one in the back with the speakers. The Arduino with its MOSFETs is connected to the secondry one, the one reserved for the speakers and it uses its negative terminal as ground, while im pretty certain the audio player uses the one in the engine room.
I though this might be the cause of the problem, in fact, if i had the 3.5 mm cable out and the 12+ connected (so no return ground cable connected) to the Arduino and MOSFETs, it would power them.
So i bought an ground isolator or stereo line transformator, one that should stop ground looping and give complete DC seperation, but it didnt help. Still crazy noise.

So, is the problem that the MOSFETs and Arduino uses the battery's negative terminal as ground when i should just use a cable to the chassis as ground instead? If this was the case i was sure the ground isolator would have worked...
But it makes sense, engine room battery is the reference for the audio player while the arduino uses another ground as reference, producing noise. Or am i completely wrong and everything is wrong??

Thanks in advance

The car has two batteries, one in the engine room, one in the back with the speakers.

But the they are not isolated, right? I mean, the rear battery has to get charged somehow...

What happens when you run the signal through the Arduino-box without powering-up the Arduino?

What happens when you power the Arduino, but not the MOSFETS & lights?

You might also try running a test program that flashes the lights with no audio connected... Connect your audio "normally" without running it through the Arduino box.

I assume you've connected a line-level signal (the input to your amplifier)? It's not a speaker signal, right?

Noise can be difficult to track down and fix... I had a similar (less severe) problem where the noise went-away when I disconnected the audio input to the Arduino. In my case, it turned-out to be the audio ground (a ground loop with the Arduino grounded through the power and through the audio input).

But the they are not isolated, right? I mean, the rear battery has to get charged somehow...

Yeah, they are connected.

What happens when you run the signal through the Arduino-box without powering-up the Arduino?

Noise goes away...

What happens when you power the Arduino, but not the MOSFETS & lights?

They share power cables in a sense, though i doubt the MOSFETs are the issue, they arent connected to the audio input. The arduino is, so i think thats whats producing the noise.

I assume you've connected a line-level signal (the input to your amplifier)? It's not a speaker signal, right?

Yeah, I let it run through the arduino before anything else, so arduino first, the audioplayer in the front of the car, then amps before speakers.

Noise can be difficult to track down and fix... I had a similar (less severe) problem where the noise went-away when I disconnected the audio input to the Arduino. In my case, it turned-out to be the audio ground (a ground loop with the Arduino grounded through the power and through the audio input).

YES! I thought so too since the arduino would power on if the 12V+ and 3.5 mm audio cable was connected, so i was sure the ground isolator would fix it, since its supposed to stop ground loops...

Maybe its defective, the ground isolator?

What i thought it might be was that since the audio player is using the engine battery and its ground, and my arduino is using the secondary battery's negative as ground, its a difference there. Like, the potential between the first battery's + and - is different than the secondary one, so some current is sendt throught the ground in the audio cable to the audioplayer since its a bigger difference there, producing noise.
What bothers it is that the amps use the secondary battery, with no noise at all... If my theory is correct then there should be noise with there too, but no, its not. When the arduino is off, the noise is way way lower...

though i doubt the MOSFETs are the issue, they arent connected to the audio input. The arduino is, so i think thats whats producing the noise.

No it is the FETs that are switching the LEDs that is producing the noise. You don't have to have a connection the noise is transmitted over the air. The electromagnetic noise is from the rapid switching of current being picked up on your audio amplifier.

No it is the FETs that are switching the LEDs that is producing the noise. You don't have to have a connection the noise is transmitted over the air. The electromagnetic noise is from the rapid switching of current being picked up on your audio amplifier.

So, wrap the FETs box in metal foil? I gotta say though, the FETs are approx. 1,5 meters away from the player, but ofc i can try.
I think its weird though, since the noise is not there if i bring everything indoors, and when i last tested it, the FETs were approx 0,5 meters away from the amp, still no noticable noise...

So, wrap the FETs box in metal foil?

No.

Noise is caused by the rapid switching of current. So the FETs are doing the switching but any wire carrying that current will radiate noise. It is difficult to find a cure, there is no hard and fast method that will always work. A lot depends on the situation and layout.

Solving it will involve decoupling circuits on the power lines. Ferrite beds and toroids can also help as can correct routing of grounds.

Noise is caused by the rapid switching of current. So the FETs are doing the switching but any wire carrying that current will radiate noise. It is difficult to find a cure, there is no hard and fast method that will always work. A lot depends on the situation and layout.

You were completely right... The ground isolator did work, the noise were greatly reduced, but its still at a unbearable level, and yeah, its the MOSFETs. Noise depends on lightlevel, independent if the audio source is plugged in.

As a temporary fix, i have just adjusted the code so its either completely off or on, so just digitalWrite instead of analogWrite. Its not as cool, but it works and time is short here, so for now, im leaving this as this.

My question is, Grumpy Mike, can i use a separate 12V lead battery at approx. 7,2 Ah as a separate power source for the lights and Arduino? It has to be connected to the other batteries so it can charge up (so not complete separation and decoupling), but a battery works like a giant capacitator, right?

The point is not to get completely rid of the noise, but keep it down to a minimum. Right now, an analogWrite version of the program makes just too much noise, and the lights share the same battery as the amplifiers, so im thinking a separate small battery is a cheap and simple way to get the noise level down to an acceptable level.

can i use a separate 12V lead battery at approx. 7,2 Ah as a separate power source for the lights and Arduino?

Yes. Remember to connect the ground of this separate supply to the ground of the Arduino.

As I said it is the PWM that generates the noise. One solution might be to increase the PWM frequency so that it is outside the range of human hearing.

Try not grounding the LEDs to the car body, instead run twisted pair to each LED. That should limit the noise radiated by those wires.

Adding bypass capacitors from 12V to ground at the power input can also help reduce noise. A couple of 0.1uF caps and maybe some low ESR elecrolytics in the range of 4700uF or larger. This helps reduce noise current on the 12V line, which can be picked up by the audio amp either by capacitive or inductive coupling, or right into the 12V input line on the audio amp.

The same bypass capacitors where 12V goes to the audio amp are a good idea, too.

Make sure all grounds are good and tight.