In my previous setup I used an LED driver, the LDD-1000H to provide 1A constant current to a series of LEDs. Armed with knowledge gained from the latest Contextual Electronics course, I have the confidence to build a constant current source to up to 1A to the red and blue LEDs I discussed in the previous post,
The goal of this post is to design a circuit to provide a constant 1A current to the red and blue LEDs.
Thanks to Those That Went Before
Thanks to Chris Gammell for his Contextual Electronics course and mentoring. Chris walked us through designing a current sink which was easy for me to see how I could modify the design to act as a current source for the two LEDs used in this project. It was an achievement for me to take his design and evolve it into an LED current driver.
I found these two videos:
- AddOhm’s “#11 MOSFETs and How to Use Them“
- Bil Herd’s Hackaday “Calculating Heat in Electronic Circuits: Do I Need a Heat Sink?“
gave me a better understanding of how to think about heat transfer when watts of power need to be dissipated.
The LTSpice IV circuit model that is discussed below is located at this GitHub location (LEDCurrentDriver.asc).
The Kicad schematic is located at this GitHub location.
While it is fine to use a resistor in order not to burn out one of these type of LEDs:
more powerful LEDs – like the ones used to grow plants – require a constant current. Up until now, I have been relying on the LDD-1000H LED driver (data sheet):
Simple to use, it can drive up to 16 3W LEDs and has a PWM dimming. However, the challenge with the dimming is it is all or nothing. Either all the LEDs are dimmed or none are.
It seemed to me the power supply tester circuit we are designing in Contextual Electronics is pretty close to what is needed to provide a constant current to the royal blue and red LEDs. I discussed the project in an earlier post.
Chris has us early on in a design using LTSpice as a way to model a circuit. Here is the model circuit I came up with in LTSpice:
I kept the design of the power tester Chris had us working on – the beautifully simple current sink that feeds a “programmable voltage” into the non-inverting input of an op amp. Because the op amp is configured as a voltage follower and Vin+ = Vin-, the output voltage controls how much current the MOSFET lets flow through its gate. Given a known resistor – R1 in the image – and a known programmable voltage – V2 in the image – the current can be adjusted to a range of constant current values.
Figuring out the voltage drop of a component is important in figuring out how much heat the component will generate. Too much heat, stuff starts to smoke and melt. The components on the constant current path include the LEDs, the MOSFET, and the known resistor (R1). How much heat does each component generate? The voltage drop gives us the magnitude since P = IV.
Here is a graph of the voltage drop across the XP-E2 red LED:
The first thing it points out is how much more efficient red LEDs are to the other colors. The voltage drop at 1A is ~ 2.65V.
Royal Blue LED
The XT-E2’s voltage drop for the royal blue:
shows the voltage drop at 1A to be ~3.25V.
When the current is at 1A, the voltage drop is tiny .1V.
The voltage drop across the MOSFET is what is left over. Assuming 9V Wall Wart, the voltage drop across the MOSFET is 3V (9-3.25-2.65-.1)
The schematic differs from the LTSpice IV model by adding a voltage regulator and a POT:
Varying the Constant Current
The amount of constant current is controlled by adjusting the voltage into the non-inverting op amp. The load resistor = .1Ω. When the current = 1A, the voltage = .1V (V=IR). I’ll use a potentiometer (POT) to adjust Vin+ to the op amp (R2 in the diagram):
as the bottom leg of a voltage divider to supply 0 to .1V to the non-inverting op amp. The top of the voltage divider (Vin) is 5V. I want Vout to range from 0 to .1 V. The ratio (Vout/Vin) is 1/50. I already have a POT that goes from 0 – 5K that I’d like to use. Vout = Vin(R2/R1+R2) -> .1 = -> 1/50 = R2/R2+R1 -> 50R2 = R2 +R1 R1 = 49R2 => R2 = 5K, R1 = 49*5000 = 245K. Checking the math: .1V = 5(5K/245K+5K) -> .1V = 5(5/250) = 5/50 = 1/10 = .1V.
In order for R2 to go from 0 – 5K, R1 = 245KΩ.
In our Contextual Electronics course, Chris walked us through finding an N-Channel MOSFET based on:
- Package – TO-220 DPAK – very common for power MOSFETS.
- SOA (Safe Operating Area) – the maximum power the MOSFET can dissipate.
- RDS(ON) – the resistance from drain to source when enough voltage is applied to the MOSFET’s gate such that current is fully flowing. Note: While knowing the RDS(ON) is useful, I didn’t end up using it directly since the value is taken into account by the SOA graph.
- a VGS(th) of no more than 5V to allow 1A of current to flow. This means a Logic Level MOSFET. There is range from where a MOSFET starts turning on the current to when the current is fully flowing.
- N-Channel MOSFET
- buy at quantities of 1
- Logic Level Gate
- all the TO-220 packages
- Power >= 6V
I’ll start with the same ambient temperature (38˚C). Next add the thermal resistance * 3W (amount of power needed to be dissipated). The listing on digikey shows the thermal resistance to be 24˚C/W. 3 * 24 = 72˚C. I’m skipping the thermal resistance of case to sink. The junction to case of the NXP MOSFET (data sheet). Shows a typical JC thermal resistance to be 3.1˚C/W (note: While 0˚C = 273.15˚K, 1C up/down = 1K up/down so 3K = 3C heat up for each watt). Rounding to 3˚C/W, 3*3 = 9˚C. Adding this up:
38+72+9=119˚C. The data sheet states the maximum rating is 175˚C. This heat sink should work.
Looking back at the LTSpice IV simulation, I = V/R, I = .1/.1 = 1. The resistor’s value is .1Ω. The amount of power burned is P = IV = 1*.1 = .1W. We need a resistor that is .1Ω and can withstand burning at least .1W. .1W is not that high so I am choosing an inexpensive SMT 0805 package resistor (digikey link). I like to use 0805 sized caps and resistors.
I will use an MCP6241 for the op amp because I have some in stock. According to the data sheet, the positive voltage rail can go up to 5.5V. Other characteristics are not that important.
I need a voltage regulator that takes 9V as input and outputs 6V. The voltage regulator I use in the Ladybug shield should work fine. I use a 7805 sot-89 packaged voltage regulator (data sheet).
I’m off to order parts so that I can build a prototype. Thanks for reading this far. Please find many things to smile about.