Saturday, March 29, 2014

Skyray King flashlight mod




Here's an extensive modification to the Skyray King, a very cheaply made but awesome light. It has a nice short form factor with 4 18650 cells in parallel, three XML emitters in multiple reflectors, and a momentary switch on the side. At first I did a relatively quick mod to pull in my ultimateflashlight code using a PIC12F617. This was with the first of these lights that I bought on eBay, which had a very simple linear driver. That mod was relatively straightforward, so here's a picture without explanation:


I later ordered another one which came with a more complicated buck driver (with three independent channels), and I decided to do a lot more with it. Up on the reflector there are three gaps around the outside between XML reflectors where I could fit more LEDs:


I milled some pockets into the aluminum, and then drilled small wire channels down into the driver area.


For colors, I used an XML-RGBW without the white die connected. Since there wasn't enough space to use a star, I used a slightly crazy technique that I originally tried on a Romisen RGB mod. I soldered wires directly to the pads on the back of the LED, soldered some scrap wire to the thermal pad to elevate it, and then sank the whole thing into Artic Silver thermal epoxy in the pocket. It's tricky getting the LED to sit flush, but once it's in it has very good thermal contact and the wires can't short because the LED is elevated off of the aluminum base.


On the other section I put in a UV led with the same mounting technique.


The color LEDs are each driven by an AMC7135 regulator at 350mA, and the UV is driven by a small 350mA boost converter that I pulled from a dev board that drove LEDs from 2xAAA. This is necessary because the Vf of a UV emitter is higher than Li-Ion battery voltage. The UV converter is switched on and off with a low-side FET by the microcontroller.


After upgrading the main LEDs, I thermal epoxied a thermistor to the back of the LED plate to monitor temperature. The last piece of hardware I installed were red and green indicator LEDs on the switch. These were tucked in next to the switch, and they shine through some epoxy-filled holes I drilled in the aluminum switch cover.


The stock driver sucks. The buck converters are decent, but the opamps are left powered when the light is off, which results in a standby current over 1mA. I investigated the traces until I found the opamp power supply lines, and cut them. Since they only pull a milliamp, my microcontroller can power them directly from an I/O pin, which allows me to shut them off when the light is in standby. I also found the PWM control inputs to set brightness. I pulled the stock microcontroller off the board and broke out the connections to it since I'd be using a bigger one. The chip I used is PIC16F1824, which has 4 PWM channels and just about everything else you could want in a 14 pin package.





All the wires were pulled through in a terrifying mess and wired up to the SOIC microcontroller, which just floats in space. The software wasn't ready when I did the hardware work, and I wanted to be able to upgrade, so I came up with a trick to get programming access:



I found spots on the PCB without traces and drilled small holes through it, then epoxied short female headers on the component side of the board. These were wired up to the ICSP pins on the microcontroller, and after the light is assembled I can just plug breakout wires into the holes in the battery compartment and do firmware updates.



As for firmware, I ported my ultimate flashlight code over to this part, and then started adding features. It maintains the original control scheme with ramping, smart momentary, high/low shortcuts, and strobes. I also had to add colors and UV, temperature and battery monitoring, and outputs for the button indicators. Admittedly I didn't develop this quite as much as I should have, and I have since moved on to an entirely new software version written in C for my MELD boards (post soon to come). I did get it working pretty well though, here's a demo video of the UI:





Google code has stopped taking uploads so I don't have the source posted at this time, if you want it post a comment