I'm currently working on a project to control a large amount of LEDs through my Arduino Mega, but I've stumbled across the following problem:
I have my Arduino out pin (PWM/digital, tried both) connected to the gate of the IRF510, the +12V to the drain and ground to source. (+12V and ground are from my external power supply)
My LEDs light up but they flicker and I'm not able to adjust the brightness with the PWM pin.
When I have the +12V to source and ground to drain, the LEDs light up but do not flicker. However, I'm still not able to adjust the brightness.
I'm pretty sure that I need a pulldown resistor on the gate, but I have totally no idea where and how to wire it. I've tried numerous possibilities but to no avail :(
When trying to "manually" ground the gate, i.e. touching it with my fingers, the circuit seems to be working and I'm able to use the PWM output to control the brightness. However, with the output set to 0, I still have a faint glow in the LEDs. (note it also works when I touch the ground of the external power supply, but don't ask me why :p)
I'm sure there must be a simple solution but I just can't find it. If anybody could help me out, I'd be more than grateful !