This LED driver is very similar to the Simple Buck LED Driver but was modified to handle a higher input voltage. A benefit of a larger input voltage is that you can power more LEDs in series with each driver. This driver has PWM dimming and sleep feature which can prolong battery life when not in use.
Step 1: Materials
Step 2: LED Driver Circuit
W1 connects to the battery's positive terminal. By directly connecting it to the battery, there's slightly less resistance than if a transistor was used.
W2 connects to ground
W3 enables the LED driver. To turn it on, the connection needs a voltage equal to that of the supply voltage. This connection is needed because the surge current from charging the capacitors through W1 may be too high for the AO3401. When turned on, about 10 mA flows through this connection. If turned off, there's almost no current flowing through the LED driver.
W4 is PWM dimming input. A high causes the LEDs to turn off. Make sure that you invert the PWM out of the microncontroller
W5 connects to the LED string's anode (+)
W6 connects to the LED string's cathode (-)
Warning: Do not reverse polarize the connections for W1 and W3. I destroyed Q2, Q3, and Q4 by doing so and had to replace them.
Step 3: Sample Circuit With Microcontroller
Step 4: Calculate Resistors for Voltage Rating
This step is necessary only if your power supply's voltage is higher than Q4's absolute maximum rating for Vgs which may be 20V. If it's lower, R14 can be 0 ohm. If it's higher, a voltage divider formed by R13 and R14 would be needed. The maximum voltage can be 36V if R13 and R14 are properly selected.
In the test circuit, R13 and R14 were each 10k. A 12V source was used. An oscilloscope's screen shots were provided. You can see that the output's high and low voltages were 12V and 6V. If the voltage divider wasn't used, the high and low voltages would be 12V and 0V. A 24V power supply can damage a MOSFET.
The values of R13 and R14 should be selected so that when Q4 turns on, Vgs falls within its safe range. Make sure that Vgs is above its threshold voltage so that it the transistor will turn on. If they're equal in value, the rated input voltage is doubled. You can also experiment by replacing R13 with a Zener diode.
Steps for determining the value of R13,
Select a desired value of R14 .
Select the desired Vgs voltage.
Select the voltage of the power supply.
Calculate the gate voltage (Vg).
Where Vsupply is the input voltage for the LED driver, and Vgs(desired) is the desired voltage between Q4's source and gate pins.
R14=4.7k, Vgs(desired)=16V, Vsupply=24V
R14=5.6k, Vgs(desired)=7.2V, Vsupply=14.4V
Step 5: Calculate the Current Sense Resistor's Value
Where Vfeedback is the voltage measured at pin 2 of the LM393, and ILED is the LED's drive current. Rsense is the resistance of R1 through R4.
You can set the resistance by soldering them in parallel. For example, four 1 ohm resistors in parallel would have a total resistance of 0.25 ohms.