PWM Automotive 12V Dimmer for instrument cluster, clima leds

Hello, i couldn't find a topic for my exact case so I hope that's the right place to ask. Long story short, I'm trying to dim my instrument cluster, clima leds.

What i know so far are the following:
I'll provide here a youtube link(*I hope i'm allowed to) with relevant things in it.

My car It's an old Ford Mondeo MK3 having the headlight switch with no dimmer control

When I turn the headlights on and I probe pin 9 and 10 from the headlight switch (dimmer pin and ground) I get around 12 V. I need to lower the voltage on pin 9 to get the dimming.

In the video :

  • at 5:32 it's the effect I'm trying to achieve
  • at 2:20 it's voltage probing while turning the dimmer wheel.

I don't have a schematic but I'll try to explain what I tried :

I use an Arduino Uno with the Fade example uploaded. (It provides me 0-5V PWM signal back and forth)
I have an IRLZ44N (N-Channel Logic Mosfet)
I use pin 9 for PWM signal output from Arduino to Gate of IRLZ44N
I use GND from Arduino to Source of Mosfet
I use GND from the Car to Drain of Mosfet
I use +12 from the Car to Dimmer pin on the Headlight Switch (pin 9 from headlight switch)

I've been told that cars usually switches the negative from the DC battery, but i truly don't understand how can I dim the voltage by controlling the negative pin

Now the funny part:

I have no idea how I wire it up correctly (it doesn't work as I explained) or what else do i need to achieve my goal.
I'm new to all of this.

Any help It's greatly appreciated.

You're going to have to draw a schematic for us. Can't visualise it in my head from your description. Hand-drawn is fine.

You do understand that PWM does not change/vary the voltage? It switches the signal on/off rapidly, too fast to see any flicker. What changes when you use analogWrite() is the "duty cycle" which is the % of time the signal is high versus low.

You can dim LEDs by putting the MOSFET on either the 12V or the ground side (provided you use the correct type of MOSFET, and dimming on the 12V side is more complex). What lights the LEDs is current rather than voltage, and the same current flows into the led as follows out, so you can switch it either side.

Switching on the ground side is easier and can be done with an n-channel MOSFET such as the one you mentioned. Switching on the 12V side is a little more difficult. You need a p-channel MOSFET for that, and the problem is that to switch a p-channel MOSFET off, you need to put 12V to it's gate, and arduino pin cannot provide that, so you need a little circuit between the two, with a few resistors and an npn transistor for example.

Thank you for your reply. I tried to sketch a diagram using N channel Circuit the way i have things in my head.

Also i found a diagram for a P channel circuit controlled by arduino (with protection to not fry the arduino with 12v line, i think it’s what you suggested above).

I would like to use the N channel variant (if correct) because i’ve been told that on cars it’s more risky to work on + line instead of GND but somebody with experience hopefully would lead me to the best choice.

That looks ok. Is the arduino ground connected to the vehicle ground (ie. 0V/chassis)?

Yes, that's what I meant. You would generally use an n-channel MOSFET on the ground side in preference to a p-channel on the 12V side, because the circuit is simpler and the n-channel MOSFETs are cheaper and more robust. But in some situations you have no choice, for example when the negative side of some component is connected directly to ground or a chassis and you have to switch the 12V side.

I have tried the first N-Channel Mosfet diagram and … it’s not working. The arduino it’s powered through cigar adaptor using a usb cable so I think the GND from arduino it’s connected to GND from the car.

I’ve updated the diagram I’ll try to test tomorrow. Please let me know if I have any errors in it. After PaulRB asked me about the common GND I’m a bit skeptical now if my diagram it’s safe or it will fry my arduino.

LE: I’ve tested it it’s working awesome. Thank you PaulRB for your suggestions. As a mention, I separated the ground circuits to not connect together and 12v to go to arduino.

Glad you got it working. I was not suggesting you separate the grounds.