# Lino Project: USB tests

The Lino board was correctly made and roughly tested. But now, how can I see how correctly performs? By simply integrating the load (power LEDs) and the PC environment to a complete working system. In this article will be provided a summary of these various steps, just to keep rtace of the progresses.

The load is made by 4 Glighter-S that are powering as many power LEDs. I grouped them in a proto PCB like in picture below:

These 4 boards are simply connected to the same power line, with 4 control wires that are connected th Lino. Each of their output is connectet to a single LED, with the result of 4 LEDs in total driven singularly by Lino.

### The finger test

Now, moving to the board that actually carry the LEDs, I felt the need to change some things. When doing my math, I realized that a small heatsink could work keeping the LEDs cool enough to keep them alive, as you can see here:

This “cool enough” is not enough to pass the so called finger test: this test is considered to be failed if you can’t stand a finger on the heatsink or any surface. If this happens, we are likely more than 65°C, depending on what is it your job, if you are a farmer maybe you have thicker skin and maybe you are sensible to higher temperatures.With this one, we are passing 80°C using my IR thermometer. My finger is definetely hopeless.

Since the heatsink actually shall be touched during the usage and my finger must not be burned, I needed to ovesize the heatsink itself. With a new one, the maximum temperature rise to no more than 60°C, and I extend by 20°C more the ambient operating temperature range of the LEDs:

As you can see, I need to think about the shape of the heatsink and the PCB. But for this test, what’s in the picture is acceptable.

## Turn on the board

The board can be driven using the USB/serial or with a single encoder. Herein I will show the serial test, and to generate the correct data pattern to be sent on the board, I wrote a simple Python script to simplify the testing. It uses Python 3+, exploits the pySerial and Tkinter module. Basically the Tkinter lib generates an HTML compatible color code and will be arrangend to an array sent throug the serial line, here emulated on USB. At every complete frame received, Lino will apply instantly the requested color. In other words, when receives the “stop character” described in the Lino protocol.

Here the complete assembled configuration, where the power supply is given from a 9V – 1.5A DC power supply that will be connected to the board.

Let’s connect the DC power jack and the USB to the Lino and to a PC running the Python script demo available here.

Run the script with Python 3.5+ and the following will be opened:

Just type the available COM that appears when you connect the board, a space mark and write the communication speed used by Lino. Press enter and the following appears:

It is in italian, but it is the intuitive and dummy default color table provided by Windows: select the right combination and press OK. Lino automatically displays the colors on the LEDs.

Note that it is implemented a white adjustment computed directly by the Lino’s microcontroller, the white component that controls the white LED it is not generated by the script: when all of the RGBs are greater than zero, there is a bit of white that will be reproduced using the fourth pure white LED, making it more realistic with respect the expectations. In this way I can generate any kind of white light shade. Awesome.

### Setting-up the prototype

To set up everything and test it in a more compact way, I thought to use a PVC panel. But at the moment they were missing. So to finish in the same day, I remembered that I have kept a light guide plate from an old LCD panel. I knew that wasn’t trash!

A light guide plate is a panel (in acrylic like material) with some dots that are intercepting the light from the side backlight and redirect, guiding it, it to the LCD, actually rotating the light path by 90° towards the LCD panel:

Then I have realized too late that I could make a photo before cutting the plane, so here is what remains of my panel, already cutted, bended and somehow abused:

Exactly, the old panel was used for all but lighting purposes. In the end, I can put everything in a uglyish case, sticked on the wall like a painting:

The video below shows the working system paired with the PC:

When only powered from USB, the firmware derates the total provided power to stay inside the power budget of 2.5W. This video shows the automatic power handler when disconnecting/connecting the main power supply:

# Tiny, robust, low cost, fail-safe LED driver: the Glighter-S project

It has been a while since the last LED related article. Was experimented the linear current source, its pros and cons and the field of application. Now arises the need of a small version, handling the same high power, things that are contrapposed in the linear regulator. I need something that I can bring with me, connecting a bit of everywhere, potentially. Heatsinks were expensive, heavy and it is impossible to cover the entire voltage range without huge radiating elements and is also very low efficient. So what I need to do?

### A new board design

With the new version, the entire design is completely changed. I moved to a swiched solution, by exploiting an integrated buck converter controller.

The core is the Texas Instruments LM3405 buck controller, with a fixed sense resistor directly mouted on PCB. With some tricks, like using an external companion LDO boost voltage regulator, I can provide all the required drive voltage for the LM3405’s internal mosfet over an enormous input voltage range without damage or efficiency loss. More over, the output voltage required can be of any value from almost 0V to the input applied, therefore there is no concerns related to what minimum or maximum LED voltage I can use, matters only the current which the LED can withstand without generating the magic smoke.

The high switching frequency of 1.6MHz of the controller allow also to use small components: in the picture there is a reduced size inductor, mounted on pads designed to carry on the higher ones. This left me some flexibility on performance analysis and experimentation.

### Project summary: Glighter-S Power LED driver

• Technology: switching buck regulator
• Input voltage: 3V to 20V (note 1)
• Output voltage (LED Vf): 0.3V to 20V
• Sourced current: up to 1A (note 2)
• Size: 32mm x 21mm
• Efficiency: ~90% (note 3)
• Operating Temperature: -40°C to 60°C
• Safety features:
• Short circuit immune
• Open circuit immune
• Safe state (off) when no control is applied
• Control features:
• PWM control: voltage swing from <0.4V to >1.8V up to input voltage, max PWM frequency 5kHz
• Analog control: voltage swing from 0.4V to 1.8V. Outside these limits device is either shut off of fully on.
• Overtemperature protected
• It does not make the coffee, but the coffee made this. (note 4)

Note 1: active regulation starts from the forward LED voltage plus 0.6V. Full power is delivered from 4V on (device’s control voltages fully on)
Note 2: can be set by changing a resistor
Note 3:  with one led with a forward voltage of 3V is 83%. 90% can be achived my using more than 3 LEDs in series.
Note 4: with caffeine.

On the back of the board there is a brief indication of what is summarized above:

Regarding safety, if the output is shorted, the regulator instantly lower the output voltage avoiding failures. With open circuit, as any buck converter with a sense resistor removed, the output raise as the input voltage due to the broken feedback loop, but with no damage on components: when connecting the LEDs back again, the regulation starts “immediately” avoiding LED damage. Smooth delayed start of few microseconds is implemented when powering the board with the enable already active, to avoid high inrush currents, stressing also less the LED avoiding high current glitches.

It can be dimmed with an analog signal or through a PWM wave up to 5kHz. A greater frequency is just filtered away. Another safety feature is that when PWM pin is left floating or the wire is broken, is equipped with a pulldown in order to guarantee a device shutoff with no misbehaviors. If no control is needed, just connect the PWM pin safely to the input voltage to turn it always on.

### Wiring the LEDs

I wanted a very high power LEDs, but with a relatively low voltage, in order to try it also with low voltage batteries, lower than 6V. So I choose an LED with single diode chip, because when power LEDs have an high voltage (usually greater than 5V) is composed with multiple LEDs in series. My choice is a Luxeon Rebel LEDs, with a single diode, no series:

Each of these LEDs can take up to 700mA (1A peak), therefore I chosen the sense resistor on the board in order to achieve 700mA. I designed a board used as a satellite, mouting 4 LEDs, with the peculiarity of handling the thermal management of a global 9W LED lamp.

The LED board (a.k.a. satellite board) is straighforward: 8 pins, 4 anodes and 4 cathodes to drive each LED individually using 2 wires per LED connected to the driver. The A means anode (connect the +), K the cathode (connect the -). Below the RGBW LEDs soldered on the red, green, blue and white position.

On the back is mounted an heatsink capable of dissipating through natural convection up to 9W up to 40°C of ambient temperature. Bigger heatsink will extend the temperature range. But here the purpose is to have a small heatsink, and wasting time in my playground.

### Wiring the driver

Here is shown the board connections used to test the LEDs and the driver.

The input voltage was 20V from an old laptop power supply, the enable pin shorted to the 20V. I have connected 4 LEDs in series (one cathode on the next anode and so on), with a total forward voltage of around 12V, which means that in this configuration, the minimum supply voltage required was a bit higher than 12V, here 20V are provided. Since the leds in seried are dropping more than 3V (12V in total), the efficiency of the driver is near the 90%, because the ratio between internal losses and delivered power is lower.

The power absorbed is roughly 9W, I just can’t prove its light due to the exposure of the camera, but it is comparable of a white LED bulb of 10W commercially available.

Fun fact: these LEDs are also used in some Philips RGB lamps, with a similar thermal design of the PCB. That is somehow encouraging.

### Conclusion and next steps

There is no much else to say, but it works and it is a small accomplishment that allows me to play more with power LEDs, more easily than before, mainly because of the possibility to use, NOW, almost any power supply (from tablet’s charger, to laptop ones and any battery lying around).

Every microcontroller can drive these boards with no additional components. The absolute value on the pin have analog effect if inbetween 0.4V and 1.8V, while if lower than 0.4V shut off the driver, and if higher than 1.8v will fully turn on the device. Any board, 5V, 3.3V or 1.8V can drive this module even with a low voltage logic I/O pin or even using an DAC. I plan to continue the improvement, and maybe design a control board in order to control these drivers with a small power low-profile set-up.

# Current sources for LEDs – Glighter: a multichannel LED Driver

This is kind of a report of the second attempt in making a power constant current source, high speed, for power LEDs. Taken all the errors made previously, I tried a new linear based current source which should be kept “simple” and “fast”.

I have experimented with power LEDs, how they work and various solutions possible to drive them. With a pseudo evaluation board I tried the very inefficient linear based approach, with the intent of making an high speed driver. As you can read in the previous article there are some troubles that make this kind of circuit everything but not so straight for a rapid DIY approach. On the other side, this journey was very educational to me. The current absorbed per LED (700mA), thermal dimensioning and the LED descriptions are still present in the previous board description, while here I am focused on describing the improvements in this version.

Troubles with the maximum input voltage, offset, mechanical handling and power efficiency have been encoutered and herein somehow fixed with a “new” version. Moreover,  I perfectly know that there is still no input and short circuit protection, as long as various improvements that can be made. But was only the beginning of PCB design, with PTH (plated-through hole), which occupy space and size, so costs. So I said: do not put any capacitor, what could happen? Yeeah, herein I will describe how this choice was something comparable to only an evil genius would do.

#### Troubleshooting the offset

The main issue on the first version, was related to the offset introduced by the op-amps. Therefore, I need to countermeasure this by injecting some current in the sense resistor. This will lead to some dummy current absorbed by the device, thus the capability to deactivate this functionality. This can be accomplished by using SMD transistors and the proper resistors to inject up to: $I = \frac{V_{offset}}{R_{sense}}$. Where $V_{offset}$ and $R_{sense}$ are the maximum op-amp offset and the sense resistor. Let’s say 7mV of offset and 0.47Ω resistance, I need to inject at least 15mA. Since the current sink will work between 3.5V and 7V of supply, the minimum resistance to keep 15mA injected to the sense resistor will be aroud 270Ω, as you can see in the schematic. More input voltage, more losses. The enabling capability is achived efficiently by using an N-MOS digitally driven (0-5V), as a low-side switch, since the source voltage will be up to 0.33V, i.e. the maximum op-amp’s reference voltage.

This compensation will lit up the LED a bit lower, since part of the current used forthe compensation will not flow though the LED, but it is not significant on the final test. I have actually used some 330Ω and the result is achieved equally. But at the highest defined voltage here will source up to 20mA, meaning the the regulator will attemp to flow 20mA less in the LED. In picture below, R11 and T6 are the current limiting resistance and the signal MOSFET used to let deactivate this offset compensation, while Q3 is the main MOSFET which source current for the LED. The X6-4 and X5-4 are the connectors of the main board and the “satellite” which mounts the LEDs.

#### Troubleshooting input voltage range and voltage dropout

Another issue was related to the high value of the sense resistor. This high value was chosen in order to make the system more stable, since the output resistance of the op-amp combine with the MOSFET capacitance, will add a pole. The circuit will be stable if the frequency of the added pole is more than a decade above the circuit’s bandwidth. But I DON’T know the output resistance of the op-amp. Empirically, increasing the efficiency on the sense resistor by reducing the resistor’s value itself and the input voltage, lead to a greater ringing, because reduces the pole frequency. Thus, the system must be slowered down with respect the expectations.

As can be seen in the picture above, the capacitive load (here the main MOSFET) introduces a $R_O \cdot C_L$ pole at $f_p$ frequency in the picture, where $C_L$ and $R_O$ are respectively MOSFET’s input capacitance and op-amp output resistor. At the crossover frequency the closed loop phase w/out compensation is very close to -180° due to the pole contribution. In my circuit, we are at unity gain, therefore in the area labelled as “potentially unstable gains”, that reduces even more the phase margin. Now, with the compensation used in the last design it only rings a bit, improving the situation. In other words, we are practically somewhere between the dashed line (no capacitive load) and the dashed one (capacitive load and unstable control feedback), with a compensation empirically adopted, since the $R_O$ is unknown.

Reducing the input voltage, will bring to the need of reducing also the input control voltage. This reduction has been made by 10 times, so in the board also the voltage divider resistors have been added. Then a buffer placed before this voltage reducer allowing me to not interfere with the resistance divider factor. Reducing the voltage drop on the sense resistor, allow me to power the system with a lot power savings which is not wasted anymore in sensing the current.

The main pain in the amp was to choose a different MOSFET that has a lower theshold voltage, allowing me also to use a lower voltage on the opamp. The choice was on the IRLI630GPbF. Almost 2V of threshold, but big input capacitance. Below the entire schematic:

Handling and manufacturing

I preferred to desing also a separated satellite PCB which is used to store the LEDs. I wanted to try to make it more compact. In these pictures are shown the main board and the satellite, sent togheter to OSH Park as a single design. In terms of cost, that was not a good idea. I like to call it experience.

Here the final assembly:

#### Frequency troubleshooting and considerations

The oscillation was even worse, despite the compensation. That’s the evil genius’ choice. I didn’t put any filtering/bulk/tank capacitors. Putting a 100uF one on the main voltage rails, eliminate the oscillation. This let me understand that in my setup I had a lot of wires that are going from the board to the power supply, keyword: RLC oscillator.

The capacitance will likely dump an LC resonance composed by the MOSFET output capacitance and the lead/parasitic/wiring inductance on the supply rails. The frequency that is dumped thanks to the capacitor seems to be around the crossover designed freqeuncy, ~160kHz, not so strange since at crossover we had such stability issues.

But lowering the voltage will trigger again ringing. The answer is in this picture:Reducing the supply voltage to 3.5V will increase the (already fat in its own) input capacitance, Ciss and also the output capacitances of the MOSFET. This reduces the pole frequency combined with the output resistance of the op-amp, tunes the LC filter, and with no proper handling leads to to much instability (see bode plots before).

And here the LEDs powered with a stable conditions. As always, if you think there are errors or suggestions, feel free to comment or contact me.