The Celtic Engineer is a weekly newsletter produced by Celtic Engineering Solutions. We hope you enjoy it. If you have any suggestions for topics, would like to give feedback or want your email added to the distribution list please send an email to [email protected].
This is a tale of three circuits.
I thought about calling it The Good, The Bad and The Ugly, but I was in a French revolution state of mind more than an old west state of mind. I have often said that if you ask 5 engineers for a recommendation on a circuit you will get at least 8 recommendations. The reason is clear, there are a lot of different ways to do the same thing. This is not a new concept to any of the engineers out there. We constantly weigh options, make compromises and select the best design. We are trying to meet as many of the customers’ requirements as possible and deal with the needs of the circuit that the customer doesn’t know about and often doesn’t care about, unless it doesn’t work.
I once again found myself working on a battery powered LED project. Over the course of the design stage, I disregarded one design, enjoyed the second and was surprised by the third. I wanted to talk about those three circuits. They all work. They are all good circuits, but they are not all the best circuit for this design and I thought we should talk about them. I want to talk about the advantages and disadvantages of each and how one of them stood out above the other two as clearly the most qualified for the application.
Plain and simple
In Figure 1a we see the very basic LED interface with a microcontroller (mcu). The N-channel FET is off when the mcu pin is low and fully on, and only a few tens of milli-ohms, when the pin in high. The resistor limits the current in the circuit. We know the nominal voltage drop across the LED at a particular current. LED’s are current devices and not voltage devices. We can get decent control over the LED but it is not really control. Control implies we are measuring something and feeding that back to a controller. The kind of control we are using here is called open loop.
I said nominal voltage drop because at 20mA the voltage across the LED will be a distribution and not a value. We may be tricked into thinking it will be 2.2volts because that is what the datasheet says. If you are using the LED for an indicator on a PCB it’s probably not a big deal. When you start pushing the LED, to get as much light out of them as possible, you can expect problems.
Here is what I mean. If you design based on 2.2 volts and the actual voltage is 1.97V your current in the LED string will be a bit higher than 20 mA. The real problem is that when the higher current passes through that particular LED it will experience a much higher voltage drop (and corresponding power dissipation) than its neighbors. That is the exact situation that leads to premature failure. Many of the LED bulbs that came out in the first years of LED light bulbs experienced failures due to only one or two LED failures in the string.
Figure 1a Easy LED driver, 1b Improved LED driver, 1c nifty cool LED driver
The next reason I rejected this circuit was because I wanted to have the light output constant over the life of the battery. With the battery voltage dropping, this circuit will get dimmer and dimmer because it is not monitoring the current and keeping it constant. The cost of making a 4-LED circuit is $2.72. On the plus side, it is very simple and has few components.
Closing the loop
The second circuit, Figure 1b, was fun to design. I was very proud of it when I got it done. It is not new, I have used variation of this many times before, but not as an LED driver. The current is monitored by the OpAmps inverting input. It will raise the output until the two input voltages are the same. The reference or desired voltage is on the non-inverting input. When the mcu pin goes high its output voltage will be 0.1 volts below VCC. I used that to set the OpAmps input to match the voltage that will be produced when 20mA passes through the sense resistor. The cap is an insurance policy. It is there because there is a lag between the rise of the voltage on the non-inverting pin and the response on the inverting pin. This will lead to overshoot and can lead to instability. If this is the case (remember this is a prototype), we can add a little capacitance to the input; slow it down, give the circuit a chance to respond.
Now, as the battery voltage drops, the current stays the same. The FET acts as a variable resistor. In that sense, this circuit and the last one have a lot in common. They both dissipate excess voltage as heat. They are both wasteful. The difference is this circuit is less wasteful, or more efficient if you are a glass half full sort of individual. It has quite a few more components than the first one, taking more PCB space and the BOM cost is higher. The cost of making a 4-LED circuit is $4.51.
Good, better, best
I don’t remember what caused me to read the datasheet for the LED driver. I knew they regulated the current. Some of the more elaborate devices have boost converters in them that will adjust the voltage on the fly to maintain a desired current. So, I should not have been surprised to find a 6-pin buck converter that requires no external components. With no external components it defaults to 20mA. You can add a resistor if you want a different current. I wanted (needed) the ability to turn the LED’s on and off so I added the FET as a switch. The current though the LED is constant, so no dimming. The voltage across the driver chip is 1.2V to 1.5V regardless of the battery voltage. So where does the voltage go? The only way to do that is to have a buck converter. You put one voltage in and get a lower voltage out. In this case it is a trans-impedance buck converter. We have battery voltage in and a constant current out.
And that is engineering
Well crap. I have the design done and have just found a better mouse trap, Figure 1c. That is the life of an engineer. Fortunately, I found this before I made the circuit. Many times, we don’t find the best circuit until we have gone through several iterations. To make matters worse the LED driver chip cost 43 cents. So, it’s a lot more efficient and it is dirt cheap. The cost of making a 4-LED circuit is $4.04 (insert joke here).
I am disappointed that my cool design did not win. My little brain child did not make the cut. On the other hand, I am very happy that my customer will be getting a really good design. In the end that is what it is all about, getting the best design for the application at hand, and for your customer.
This newsletter is sponsored by Celtic Engineering Solutions LLC, a design engineering firm based out of West Jordan and Murray, Utah, which can be found on the web at: www.celticengineeringsolutions.com. If we can ever help you with your engineering needs please contact us. You can find the newsletter on the company blog, LinkedIn or in your inbox by subscribing. Send your emails to The Celtic Engineer at: [email protected], with the subject line SUBSCRIBE.