I am working on a LED board for a flashlight powered by a 3.7 V battery. The flashlight has a dual light feature: both white and UV light are available.
Four signals are sent to this board by the motherboard: the VCC (3.7 V), GND, an "LED selection" signal (to switch between the UV LED and the white LED), and the PWM signal to control the brightness.
The control signals are provided by a PIC16F887, which is also powered by 3.7 V from the battery.
Here is the desired operation:
- When the LED-selection signal is 0, the white LED is lit; when it is 1, the UV LED is lit.
- The PWM signal is common for both LEDs, so that when the current operating LED is switched, the duty cycle is applied to the other one without having to set it again.
- Finally, the current is taken from the VCC, so the PWM is applied to a MOSFET that will allow the current to flow through the currently active LED at the desired frequency and with the desired duty cycle.
I also want to use as few components as possible to make the board compact (it must be fitted in a limited mechanical package: 39 mm x 23.5 mm)
Here is a picture of my actual circuit. I use three MOSFETs because the current drawn will be greater than 200 mA (at least for the white LED).
My questions are:
- Is the actual circuit correct in its structure? I tried to simulate it in Tina and it seems like it is working as I want (I replaced the "LED selection" with an On/Off switch and the PWM by a clock).
- I am not sure of the wiring of the PWM MOSFET (Q1). Normally, the source should be wired to GND as the transistor is N-channel. I don't really know if a P-channel MOSFET would be better for this application. However, I've read that P-channel MOSFETs are used if the signal voltage is of the same range as the power supply voltage (which is the case here) and to connect the source to the positive side of the load so I am considering replacing Q1 with a P-channel MOSFET. However, again, the simulation shows no problem with the operation of this circuit (which I doubt is accurate).
- Should this board have its own power supply rectifiers so that the LEDs are fluently supplied? The wires between the motherboard and this one will not be longer than 5 cm so I suppose that it should not cause problems.
As requested, I am giving more details on the simulation:
Because my CAD software (Kicad) is not very permisive with simulations, I recreated the schematic on Tina. The LEDs are inactive when filled in Grey, and active when blank.
Edit: I replaced the PWM N-Channel MOSFET (Q1) by a P-Channel MOSFET with the G pin linked to VCC instead of ground
New results are as shown (from simulation):
With the "LED selection" switch open (LED 2 powered), I get the following results:
And with the switch closed (LED 1 powered), I get the following:
Since the LED I want to use have a typical forward voltage of 3.1V at the desired current, it should work with this circuit, but the margins will be low so I have to be sure that my supply voltage is not lower than 3.7V.
In the case where LED1 is powered, no voltage is passing through the second LED and the voltage is not high enough (2.3V in the simulation) to compensate for the forward voltage, so it will definitely not be lit when it should not be.
Note: I still have to corrige the series resistance of each LED to get the correct value of current flowing through the LEDs (approx 300mA <=> 1.8 ohm for the white LED, and I still have to chose my UV LED). The values displayed here are generic.