# My fully custom 18650 Flashlight prototype with a 3D printed body.



## PeterFH (Apr 7, 2017)

For the past few months i have been working on this and i finally got some documentation and the prototype done.
This is a completely scratch designed flashlight that is powered by 18650 cells from old notebook battery packs. 
It uses a fully custom circuit to drive the LED and manage the battery. 







Fully 3D printed main body. 
Dimmable in 31 steps, no PWM. 
Rechargeable with a regular phone charger. 
Uses a single 18650 Lihium Ion cell. 
Battery level Indicator. 
Three button interface. 
Arduino IDE compatible microcontroller. 
Full battery management and protection. 

Light output: 197 Lumen. 
Color temperature: 5000K 
Color rendering index: 83 
Efficiency at 100mA: 159 Lumen per Watt 
Efficiency at 250mA: 119 Lumen per Watt 
Runtime: TBD 

Height: 110mm 
Width: 45mm 
Depth: 26mm 
Weight: 130g (with battery)

Here is the full documentation including a ton of pictures:
https://hackaday.io/project/21001-brightenmacher


----------



## scs (Apr 7, 2017)

Impressive! Keep up the good work!


----------



## PeterFH (Apr 7, 2017)

Thank you, there is still a lot or work to be done!


----------



## rayman (Apr 7, 2017)

Great work ;-).

I had the idea of a flashlight controlled by an Arduino some time ago too. So you wrote the code in Arduino IDE?


----------



## PeterFH (Apr 7, 2017)

rayman said:


> Great work ;-).
> 
> I had the idea of a flashlight controlled by an Arduino some time ago too. So you wrote the code in Arduino IDE?



Thank you, it is technically not an Arduino but the chip is compatible with the Arduino IDE if you add the right board. 
Early designs had it programmable through the USB connector but that had to be scrapped for several reasons.

I wrote the code with the Arduino IDE and use it to program the whole thing with ISP adapter, yes.
Once my code is not a huge mess anymore, i will add it to the repository.


----------



## rayman (Apr 7, 2017)

Great, looking forward to that ;-).

I already did some projects with Arduino but not combined with a flashlight. Your project looks so great, I might have to do something similar ;-).


----------



## PeterFH (Apr 7, 2017)

rayman said:


> I already did some projects with Arduino but not combined with a flashlight.



This is by no means my first project with a microcontroller, i started playing with them long ago, before they had invented the Arduino brand.
But after i discovered the Arduino IDE i started doing more with them, the available librarys make things so much simpler.
Not having to go through the datasheet and looking up in what register you have to set this and that bit just to get something done, i will gladly deal with the simplified and somewhat stupefied Arduio IDE over that.

If i were better at programing and had to start over i would not use them for this project, a low power Texas Instruments µC would be way better suited to this task.
But what do they say? 
If your only tool is a hammer, every problem looks like a nail!


----------



## Offgridled (Apr 7, 2017)

Very nice mod. Love watching people create amazing lights..[emoji106]


----------



## rayman (Apr 8, 2017)

@PeterFH

So what language did you use before you came to the Arduino IDE?

All I did was use three step-down-converter with a PT4115 on it and hook that up with an Arduino over PWM and a RGB emitter and now I can drive it at any color I want.


----------



## PeterFH (Apr 9, 2017)

Offgridled said:


> Very nice mod. Love watching people create amazing lights..[emoji106]



Thank you!



rayman said:


> @PeterFH
> So what language did you use before you came to the Arduino IDE?



The language is the same, almost.
I used AVRStudio from Atmel, i think it is called AtmelStudio now, that used C.
The ArduinoIDE uses something that looks like C/C++ but that is not the important difference.

With AtmelStudio you have to write to the registers and the Arduino IDE provides pre-made functions which makes things so much simpler, you can do the same with C but you will have to write these functions for yourself first.
For example, i want to read the voltage on analog pin 0.

C in AtmelStudio:


> void ADC_Init(void)
> {
> ADMUX = (1<<REFS0);
> ADCSRA = (1<<ADPS1) | (1<<ADPS0);
> ...



And now the same in the ArduinoIDE



> int val = 0;
> 
> void setup()
> {
> ...



All that brings overhead with it but you can clearly see why one is way less of a pain in the arse for someone who hates to write code or just wants to get started. 
If you need to do it like the first example in the ArduinoIDE you still can do that, nothing stops you from that. 
But you do not have to.


----------



## rayman (Apr 12, 2017)

It definitely is shorter and easier with the Arduino IDE but I think I will look into C. Already downloaded AmtelStudio now I just have to start sometime ;-).


----------



## PeterFH (Apr 12, 2017)

rayman said:


> It definitely is shorter and easier with the Arduino IDE but I think I will look into C. Already downloaded AmtelStudio now I just have to start sometime ;-).



Do yourself a favor any buy a AVRISP MK2 of Ebay, they cost around 25 Euros at the moment. 
They can measure the target voltage and you do not have to worry about level shifting when working with battery powered devices.

They AVRISP can not program the new stuff but the ATMEL-ICE is much more expensive and i do not think you will want to put one of the new fancy 32 Bit µC in your flashlight


----------



## rayman (Apr 13, 2017)

Thanks for the advice ;-), I will surely look into that. So what are your next steps with this project?


----------



## campingnut (Apr 13, 2017)

Very nice.


----------



## PeterFH (Apr 13, 2017)

rayman said:


> So what are your next steps with this project?



Good question, i still got this running as a "Just for me, just for fun"-thing, but a few people seemed to be interested in this thing.
So my road map looks roughly like this: 



Finalize the new driver PCB and route the metal core PCB (got 90% done with that today)
Create a complete BOM with prices, part sources and part numbers. (Ever so lightly started with that)
Order the PCBs and a few parts i am missing.
Re-design the body and button mechanics.
Assemble the new boards.
Print new body.
Thoroughly stress test the electronics, characterise and (try to) break them.
Thoroughly stress test the plastic parts and (try to) break them.

From there... maybe a small run of boards, see if someone wants a test unit, ship a few to some testers for the cost of material. 
That will have to be seen.
I thought about creating a poll or something if someone is interested before building a few since i got to put down a bit of money to get this done but i think ill just take the risk and then see if someone wants some.



campingnut said:


> Very nice.



Thank you!


----------



## magellan (Apr 14, 2017)

Very cool light. Good luck with the rest of your project!


----------



## Str8stroke (Apr 14, 2017)

Neat project and good documentation & read. Took me a while to find it, but you didn't forget Heat Management. Good Job, thank you for sharing.


----------



## rayman (Apr 14, 2017)

Sounds great ;-), Im really interested in how this project will proceed.


----------



## PeterFH (Apr 14, 2017)

rayman said:


> Sounds great ;-), Im really interested in how this project will proceed.



I will try to remember to post updates here! 



Str8stroke said:


> Neat project and good documentation & read. Took me a while to find it, but you didn't forget Heat Management.



Thanks! 
The part about the heat management i think i will have to write a bit more about, most of the stuff i did not document or just went over in brain-CAD, so there is not much documentation on how i settled on this solution. 
Some were really fiddly all tough i do have to admit, my favorite heatsink design was pretty damn nifty and good looking but would have been a pain in the arse to put together.
There had been so many different ideas, even tried thermal simulations but could not get the program to cooperate. 

Even how it is now, that is not the final design, one thing that helps are the high efficiency LEDs, way more lumen per watt of heat.



magellan said:


> Very cool light. Good luck with the rest of your project!



Thanks!


----------



## PeterFH (Apr 18, 2017)

For the past days i have been doing some math and i have come up with some numbers, but before i say anything about them...

Who would want to buy a Driver + Metal Core PCB + Nichia LED?

It would be 90% assembled, you would have to solder in the switches and the battery/LED/sensor wires. 
A set of 3D printed parts may be possible as well but the Bulk of the cost is made up by the electronics. 
The battery you have to get yourself, thanks to laws and regulations i can not ship lithium batteries.


----------



## choppers (Apr 19, 2017)

very cool!


----------



## PeterFH (Apr 20, 2017)

choppers said:


> very cool!



Thank you!


----------



## alpg88 (Jan 30, 2018)

good looking light, i got 3d printer for new year, been playing with it, and i like what it can do, i have no doubt good light can be build using 3d printer, what software did you use to make the body? i'm playing with mashmixer, but i have little free time for that, so far very little progress.


----------



## chillinn (Jan 30, 2018)

https://www.youtube.com/watch?v=WDnoczxzQyg

What you made, and that you made it, and how it was made, all so very cool, PeterFH. Don't stop innovating.

3D printing is good stuff, and no doubt will become more and more popular. But what I hope to someday aquire, after becoming proficient with CAD software, and what turns me on, is the opera of a CNC lathe:
(turn down your volume
https://www.youtube.com/watch?v=zBU9U2bcA5c


----------



## Uriah (Feb 4, 2018)

I really like your light and would definitely be interested in one if you get it going.


----------



## HarryN (Feb 11, 2018)

Pretty neat.

A few years ago I built a somewhat similar shape light (as in side x side). It was a simple 3 setting light - no software.

The body was machined from Al as that was the only option at that time. Depending on how many you build, Al might still be worth considering for a larger run. Obviously you already have very good 3D CAD drawings for it, so getting bids is not difficult. It also make heat dissipation easier if that is ever a challenge.


----------



## orionlightlight (Apr 30, 2018)

This is sweet! I might be a bit green but how did you manage to make a fully custom circuit?


----------

