The fast 2A fuse protects all the wiring and components (and your bike). Do not wire anything into the bike without fusing it.
R1 is the current limiting resistors. Adding up (or measuring) all the LED voltage drops, subtracting that from the battery voltage, and dividing the result by R1 will give the current in amps. 1 milliamp equals .001 amp, so .040 equals 40mA.
Here is how the switching works:
First of all, the mosfet works like this: Putting a voltage that is at least 10 volts and less than 20 volts between the gate and source pins will make the drain pin short to the source pin, just like a switch. This is an N-channel mosfet, which means that it is intended to do low-side switching. You can see the the LEDs are being switched to ground, and that their power connection is always there. When the mosfet is not turned on (no gate to source voltage) it will be like an open circuit- really high resistance.
So, when the brake switch is made and sends 10.7 volts to the brake light, we steal that signal and put it to the mosfet. Some is lost in the resistor divider formed by R3 and R4, but the ratio is so large (10,000 to 330) as to be negligible. There will be about .35 volts lost across R3, but it serves an important function discussed later. R4 guarantees that the mosfet is pulled off unless voltage is applied by the brake switch (pins left to "float" can provide unpredictable results).
So, when the brake switch is made, 10.25 volts is applied to the mosfet, and it conducts.
now we come to D1. D1 is a zener diode. A zener diode will "break down" at a specific voltage. In this case, the 1n4744 breaks down at 15 volts. Notice that the connection is reversed from a normal diode so as not to conduct. It only conducts when it breaks down. What this means is that anything over 15 volts is held in check by the zener diode. R3 limits the current available through the zener so it doesn't smoke if there is an excessively high voltage. think of it this way- if there is 30 volts coming in for some reason (fault, or noise riding on the battery voltage) the zener diode keeps that gate to source voltage at 15 volts. But, the other 15 volts has to go somewhere... so it is across r3. 15 volts divided by 330 ohms gives us 45.5mA, so that is the current through that circuit. .0455 times 15 volts equals .69 watts, and the zener is good for 1 watt. See why R3 is important?
So, why limit the gate to source voltage to 15 volts? Because mosfets will go up in smoke if you exceed 20 volts. This is true EVEN IN HANDLING THEM, so static electricity will kill them. Touch a grounded metal surface before handling them so you don't kill them with static, and don't work in an environment where static is a problem. The zener protects the mosfet, and once everything is soldered in you have nothing to worry about.
Note that the mosfet is perfectly capable of switching all the LEDs. I have all my strings of LEDs connected to the Drain of 1 mosfet. Works great!
If anyone wants to do high-side switching, I can also provide a circuit for that. It is more typical to switch the high side for power. I used low side for the sake of simplicity.
Last edited by Trooper32; 08-21-2008 at 01:30 PM.