Darkstar Mk.II

High power custom caving headlamp you can rely on. Small, not that heavy, water and bomb proof.

Similar projects worth following
What you need when exploring underground places? Caving overall ? Wellington boots? These are handy, but you can live without them. The light is what matters. No light, no change to find a way out. Chinese headlamps are cheap and powerful only until the first collision with rock or first contact with water. Professional lights like Scurion are awesome, but a bit too expensive for casual cave/mine exploration. What is the dream of every hacker with underground passion? The custom, high power, bombproof headlamp!

After first prototype, it was time to build something much better - a bat-roaster headlamp with few hundreds of lumens. With no expensive integrated LED drivers. The custom buck converter is reaching efficiency of 96 % and costs about a half of the integrated solution.


After few trips to caves - and I mean the cave as the nature created them, no concrete walkways, just the mud and narrow passages - I was hooked. In the natural darkness, your life depends on light. No light, no safe way out. These 5$ headlamps with "fire" in their names from ebay are not the best choice and professional lamps like Scurion are quite expensive. So? Let's make custom headlamp!

What I need from the headlamp:

  • Mud/water/shock/bomb proof casing.
  • Long burntimes with reasonable light output.
  • High power mode for photography and large areas.
  • High efficiency.
  • Reasonable CRI and warmish color temperature.
  • Wide range of output power.
  • Flood and spot LED.
  • Thermal and low voltage limits.
  • Reasonably low-cost.

After the first iteration I was still not satisfied. Cooling through vias under LEDs was insufficient, going over 200 lumens was complicated, the custom LED driver based on PIC MCU internal comparator was far from being effective,... So here comes the new iteration!

LED driver

Newest Cree XP-L2 LED can go up to 3 A (or more if you are crazy enough), most low voltage LED drivers can't run on such currents and these that can won't work below 4 volts or so. Therefore I designed custom buck driver that can work on single 18650 Li-Ion with currents over 2 amps (higher currents can be reached by replacing coil and MOSFET for higher power alternatives).

It's hystersis driven buck converter with current feedback. The current is sensed on 0,056 ohm resistor, voltage across this resistor is amplified by opamp and fed to the comparator. The comparator is brain of the driver. When the measured voltage is higher than reference voltage generated by MCU, it turn's the MOSFET off, current drops below hystersis, MOSFET is turned on again and the cycle starts again. Nothing fancy, but quite simple. Only few parts are required and measured efficiency is reaching 96 % (when battery voltage is close to output voltage, average efficiency is around 90 %).

One disadvantage of such design is limited lowest possible current, it can't go below half of the hystersis current. So for this reason 10-100 % output is constant current, 0-10 % is dimmed by PWM.


The lamp is controlled by attiny 841. It generates two PWM signals which are fed to RC filter to get a DC voltage reference for two LED drivers.

The MCU is taking care of low voltage and overheating, when certain limits are reached, the output power is limited. When the battery is almost flat, the lamp switches to low power mode that can run for few more hours.

I'm also experimenting with automated light control based on reflected light. The light is measured by phototransistor and processed through PID regulator. It works quite nice on very short distances, but the sensitivity is too low for real use so far as the phototransistor is buried at the bottom of the lamp and only a tiny fraction of reflected light can reach it.

I'm using optiboot bootloader, but the code itself is completely arduino-free. No arduiono libraries were used, just the pure avr-glibc and custom makefile. To make it a bit friendly to other programmers, the hardware control routines form a simple API. To write a custom control mode only basic C knowledge is required, no need to touch hw directly. The API will provide programmer with button states, time of button press/release, light control in 255 steps for each high power LED, etc.


The body is machined from 6082 alluminium alloy.

Battery box is 3D printed from PET-G. To improve the waterproofness I painted it with ABS dissolved in isopropyl alcohol.


The lamp can run on single 18650, but to improve the burn times, I designed battery box for two cell pack. Two parallel 18650 can provide enough power for the whole day caving trip easily. The battery pack is protected by custom board with BQ29700 controller.


Battery box

sla - 283.19 kB - 04/25/2017 at 21:42



Battery box lid

sla - 69.81 kB - 04/25/2017 at 21:42



Battery box knob for easy opening

sla - 7.31 kB - 04/25/2017 at 21:42



Lamp schematic

Adobe Portable Document Format - 107.20 kB - 04/25/2017 at 21:42


  • New battery box

    Jakub Kaderka12/23/2017 at 15:10 0 comments

    Finally I finished the battery box. The previous version was far from good, the O-Ring was not held by anything when the box was open, so it was very easy to loose it. The new version has this problem fixed, I didn't have much time to test how much waterproof it is, but a brief test in the kitchen sink was successful.

    Also I'm building another two lamps for my friends, the green version look pretty awesome, I guess I'll try more different colors next time.

  • Make of the DarkStar

    Jakub Kaderka12/05/2017 at 18:04 0 comments

    Made a short video how the lamp was made - x64 speeded up.

  • Still not dead

    Jakub Kaderka11/20/2017 at 22:16 0 comments

    The basic design was finished some time ago, but I'm still making some small improvements:

    - Updated few bits in the firmware to make it more readable and removed some smaller annoying bugs and features (like there was no way to turn the lamp off immediately - useful when taking photos,...)

    - Replaced teflon insulation by loctite threadlocker, the seal seems to work well, several minutes submerged to two meters and no water got inside.

    - Got rid of the phototransistor. Adaptive light control sounds cool, but you'll be very glad it can be turned off after few minutes from entering the cave. It's working somehow on the surface, but there are tons of reflective surfaces down there. Let's stick with the manual controls.

    - Updating the battery box design (still in progress), the original one is prone misplacing the o-ring seal during changing batteries underground due to a poor o-ring groove placement.

    - Looking into building a spot welder, soldering Li-Ion cells together is not the best idea...

  • Shared documentation, project mostly finished

    Jakub Kaderka05/22/2017 at 20:23 0 comments

    The documentation and source code were shared on github.

    The issue with blinking and turning off was caused by casting temperature to unsigned... Stupid mistake, fixed. Now it works reliably. To ensure it will work under various heat conditions, I put the whole lamp (except batteries) to a freezer (-18 °C) for 30 minutes, to oven (70 °C) for 30 minutes and repeated 3 times. After such treatment it worked well. Only problem noticed was a bit warped battery box as it got soft in the oven.

    To test impact resistance, I dropped the lamp from 2 meters on concrete floor 6 times under various angles (approximation of cube). Unfortunately the lens was a bit too heavy for the LED, when the lamp hit the floor, lens mass pushed on the LED and caused separation of CREE optics from the chip itself. Fix is simple - just use a bit of glue to fix the lens in space.

    I guess the project can be marked as finished. All important parts work as expected.

  • Light measurements, cave testing.

    Jakub Kaderka05/16/2017 at 20:07 0 comments

    First regarding the temperature issues. I resoldered one of the leds from cooper heatsink to aluminium one. When compared with brand new LED on the same heatsink it was clearly visible that old led is heating on much faster rate. Therefore the heat performance on cooper was worse due to the overheating LEDs during soldering.

    Also I measured the luminous flux. Maximal value was 869 lumens. The 70 CRI XP-L2 4000K LED topped at 562 lumens, 80 CRI one at 383 lumens. With both leds in 70 CRI variant the lamp should go over 1000 lumens easily.

    Anyway, I've finally tested the lamp in small local cave. From mechanical side of view it worked well. The light is quite pleasant and strong enough for my needs. Only drawback is the light stability :) - after hour or so it started blinking and after powering off I wasn't able to turn the main light on again. But that seems to be a firmware issue, I guess disable limit checking magic key combination could be useful.

  • Cooper heatsink

    Jakub Kaderka05/05/2017 at 08:09 0 comments

    I've been experimenting with soldering LEDs directly to the cooper heatsink. A piece of cooper was milled to desired shape, led thermal pad is soldered directly to the heatsink and other two pins are soldered to small pieces of FR4 i inserted below.

    I expected much better heat dissipation and lower LED temperatures, unfortunately the temperature settles on 107 °C. That makes me wonder, what's wrong. LED not correctly soldered to heatsink? I don't think so, it lies directly on the cooper with thin layer of solder. LED damaged during soldering? Bad thermal contact between the cooper and the aluminium body? Small surface area in contact with heatsink? XP-L2 is quite small, on aluminium heatsink, there was a thin insulation between the led and heatsink, but the whole LED was placed directly on the heatsink, now only the thermal pad is in contact with the heatsink... Or is there any dark magic involved? :)

  • Measurements...

    Jakub Kaderka04/29/2017 at 20:54 0 comments

    So it's time to measure how it behaves on electrical side of things:

    First the efficiency, it depends on the current of course and the power supply voltage. It's pretty good, over 90 % for currents higher than 0,5 A for the whole power supply voltage. The efficiency is topping at 96,9 %!

    The frequency side is similar, the buck driver frequency depends on the voltage difference and absolute value of input voltage, from almost 250 kHz it drops to 0 when voltage difference between led and power supply is under 100 mV:

    The current through LED looks like:

    And the voltage in switching point (where diode, transistor and coil are connected together):

  • Mostly finished

    Jakub Kaderka04/18/2017 at 10:24 0 comments

    After the body was assembled, I could finally test the heat dissipation. On full power body goes to 60 degrees Celsius in few minutes. But full power is ridiculously high, nice for huge domes or for photography, but it makes no sense to use it very often.

    The aluminium star heatsinks are not perfect, I guess I'll replace them with LEDs mounted directly on piece of cooper to reduce the temperature of LED itself.

    (ignore the date on the image, the thermal camera battery died and the time was restarted)

  • Hard anodizing, heat management, etc.

    Jakub Kaderka04/09/2017 at 11:10 0 comments

    The mechanical work is mostly finished.

    After few attempts, I was able to hard anodize the headlamp body at home and it looks quite well for the price! The process is quite simple, 30 seconds in 20% NaOH, washing, 45 minutes in 20% H2SO4 with current density about 2 A / dm^2, washing, 60 minutes in egg paint solution heated to 50°C and finally 1 hour in 90°C water. That's it. The final surface looks amazing and it's scratch resistant.

    Also few electronic design tests were conducted. Under maximum operating voltage of 4,2 V and 2 A per LED the board behaves as expected. After 1 hour running on highest setting, the highest temperature measured was 66°C. That's for board placed on the table and room temperature of about 25°C. When sealed in the headlamp body, the temperature will rise higher, but I guess it won't go much over 90°C.

    Machining the body

View all 9 project logs

Enjoy this project?



Hercules wrote 06/20/2020 at 04:38 point

Hello I wonder if anyone here can help me with information? Where can I find a key to turn on the LEDs like your flashlight project. I would be grateful I am trying to develop a flashlight too

  Are you sure? yes | no

Piotr Goławski wrote 12/01/2017 at 22:02 point


Nice project 

For thermal improvement try this way:

After changing from classic torch led radiator to this solution my torch is much warmer than before. It also get worm more quickly. 

Best way is to use copper but i had only brass.

I machined brass "cylinder", removed positive pad on led. Led is soldered directly to cylinder. To solder used gas stove and 1mm thick steel plate as heater. Positive terminal connected on top of XML2. Then pressed it in torch.  Solder resistance between XML and brass is low, high conduction of cylinder, big thermal "capacity", big area between brass and case reduce resistance.

Another torch will be made with copper cylinder.

  Are you sure? yes | no

Piotr Goławski wrote 12/01/2017 at 22:05 point

Now I see that you make radiator in the same way!

  Are you sure? yes | no

Jakub Kaderka wrote 12/02/2017 at 07:41 point


I saw similar solutions and made a heatsink in a bit different way so I needn't to modify the LED itself.

I machined small pockets into a cooper heatsink to insert a pieces of PCB in there. This way, LED could be soldered as usual with no modifications. Unfortunately during the soldering cycle I think I overheated the LEDs a bit so the resulting LED temperature went higher than on the usual star.

I'm thinking of something different in the next iteration - PCB with cutouts below the LED heat pad and machined cooper heatsink with inserts to the cutouts. Or another variant - order a PCB with cooper core, bit more expensive, but most elegant solution.

  Are you sure? yes | no

lukie80 wrote 11/30/2017 at 00:07 point

Thank you for your great thorough work. I'm planning to build the electronics in through-hole technology, so my circuitry will be huge, thus the LTC1772 (7€@ebay) low-Vin current-mode step-down controller with up to 100% duty-cycle seems to be a lazy alternative for me.

BTW: Many mainstream headlamp manufacturers are close to fraud (Ledlenser, Olight): Claiming high brightness which can be maintained only for a short time. Well, chinese sellers fake the specs by at least a factor of 3.

  Are you sure? yes | no

Jakub Kaderka wrote 12/02/2017 at 07:44 point

Take a look here

It's in the Czech only, but pictures are pretty self explanatory, the guy built an amazing headlamp with THT parts. Also a way he designed the heatsink is pretty interesting.

  Are you sure? yes | no

lukie80 wrote 12/22/2017 at 01:42 point

Thanks a lot. I've already bought alternative THT components based on your schematics and I'm happy to say that your step-down constant-current converter works good on my bread-board so far. :) Yeah, I wish I still had access to a lathe and a milling machine.


I finally finished my version of your headlamp. Initially I had a horrible efficiency and the FET was getting hot. I simulated my circuit yielding no problems. So finally I bought a cheap 20MHz USB oscilloscope and found the culprit: It was my Attiny85 (running damellis Arduino port) which used a default PWM frequency of 62Hz. Furthermore, I had to increase the capacity of the main stabilizing capacitor.

  Are you sure? yes | no


[this comment has been deleted]

Jakub Kaderka wrote 11/27/2017 at 15:24 point

I haven't, thanks for the link, I'll take a look.

  Are you sure? yes | no

ActualDragon wrote 11/23/2017 at 00:26 point

how are you going to test it with bombs? 

  Are you sure? yes | no

Jakub Kaderka wrote 11/27/2017 at 15:23 point

Well, that was not the right word I assume. Would the cave-proof sound better? :)

  Are you sure? yes | no

ActualDragon wrote 11/27/2017 at 15:51 point

ah shit, i was hoping you knew a way to legally get bombs

  Are you sure? yes | no

ia wrote 11/21/2017 at 15:27 point

Czy była by szansa modyfikacji by była to lampa stacjonarna offgrid, bez dostepu do sieci?

chodzi o to by dostosowac ja do roznego rodzaju pradu pobierania (5v usb, 12 v zapalniczka i kilka volt z panelu) jak i oddawania czyli kilka roznych ustawien swiecenia.

Czy pwm moglo by zwiekszyc zywotnosc baterii kosztem mrygania

  Are you sure? yes | no

Jakub Kaderka wrote 11/27/2017 at 15:32 point

I hope I translated this well (I'm Czech, my Polish isn't that good).

The lamp is off grid by design, it's a headlamp used for caving, there are no power outlets in the cave (well, there might be - drills and stuff are used in caves sometimes). So far I'm using a small Li-Ion charger running from 5V USB power supply, but any Li-Ion charger would work, so you can just get a cheap charger that can run from the desired power source.

Well, yes, I'm using the PWM to dim the LEDs even more than the LED driver allows, lowest mode takes like 10 mA from the battery IIRC. With this current consumption, almost flat battery could last for few hours, maybe even a day or two.

  Are you sure? yes | no

frolickingdirtchild2000 wrote 11/21/2017 at 15:25 point

awesome project. Have you considered a hand crank circuit in the event your batteries die while still in the cave?

  Are you sure? yes | no

Jakub Kaderka wrote 11/27/2017 at 15:18 point

Well, if the battery dies, I just turn on my backup light :). Also the battery level is reported several times before the battery goes flat so there's a plenty of time to get out of the cave.

I'm trying to limit the size as much as possible, some places in caves are pretty narrow, a bigger thing in your pocket could be a bit limiting or annoying.

  Are you sure? yes | no

Martin wrote 11/21/2017 at 08:55 point

The anodized surface looks really beautiful. The use of egg paint (must be some kind of food color) is also a good idea. I tried some anodizing once, we managed to get the special paint for this, but if there is an easier way it's fine.

What is the purpose of the NaOH treatment? I did not know about this, so we didn't use it.

  Are you sure? yes | no

Jakub Kaderka wrote 11/27/2017 at 15:21 point

The NaOH removes fingerprints and a thin layer of oxides from the surface and makes the surface a bit smoother. The anodized surface looks a bit better after that treatment.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates