GXB20 v2

                                                                       Programmable Boost LED Driver

Single-Cell Programmable Constant Current Boost LED Driver

This project was born from the desire to create a simple, compact, low-cost, but very bright LED torchlight with high-quality light. The result of this was the creation of a custom, extremely small yet powerful and full-featured LED flashlight driver which I've named the GXB20. This page documents the development and engineering choices of this project.


My only real experience in the flashlight world was introduced to me by my friend Tim back in secondary school (grade 7 onwards eqv.), when he introduced the Princeton Tec 40 (PT40) to me, which was the first real flashlight I bought. It featured a 28 lumen halogen bulb powered by 4 AA batteries in a compact,181g waterproof plastic body, featured a twist bezel, an orange-peel reflector. At that time, I was amazed by its bright output, rugged nature and compact size, and used it for several outdoor trips. A few years later, a crack appeared on the case and was the end of the life of this light.

A couple of years ago, I found a nice deal online for a single AA LED flashlight for just a few dollars. I liked how compact it was, that it used only a single AA battery, and had a zoom lens. It was actually pretty bright compared to regular incandescent flashlights I had previously used, and had a light output of probably something around 100+ lumens, which was much more than that 28-lumen PT40! I liked it so much that I carried it with me a lot and it became my default flashlight, and it's accompanied me to many places, from the temples of Angkor Wat, surviving power outages in Boston, to lighting up the back of my TV cabinet.

Several years passed and LED technology has progressed significantly - it's time for a brighter flashlight!

So in 2016 (time of writing), I did some research about flashlights and found that manufacturers like Zebra Light, Nitecore and Fenix etc were making some really bright, >1000 lumen lights using very good quality LEDs (and by good quality, I mean those which are not only efficient, but also having a high Colour Rendering Index). That's an order of magnitude or more brighter than my little AA flashlight! However, they were very expensive, typically around the ballpark of $100. At the same time, I also found some nice, cheap single-18650 torchlights on Amazon for just a few dollars each. This made me wonder - is it possible to create a cheap yet powerful flashlight?

This was the motivation for the creation of an LED driver which I have named the GXB20 - G for my name, X denoting the fact that Cree's line of 6V/12V XHP50/70 LEDs were the motivation for creating this driver, B denoting the fact that this is a boost driver, and 20 denoting that the PCB diameter is 20mm.

[Update] The V1 driver went through a minor revision in early 2017, and the newest revision as of writing is GXB V2. This page describes the development of both of these drivers.

[Update - Jul 2017] A 17mm version of the GXB20 has been created, the GXB17. Please check it out here!

Both sides of an assembled GXB20 V2 LED Driver less the spring. Note the mistake in the silkscreen - it should read 6V / 3A instead!

GXB20 (v2) Feature-List

- Single-cell (e.g. 18650 lithium rechargeable battery) 2.7 to 4.3VDC input (6V max)
- True Constant Current Limiting (no PWM or flicker)
- Synchronous Boost topology
- Nominal 18W out (6VDC at 3000mA), (9VDC at 2000mA) or (12VDC at 1500mA)
- Designed primarily for XHP50/XHP70 CREE or Nichia 144-series LEDs running in 6V configuration
- 20mm Driver Board diameter
- Low-Battery-Voltage management and cut-off
- Programmable with ATtiny84A MCU and 6-pin SlimStack header
  > Configurable modes with EEPROM memory for modes
  > Real-time temperature sensing and cut-off
  > Two extra GPIOs for Mode Select
  > E-Switch capable with firmware
- Over 90% efficiency throughout most output ranges
- 256 levels of true constant current brightness levels
- Off-time Capacitor and mode-memory

In this page, I'll outline the motivations of this project, how I designed this driver, and how I put them all together. Hopefully this will also be a useful resource for many like-minded hobbyists around the world who are also fascinated by flashlights and power electronics :-).

 Dec 2016 

Designing the GBX20

The core challenge of this project is to create a suitable boost driver, and we need to do some electrical engineering to get us there. So let's begin! But first, we need some constraints to frame our engineering decisions. We will start by determining where we want to fit the driver into, and what LED it will drive.


One of the main motivations of this project was to be able to modify low-cost of-the-shelf flashlights to make them better. I found that the 'SSK98 UltraFire XML-T6', which retails for just a few dollars each on eBay or Amazon, was an excellent cheap flashlight to base this project upon.

The SK98 has a reasonably compact size, houses a single 18650 Lithium cell, has a zoomable lens, and best of all, costs only $12 for two! I bought a pair of them on Amazon and proceeded to take them apart to see how we can modify them. Note that this particular flashlight was just one of many with the same generic housing, perhaps all being made cheaply by the same Chinese supplier, and despite the 'XML-T6' moniker, it actually features a completely different, non-Cree LED. Regardless, it was a good, commonly-available host and a good place to start.

As a side note for those who are not familiar with Cree, Cree is a semiconductor company and one of their main branches is in the LED industry. Other big players include Nichia and Osram. The XML is one particular line of LEDs made by Cree and are known for their good quality light, and consequently is an industry benchmark. T6 refers to a particular bin of LED brightness. Typically LED brightness (efficiency) comes at a cost of LED colour quality (Color Rendering Index).

XML and XML-2 LEDs from Cree - notice the difference in substrate, bond wires, and phosphor texture/p>

NNow these flashlights supposedly come with a 'Cree XML LED' in them. If genuine, the XML range is one of the best performing 5x5mm single-die LEDs on the market at time of writing! After taken them apart (see below), I found that they indeed turned out to be non-genuine XML LEDs, and are instead LatticeBright  LEDs.

Don't get me wrong - LatticeBright by itself is a completely legitimate company producing quality LEDs, just typically at a lower price point and consequently lower performance. I only say non-genuine since they are often marketed as Cree LEDs, which are typically more expensive and slightly higher in efficiency and/or colour rendering quality.

Out of the box I was pleasantly surprised how bright these cheap flashlights were compared to my existing AA LED light! I turned on the SK98 flashlights and measured that they were drawing around 6.7W during operation. These flashlights were bright, but not bright enough, considering that they were running at much less than the ~10W maximum power that genuine XML LEDs can be driven (datasheet spec - in real life with better cooling, they can be driven much more!). There a few things we can do about this:

1) Replace the LatticeBright LED with a better one (e.g. XML-2) with better CRI and at desired colour temperature
2) Modify the driver to run the LEDs at higher current to make it brighterbr> 3) Create a new driver to use even better LEDs to make the flashlight much brighter

The first 2 are easy to achieve, and in fact I did modify one of them and replaced it with a genuine XML-2 LED with high CRI and warm colour temperature (see below). The second is easy to achieve by simply changing out the current limiting resistor(s). Next of course, we will try to see if we can do (3) - make a whole new driver ourselves!

Disassembly of the SK98 UltraFire Flashlight


Disassembly of the flashlight was actually quite straightforward. Doing this will allow us to take a look at the internal construction as well as the electronic components.

The construction of this flashlight is extremely simple and everything came apart very easily.

In about a minute, we were in! The LED is soldered to a metal-backed aluminium PCB and is held down to the pill via a retaining threaded ring, squeezing it down to the aluminium pill for good thermal contact. The pill also houses the press-fit 20mm diameter driver PCB, where the battery spring is also soldered on to. After some desoldering, the entire assembly comes apart easily.


Replacing the LatticeBright LED with a genuine Cree XML

Now let's take a closer look at the LED. We can easilly see that the LED is not in fact a true Cree LED, but an alternative part by LatticeBright. They do make decent LEDs, with different qualities than a genuine Cree, to hit a lower price point. We can upgrade our light quality by swapping this out. Again I want to point out that I'm not bashing on the LB LED, and in fact the LB most definitely produces more light per dollar!

We can see the difference in LED construction by comparing the green LatticeBright LED with a new, genuine Cree XML-2 LED I bought. Notice the slightly different die size, phosphor application and bond wires.

Next, I replaced the LED. This was done easily using a nice fat-tip on my soldering iron heating up a copper sheet, where the aluminium MCPCB sits on, and desoldering the LB LED. The new Cree LED was then reflowed on the same way. We now have an upgrade light! - not any brighter, but of a higher light quality!/p>


Next, let's take a closer look at the driver board. It's labeled YN-20-3, and essentially only has one 1uF capacitor, one SOT23-3 IC, and 4 resistors! Very efficient in components!

CClearly all the control is done entirely inside the SOT23 IC, which has part numbers GY02-45. I could not find anything about this IC, but it seems nothing more than a very basic PWM-based LED driver with likely a small integrated FET inside, including some smarts with off-time memory using C1. I've drawn the schematic above for reference. It's really built down to a price.

Clearly the LED is driven directly from the lithium battery with R1 to R4 acting as series resistors. Brightness control is done by Pulse Width Modulation. It's easy to increase the brightness of the LED by decreasing the series resistance, but if we do it too much, we run the risk of blowing the internal FET in U1 from overcurrent.

Now we have seen the SK98 disassembled and did one simple mode, we can design a new driver for it./p>


Cree XHP50 and Nichia 144 LEDs

The Cree XML-2 LEDs are already some of the highest performing single-die 5x5mm LEDs on the market today. Yet we are limited to 'only' 10W drive (datasheet maximum). If we want to to get more light, we need to go one step further. This is where the Cree XHP50 and Nichia 144 series LEDs come in.

One of the goals of this project was to create a very bright light, so the logical step was to utilize the extremely high performance CCree XLamp XHP50 or XHP50.2 LEDs (XHP50.2 LEDs were only released to the market shortly after the writing this page). The 144-series LEDs from Nichia are also impressive candidates and have even better colour rendering, but with marginally lower power handling capabilities. So unlike the XML2 which can handle a nominal 10W of power, the XHP50 handles twice the power at 19W!

To achieve such high power output. these LEDs pack 4-dies into one substrate, and come in either 6V or 12V configurations (depending on PCB layout for the Cree, or part number for the 144). For the rest of this project, I decided to focus on the CREE LEDs since they were easily available on consumer electronics sites like Digikey and Mouser, unlike Nichia who do not distribute their LEDs in low quantities to normal consumers (at least at time of writing this page).


From left to right, the XHP50.2, XHP50 and XML-2 LEDs (photos by Cree)/p>

Let's do a quick comparison of the XHP50 and the XML2 (left-most two in the image above). The XHP50 packs 4 dies on a same-size 5x5 mm substrate and has a widened dome. With 19W drive, this allows a maximum luminous flux (at datasheet maximum) of just about 2400 lumens (with the highest efficiency 70 CRI LEDs) - this is twice as bright as the brightest XML-2 single-die LED. In addition, the XHP50 also come in some very nice high CRI (>90) of different color temperatures, but at a cost of reduced luminous efficiency.

Finally the XHP50.2 LEDs which were just announced at time of writing in end 2016, pushes the maximum brightness up to 2654 lumens, efficiency up to 165lm/W, and also comes in 90+CRI flavours (these may be a little difficult to buy until they start to become easily available on the market).

The 4 dies of the XHP50 are arranged as two parallel strings of 2 dies. Therefore instead of a V_fwd of ~3V, we have an option of running it at 6V or 12V depending on the PCB layout. So one cannot simply replace a XML LED with a XHP one without changing the LED driver, since the drive voltage required is different.

As an example, let's take a look at the XHP50A-00-0000-0D0UH250G, which is a >90CRI 5000K XHP50 LED with 1032lm at 25C (900lm at 85) with a 12V 700mA / 6V 1.4A drive current, and available on Mouser Electronics for just about $10 per piece in 1x quantities. This should give us just around 1900lm with a nominal ~6V 3A drive current. /p>

Chart from Cree - XHP50A Datasheet

There are 3 main brightness settings I'd like to figure out for this project - full brightness, medium, and a dim setting for extended run time or thermal cut-off. I picked these 3 arbitrarily:

1900lm - Full brightness - 3000mA Drive, 6.125Vfwd
770lm - Half brightness - 1000mA Drive, 5.725Vfwd
200lm - Low brightness - 250mA Drive, 5.3Vfwd

Assuming a drive efficiency of 90%, that we use 90% of battery capacity, and that we use a 3.7V 2500mAh 18650 battery, we can conservatively say we will get roughly 25mins of run time at the highest power, 1hr 20min at 'half brightness' and up to 6 hours of run time at lowest power.

We will use these values later when designing our power circuit.


Boost Converter Design

TThere exist many LED drivers on the market today which you can buy to fit into a flashlight host. These are very popular among hobby flashlight builders or modders. These drivers range from simple constant current LED drivers, to more complex ones with programmable capabilities and direct drive FET ones.. These drivers work well and are often based on the AMC7135 which is a 350mA low-dropout constant current regulator. To increase current handling capability, several of them are usually used in parallel. In simple single-die LEDs driven by a single cell, this is a good and easy solution to achieve Constant Current (CC) operation.

However, none of the drivers I've come across address the main challenge we face - to be able to drive a 6V LED from a single cell (3.7 to 4.2V), at least at time of writing./p>

[Update Jun 2017 - After the completion of this project, I was alerted that there finally exists a commercial driver called the H1-A which achieves what we want! Unfortunately it is 20mm in size, has an off-board inductor (a little less robust), and doesn't fit into 17mm flashlights. Putting the functionality of the GXB20 into a 17mm package was the motivation for the successor to the GXB20, the GXB17, which you can read about here!]

To solve this, we need a  boost converter capable of boosting the voltage up to 6V (or 12V) to drive the LEDs of our choice (e.g. XHP50) from a single 18650 battery. And at the same time, it needs to be able to handle the high currents required (3A at 6V). Fitting an 18W DC-DC converter in a small space is challenging! Let's create a list of requirements.

Boost Converter Requirements:

- Input voltage - single Li-ion cell
- Be as efficient as possible
- Be as small as possible to fit on a 20mm PCB to fit inside the host
- Output voltage boosted to at least 6V
- Some sort of constant current limit and/or capable of controllable limit
- Capable of at least 3A output (i.e. something like ~7A on the input)

Image from TI's TPS61088 Website

After a little bit of searching, I found that Texas Instruments makes an integrated PMIC (power management IC) which looks as if it was specifically designed for this purpose! This is the TPS61088 10A fully-integrated Synchronous Boost Converter! I won't go through all the details here, but it not only checks all the boxes in our requirements, but also adds several cool features such as thermal shut-down and programmable soft-start. Best of all, it comes in a fully integrated package with in-built high and low side FETs for high-efficiency synchronous operation, and comes in a very small 4.5 x 3.5 x 0.9mm package!

Boost Converter Design

With our choice of IC done, we need to figure out how we should configure it, and this depends on what our desired input and output requirements are. So let's determine the constraints and design around them. To determine the values, I used TI's excellent WEBENCH designer to do a quick reference design and modified the suggested values:

Soft Start and Enable
In order to prevent high-inrush current during startup (which will be enabled via the EN pin connected to our microcontroller), the TPS61088 has a soft start function controllable by a capacitor on pin SS. Lets arbitrarily choose a soft-start time of around 10ms - in this case we can use a 47nF capacitor for a ~11.3ms start-up time.

Switching Frequency
Switching frequency can be varied between 200kHz to 2MHz, and is set via a resistor between SW and FSW. In this case, lets just use the recommended value of 267kR, which gives us a switching frequency of around 600 to 595kHz.

Peak Current Limit
In order to protect both the battery and the TPS61088 from a fault condition, we can set a peak current limit. Assuming a poor 90% efficiency driving the LED at 3Apk (6.125V Vfwd) and a battery voltage of 3V, we can see something around 7A from the battery. Due to device variation, we can add ~1.3A as recommended from the datasheet to give us 8.3A. Adding another ~10% margin  gives us a value of 9.2A so we will set a current limit of 9.2A using a 110kR resistor at ILIM.

The TPS61088 can operate in both forced PWM and PFM mode. Considering that we will likely not be driving the LED often below something like 200mA, the efficiency shouldn't drop below 90% for most of the time. Forced PWM also has slightly higher typical efficiency across the range, so this will be the mode we will be using. The MODE pin will be connected to GND to run the device in FPWM. 

Constant Current
I bolded the title for this section because I think this is a critical part of LED control. LEDs have an unusual characteristic whereby changing the applied voltage across the LED corresponds to an exponential-ish change in current draw (and thus brightness). In addition, manufacturing differences and thermal effects result in Constant Voltage LED control to be quite finicky, usually leading to potentially dangerous situations with thermal runaway, over-current drive and large LED brightness variation. Therefore we cannot run this boost converter in constant-voltage mode, and we certainly don't want to run it in constant voltage mode + a series resistor, because this will burn a bunch of power in the series resistor (though it will probably work!).

There is a much more linear relationship between the current draw of the LED and its brightness. It seems advantageous to approach LED drive with a Constant Current driver, which varies the applied voltage automatically such that the current is at a desired level.

But how to achieve this, given that the feedback for the TPS61088 is based on a fixed output voltage? - and how to make this adjustable?

Here's the approach I came up with - Since all the feedback pin cares about is a certain voltage, all we need to do is to create a system to convert the drive current to an appropriately scaled voltage To achieve this, the LED is driven with a series 30milliOhm current sense resistor. Running a full 3A through it will give us 90mV. This is too small to feed into the feedback pin (which for the TPS61088, has a comparator reference of 1.2V), so all we need to do is to amplify this.

I used a simple non-inverting op-amp topology which its output connected to the FB pin, and the gain controlled via a digital SPI-based potentiometer. By hooking this up to a microcontroller, we can adjust the gain of the amplifier on the fly, and therefore use this method to create true constant-current regulation.

With a microcontroller on board, we can control the brightness of the LED by changing the gain of the amplifier, and we can also use to to create some interesting effects like a 'candle-flicker' or 'fireplace' mode. This can be coupled together with the EN pin of the TPS61088 to also create flashing effects, all without requiring an additional FET for PWM brightness control, saving us BOM cost and PCB space.


Programmable Features

The main driver board needs to contain the boost converter, associated passives, and a microcontroller. PCB space is at a premium and we need to be able to fit everything in a really small area.

I searched for some of the smallest possible micro-controller units (MCUs) I could find on the market, which where hobbyist-friendly and still possible to hand-solder without reflow (i.e. not BGA, which eliminates a lot of very nice options). Regardless, the Atmel ATtiny13 Micro-Controller Unit (MCU) comes to mind, and comes in a 3x3mm QFN package.

The ATtiny13 comes in a diminutive 3x3mm 10 pin 'QFN/MLF' package, and not only works down to 2.7V (1.8V for the V version), but also has a small amount of EEPROM for memory functions, and has a 4 channel ADC. It's also  compatible with the hugely popular Arduino environment. There is in fact another smaller ATtiny version - the ATtiny4/5/9/10 coming in with a very small SOT23-6 or 2x2mm UDFN package, but unfortunately lacks EEPROM. (The ATtiny45/85 is another IC I'm quite fond of but unfortunately it's smallest package is a 4x4mm QFN).

But considering that the smallest ATtiny13 comes in a 3x3mm package, I thought I'd do another quick search to see if Atmel offered any other controllers in a QFN package of the same size, and I found that the more powerful ATtiny24/44/84A had exactly what I needed! (Note the A version is an identical drop-in replacement of the non-A version, but the A comes in a few power improvements with new manufacturing processes, and importantly comes in a small 3x3mm package which the non-A versions don't).


Using the 20M2 VQFN package gives us the same 3x3mm footprint as the ATtiny13, but has an additional 5 GPIO pins to use, as well as several more features over the ATtiny13 (though we probably won't need to be using them). I arbitrarily decided on some pin functions and wrote them down to help in schematic capture:

PA6 - ISP Programming MOSI & Master Out for SPI
PA5 - ISP Programming MISO
PB3 - ISP Programming /Reset
PA4 - ISP Programming SCK & CLK for SPI
VCC - 3V from LDO Voltage Regulator
GND - Ground 

PA7 - CS for SPI
PA3 - Boost Converter Enable
PA2 / ADC2 - RC Network for momentary mode change
PA1 / ADC1 - Thermistor / Temperature Monitor
PA0 / ADC0 - Battery Voltage Monitor

For PA3, we'll use this for toggling the enable pin on the TPS61088 high or low. The TPS61088 has a 1.2V threshold so it will work well with the 3V logic level we will be using for the ATtiny84. CS, MOSI and SCK will be connected to a SPI digital potentiometer adjusting the gain of our amplifier. ADC0 can be wired to a resistor divider to monitor battery voltage to make sure it does not fall dangerously low. Finally, ADC2 can be used during start-up to sense the voltage at a pin connected to a large RC network. This node will be charged up to logic high when the light is running. When power is turned off, a capacitor will store charge for a while, discharging slowly through a resistor. If the microcontroller is started up within say ~1s of turning off, it will see a high voltage here during start-up, and then change the flashlight to the next mode. The modes of the LED can then be stored in EEPROM for memory. This feature is known as OTC (Off-Time Capacitor).


PCB Design (v1)

With the main design and schematic completed, I proceeded with PCB layout. (Note - Version 1 has been replaced with V2, scroll down to see that in detail).

I started off by doing some careful measurements of how the driver would need to fit into the SK98 flashlight host and settled on the main dimensions. The SK98 requires a 20mm-diameter driver, so I decided on a 19.9mm PCB diameter to allow an easy fit with minimal filing required. Heat-sinking and ground connection is accomplished via a threaded retaining ring, so I saw no need for a tight circumference fit.

Next I created a 1mm border ring around the board as the main ground connection to the case of the flashlight, and placed a ~8.5mm diameter truncated pad in the middle for the main spring connection to the battery. With the main constraints in place, I could then drop in all the components and begin PCB routing.

Ideally I'd like to do a 4 layer board with ~2oz copper thickness, but I tried to do the best I could to fit everything in 2 layers, and wound up with the above result with a reasonable minimum 6mil trace and 5mil spacing.

To increase current carrying capacity, some of the large traces also have solder mask removed to allow for additional solder. Finally I was able to use no smaller than 0402 components, which should make DIY soldering a little easier (the tiny QFN packages are more difficult to solder but should still doable by hand under magnification).

After a day of work I was mostly done. The result for the top and bottom of the boards looks a bit like this:


A little bit of a squeeze, but I there's actually still quite a bit of space left on the board!

I could probably do a bit better but I was quite happy with the result. Some layout considerations include placing the NTC thermistor as close as possible to the edge ground ring for best thermal contact with the host (since I expect the LED to be the main heat source, not the driver), as well adding a 50mil 6-pin header-pad for programming the ATtiny84A microcontroller (this is in fact a regular 6-pin AVR ISP header but half sized). The main power electronics are on one side and the logic is on the other, with care taken to avoid high current loops being near the controller and peripherals (but it was difficult to  completely avoid this without going 4-layer).

It's always nerve wrecking to check through the PCB to make sure there are no errors but after looking through the board for a while, I sent it off for fabrication and hoped I didn't make any mistakes too big to fix!


PCB Design (v2)

After putting together V1 of the GXB20, I plugged it in and fortunately everything worked exactly as intended! However there were a few things that needed to be tweaked and improvements to be made. Some of these were:

- I wasn't too happy with the layout and felt that it could be improved a fair bit
- The variable gain amplifier suffered from high wiper resistance when the battery voltage dropped, something I overlooked during design
- The variable gain amplifier had a fairly small range due to the way I had it configured (less than 256 useful values)
- Current measurement was low-side instead of high (though I suppose nothing really wrong with this in this application)
- Programming via the 6-pin header was a little tedious
- Wanted to add more features including E-switch operation and mode selects

As a result, I made a few modifications. The power side stayed mostly the same, but I added a new high-side current monitor, tweaked the current amplifier feedback system, replaced with digital potentiometer to a better, smaller device with an internal boost, added a new 0.4mm SlimStack programming header, and completely re-did the layout for even better performance.

The result is GXB20 V2.


With the new PCB completed, I sent it off for fabrication! I was quite happy with the layout and was happy with how much tidier V2 was compared to the first version.

Scroll to the next section to see how it turned out. :-) 


PCB Assembly and Testing

Assembling the PCB (v1)

With the PCB layout done, I sent the boards for fabrication and they all came in good order. The smallest component on the board here are 0402 passives, which are fortunately still solderable by hand with very small soldering irons tips and needle tweezers.

The first GXB20 driver came together without too much difficulty. Ideally I would be reflowing the board but the component count was low enough that I decided to do this by hand with a soldering iron The only component which I soldered with hot air was the TPS61088 which required a good bond to the bottom thermal pad.


With the driver assembled, I programmed it with my initial firmware, and assembled it into the SK98 host.


The good thing about the SK98 flashlight is that the LED shelf is just about large enough to accept the commonly available 20mm 'star' Metal-core PCBs. I purchased a few excellent copper SinkPAD-II brand MCPCBs and reflowed some CREE XHP50 LEDs I bought on Mouser. These MCPCBs are particularly high performance with a direct copper bond from the center heat-tab to the MCPCB core, but requires a lot of heat to solder. Soldering was done using the technique I described above.

And... it works! The GXB20 driver is working!


Assembling the PCB (v2)

After testing out the GBX20 V1, a few changes were made as described above and the board was completely redone for better layout and with an updated design. New PCBs were ordered and I assembled a few of them for testing:

Having had more experience, the GXB20 V2 drivers came together more quickly and I was very happy with the result! Now it's time to put it to the bench and to see if it actually performs.

Fortunately there were no electrical errors on the PCB but I did mess up the silkscreen and the driver mistakenly says "3V 6A" when it should say "6V 3A". Besides the layout changes, note the addition of a new 6-pin MicroStax header for programming (this turned out to be a non-ideal choice!), a new high-side current monitor, a smaller digital potentiometer and better layout.

Above is a side view of how the driver looks like.

The new driver requires a small tweak in the original firmware since the digi-pot was changed, but I got it up and running in no time, and everything worked perfectly!


Like before, the GXB20 V2 driver was assembled into a SK98 host. Note the use of Arctic Silver Ceramique thermal paste between the MCPCB and the aluminium pill. The result is a new GXB20 V2 flashlight with a 90CRI CREE XHP50 LED - almost 2000lm of light from a single 18650 in a compact form factor!


Driver Testing

In order to test the GXB20 driver, I needed a way to program the ATtiny84A on board. The Atmel AVR microcontrollers are easily programmed via the AVR ISP 2 programmer, which comes as a standard 6-pin 0.1" pitch header. There's no space on board to mount a 6-pin header of that size. Instead, I populated the board with a 0.05" 6-pin pad (for the GXB20 V1).

Next, I soldered up a simple 6-pin interposer consisting of a 0.1" 6-pin male header to a 0.05" 6-pin female header. I also soldered a 0.05" male header to the GXB20 V1 PCB (temporarily). This then allows me to program the board easily, especially for debugging. Once I've figured out the firmware, subsequent programming of the boards can be done really easily by just pressing the programming header to the pads and programming it the usual way.

Above you can see how programming the GXB20 V1 works. The problem though was that the 0.05" header needed to be soldered on and off each time I wanted to do any sort of development work on the driver, and this got annoying real quickly!


For the GXB20 V2, I used a 0.4mm SlimStack header instead! This allowed me to program the board much more easily. However I needed to spin another small PCB which would allow breakout from the corresponding 0.4mm female header, to the standard 0.1" 6-pin header of the AVR programmer.

To help ease programming, notice I also modified by AVRISP header to output 5V or 3.3V on the VCC pin, powered via the USB bus. However, care must be taken when powering the board as such, because there is reverse diode protection across the TLV700 LDO regulator, which then feeds directly to the boost circuit. Therefore some sort of current limiting may be required when programming in this method. The usual method of powering on the driver via battery is of course the recommended method in this case.

The first thing I did was to verify basic functionality - can the driver turn the LED on? Can the driver control the LED brightness via adjustable current limiting? If these two basic requirements are met, we can then test for low-battery cut-out, over-temperature, as well as off-time mode memory. I'm definitely not the best firmware writer but I quite clobbered together a quick firmware and achieved my desired operating functionality! The GXB20 is complete!



 Feb 2017 

Performance Numbers

How does the driver do in real life? To find out, I set up the driver on my bench and conducted some tests.

One test was conducted as follows. The GXB20 driver was hooked up to a Agilent power supply. In this case I conducted the test at 3.7V input across the range of output levels. The driver was also tested at a variety of input voltage from 4.5V to <3V but less comprehensively.

Input currents and voltages was measured via Kelvin terminals to avoid errors due to lead resistances. Output current and voltages were also measured to determine total driver efficiency across a range of power levels.

Above shows a photo of the test in action. The XHP50 LED was mounted on a 20mm star heatsink, which was in turn mounted on a big heatsink to keep it cool during tests. As a side result, the data may have some slight inaccuracies as the LED die temp rises, but I really don't have so much time to do a full datasheet-style test, and the measurements should give us generally decent real-life results.

Here's an example scope shot showing the driver output at 5 different and arbitrary power levels. This was achieved by configuring the on-board MCU to run a 'test program' during startup at different power levels for 1 second each. Cyan shows output voltage, and yellow shows voltage across the 30mR current sense resistor. Regulation is fairly clean, as expected with the very high switching frequency.

Test across 20 current levels 

Test of LED current (blue) and datasheet light output (orange) against 20 different current levels, as well as overall driver efficiency

I also spent some time and conducted a little more reasonable test at 20 arbitrary but equally-spaced constant current levels. 

In this test, the maximum power tested was a massive 22.4W into the driver, driving the XHP50 LED at a measured 3053mA. At this power level, just putting my finger near the LED light feels very hot! Based on the specific bin of 90CRI XHP50 I had on hand, this translates to a datasheet lumen output of around ~1700 lumens. Lower CRI bins less than this 90+CRI one used should yield close to 2000 lumens.

As mentioned, heat-sinking becomes very critical at these levels. Maximum efficiency was measured at around 98+% efficiency at lower currents of around 750mA out. This drops gradually to 87% or so at 3A output, meaning about 2W dissipated in the driver itself.

Most of the heatsinking of the driver occurs through the ground ring around the driver so mounting it in a host properly is also critical. Increased temperature after longer runs will certainly affect the efficiency. In all, the driver seemed to regulate current just fine all the way up to the maximum 3A load. Again, note that these tests were done at a 3.7V constant voltage input.

Finally, keep in mind that this efficiency number should probably be treated more as a ballpark figure. I expect the overall efficiency to vary significantly in various host configurations since there probably is non-trivial ohmic losses in connection points / spring. A a properly seated driver in a good host with a good switch should do much better than my cheap SK98 host. In addition, the efficiency measured above was the total system efficiency - driver efficiency should be a little higher (esp on the high currents), since some power is lost in the wires and connections of the test set-up.

Overall, the efficiency graph shape looks roughly in-line with simulation I did with the TI Webench tool, so I was at least reasonably confident with my test results!

In conclusion, the almost 90% or greater efficiency overall was a good result :-).

 Feb 2017 

Flashlight Comparison

The proof of the pudding is in the tasting - did the GXB20 live up to its intended designed purpose? Let's compare them to some existing lights I have to find out.

The goal of the project was to modify a cheap flashlight to accept a powerful and superior LED, and to develop a driver capable enough to drive it. I wanted to find a way to characterize and compare the results. Unfortunately I do not own a light-meter nor can I quantitatively measure the quality (CRI) of the light from a flashlight, so what I've done instead is to take a series of photographs to determine the brightness of the new GXB20 SK98 flashlight.

Photos were taken with a digital camera on manual mode, set at a 35mm focal length with an aperture of F3.6, ISO fixed at 400, white balance set to Daylight (6500k), and an exposure time of 1/60 in dark room. All zoom-able flashlights were zoomed all the way out. Batteries were fully charged.

Let's take a look at how the GXB20-enabled flashlight performs:

Test above numbered from top left to bottom right

Number 1 2 3 4 5 6
Light Source E44320 Greenlite LED Bulb CREE 2016 15W LED Bulb SK68-3W AA LED Flashlight SK98 UltraFire Flashlight Un-modified Modified SK98 UltraFire modified with Cree XML2 LED, Stock driver Modified SK98 UltraFire with GXB20 V1 and XHP50A
LED 3000K LEDs 5000K LEDs ? Unknown LatticeBright 'XML-T6'' LED ~>7000K? XMLBWT-00-0000-000HT30E7 80CRI 3000K ~250lm/2W
XHP50A 90CRI 4000K LED (G2-Bin)
Power Source Mains Mains Eneloop HR-3UTG AA LGDBHE21865 20A 18650 Lithium Ion LGDBHE21865 20A 18650 Lithium Ion LGDBHE21865 20A 18650 Lithium Ion
 Input Voltage 121.8VAC 121.8VAC 1.28V 4.11V 4.12V 3.80V
 Input Current 0.07A ? 2.00A 1.64A 1.62A 5.89A
Input Power 8.4W 15W 2.56W 6.74W 6.67W 22W
Light Output 800lm on paper 1700lm on paper ~100-200lm? <600lm? ~600lm ~1700lm

I compared the two SK98 18650-battery flashlights with each other - one with the original Lattice Bright LED - and another which I had modified with a genuine 3000K 90CRI XML LED from Cree, along with my old but trusty (and comparatively dim) SK68 single AA flashlight. These were also compared against regular 800lm and 1700lm LED bulbs, and of course the GXB20 light.

All batteries were charged to full prior to the photos being taken (e.g. 18650 charged to 4.2V open-circuit voltage, and likewise ~1.4V for the NiMH Eneloop). All voltage and current measurements were conducted using 4-wire terminal method for accurate data, and mains bulbs were measured using a Kill-A-Watt meter.

You can judge the images for yourself; but what stood out to me (and via looking at the histograms) was that the genuine XML2 LED was slightly brighter than the Lattice Bright LED by a hair, but they all paled in comparison to the modified SK98 with a GXB20 V1 driver and a G2-bin CRI90 XHP50 LED! The project is indeed a success!

In addition, I did another test by zooming the flashlights all the way in (since all of them were zoomy lights) and to compare how bright they are at maximum throw. The flashlights were placed at the same distance from the wall.

The SK68 was certainly quite dim, but it was able to make a tighter and still fairly intense beam due to the smaller die size. It's interesting to see how the XML2 die is in fact quite a bit larger than the Lattice-bright LED die, so the LB flashlight was in fact able to create a beam of higher luminous intensity.

While the first two (left) LEDs have a fairly even phosphor coating, it's clear that these two Cree LEDs (XML2 and XHP50A) have a non-homogenous one evident by the speckle pattern. The 4-die arrangement of the XHP50A is very obvious - it's an interesting pattern, but perhaps not something desired by all. Finally, the latter 3 beam shots give a very good size comparison of the die size, since they're all fitted in the same host with the same optical set-up! This means that while the XHP50 is the brightest by far, the beam intensity may not be as bright as one would expect at max zoom, due to the much larger size.

Overall, the GXB20 driver project is a success!

Future thoughts - put in a XHP50.2 or Nichia 144 LED and pair it with a GXB20 when I get my hands on those LEDs!

 May 2017 

Firmware, Modes and Real Life Usage

Having completed the GXB20 in early 2017, I've since brought it out in the field for outdoor use and am pleased to say that it has met my expectations!  I've also settled on an -ok- firmware which has served me well over the past few months and seems to work w.r.t. the safety and functional features. 


Above is the firmware modes and I hope the chart is fairly self-explanatory.   

Overall I'm very happy with how this project turned out! I certainly never made the GXB20 driver to be commercial in mind, and really was a just-for-fun project and for me to try my hand at creating something fairly tricky (i.e. a high power DC-DC converter in a very small package). I've learned a lot from this project, and it's really a bonus that I get a few really high-performance flashlights as a bonus!  

Useful Links


BudgetLightForums - Thread of this project as it progressed
Jaxman E2 - (and on CPF) A flashlight with very high CRI 5700K Nichia

Other Links

Fasttech - SK68 AA Flashlight for $3.85 and free shipping!
TEC40 - The updated version of the TEC40 I originally had, updated with a rubber overmold
Digikey - A contender for an excellent linear regulator
Maxim - Reverse current protection
Sinkpad - Copper MCPCBs
Fonarevka - Russian Boost Driver
Operational Smoke - DIY Microscope
Gough Lui - Philips Bulb Teardown

Back to main page
(c) Gao Guangyan 2024
Contact: loneoceans [at] gmail [dot] com

Loneoceans Laboratories. Copyright (c) 2003 - 2024 Gao Guangyan, All Rights Reserved. Design 3.
Removal of any material from this site without permission is strictly prohibited and will result in infringement of copyright laws.
Disclaimer: Projects and experiments listed here are dangerous and should not be attempted.
www.loneoceans.com/labs/ ... page generated in 0.00186 seconds