Let me start by saying that I'm a novice when it comes to electronics. I'm a programmer by trade, and my experience with electronics is limited to the digital stuff and Ohm's law...
I'm working on a small project where I'm controlling all the lights on a motorcyle with an ATmega128. The purpose of this is to save weight by removing most of the original wiring. Putting all the logic inside the 128 saves a lot of wirint - the original loom is about 4Kg, the replacement less than 1Kg.
I've prototyped this on a breadboard using LEDs to represent the various lights, and I got the software working properly, interfacing with the original switchgear. I'm now trying to hook this up to the lights on the bike (all lights except headlight replaced with lightweight LED lights) using some IRF510 MOSFETs I had. This apparently works fine, but there is a problem - I can't switch the lights completely off. Even with the gate grounded there seems to be a small leak, as there is a constant faint glow in all lights.
I know very little about MOSFETs, or transistors in general. The datasheets doesn't tell me much as I understand very little of them ;) It could be that the IRF510 isn't suitable for my application, I don't know. Any good suggestions on what to do?