Since I can’t stand to have any of my lights run different UIs, I had to overhaul my TINI and replace the microcontroller so it could run MELD. This one was fairly in-depth because it required a significant amount of reverse-engineering Nitecore’s design. While I was at it, I added an ultraviolet mode as well.
Reverse Engineering
The circuitry of the TINI is very similar to the NU20, which I had previously done a similar modification to, so I got a head start. It is based on the MP2161 buck converter, which is tricked into running in constant-current mode by amplifying the current sense voltage and sending this to its feedback pin. To dim it, some voltage is injected into the feedback to suppress the output, similar to what Olight did on the S1 driver.
Moon mode is done by direct driving the LED through a PFET and resistor. The battery charging is managed by a TP4055, and there is hardware to monitor battery voltage and LED temperature. There is also a FET that pulls a pin low when USB power is connected. Above is my block diagram of the stock circuitry, and here is the picture I used during the process to work out what each microcontroller pin needs to do:
Dimming
My UI uses ramping, but this feedback injection setup used by the stock circuitry has a fairly limited dimming range. The PWM output is active-low and ramps between 100% and 77%, which translates to a current draw of 1000mA down to 70mA. In order to incorporate the moon mode hardware and dim even lower than the stock light, I added a step mid-way through the ramp that shuts down the buck driver and transitions over to PWMing the moon mode FET. This dims the LED from about 2mA down to about 0.2mA. All dimming is done on an exponential curve with 14-bit PWM. You can see this step-down in the video below.
Additions to MELD
I had to add a few functions to my normal MELD firmware to work with this light. There is a thermistor which uses a second pin to enable it, and it needs to be monitored since the heatsinking capability of the light is so low. Above a temperature threshold, the output will be ramped down and the indicator light behind the buttons will flash. Battery monitoring is also added continuously (in addition to MELD’s normal battery check function) and will switch to a dim level and subsequently force the light off if it has been left on for a long time and the battery level is very low. I also added a red mode to the special modes section that just turns on the indicator LED behind the buttons.
The firmware also needed to add indications for charging. It will wake up when plugged in and begin flashing the indicator LED, which will later transition to solid on when the charge is complete.
UV Hardware
After getting the new microcontroller (PIC16F1575) installed and getting the firmware running, I felt like it was a shame to do so much work without adding any new hardware, so I installed a UV LED that sits off to the side of the TIR optic. It’s a luxeon UV part on a small piece of metal core PCB, and the blue thing behind it is a thermal gap pad material. It is driven via 10-ohm resistor and FET, and I am proud to say that this additional function used up the last of the I/O pins - all 12 are used in this project.
I also changed the indicator to red using an XQ-E HI since I didn’t like the blue:
Video
Here’s a quick video showing the weird step in the ramp, the UV mode, and the changed indicator light (in the added red mode mentioned above). For more information on the full UI that this is running, check out my MELD UI overview here. In short, the buttons now act as up and down instead of mode and on/off, and there are many new features added such as shortcuts, strobes, battery check, and some user-configurable options.
Here’s a shot of the completed wiring job: