Custom dual switch driver finally seeing some light.

10 posts / 0 new
Last post
Mike C
Mike C's picture
Offline
Last seen: 6 hours 54 min ago
Joined: 01/22/2014 - 08:03
Posts: 2377
Location: Sweden
Custom dual switch driver finally seeing some light.

My G-20 (generic 20mm) driver with the ATtiny85 and dual switch support is getting close to completion, so it is finally time to stick it into a light. The host (light with defect driver) was kindly given to me after I posted I was looking for dual switch hosts. As it was given to me I am using it for my #1000 post giveaway light (easy come, easy go) when I’ve tested the driver and firmware enough. CheapThrills won the draw, so this is what he won…

Here is the driver. It’s not the final version though, because when building this one I found a few small things I wanted to change. I haven’t ordered the new version yet as I’m still evaluating if I want to make more changes, but so far so good. I had made a 23 mm version of the driver simply by increasing the diameter of the ground ring, which I called G-23. It’s a bit messy as I’ve used it for testing a few things with the design.

23mm was just a little too small for this light so the driver was a little loose inside when when the battery tube was screwed on so I put in a washer, and then i filed down another thinner washer until it was only a little too big so it would bend in place and keep the driver in place when the tube is off. Screwing on the tube tight flattened it. Not very pretty but it works. It’s a bit of a bummer getting it out again, but that’s why I designed this driver with the MCU instead of a spring on the battery side. The copper wires cross over the MCU without touching it, and it doesn’t bend without a fair amount of pressure. Now I can update the firmware without ripping the whole thing apart.

The LED I put in is a new unused XM-L2 U3 1A from RMM / Mountain Electronics. I’m personally more fond of warmer tints so that’s why this one is in the giveaway Big Smile

I isolated the end of the reflector with kepton tape and screwed on the head. Centering the LED wasn’t easy, so I gave up after a few tries. This was the best I got. As this light is a development light I’m not too picky about it… and besides, I’m going to give it away anyway, CheapThrills can mess with it if he wants to Big Smile

The original E-switch on this light was fastened to the driver, side mounted and sticking out the side with a deep plastic button to reach it. That’s not how I want to build dual switch lights so I used a little PCB I’d designed for this purpose. It was bare copper in the four corners to make soldering on the switch easy, and vias underneath for easy soldering of the wires. The PCB is a little too small for this light, so I will glue it in once the development is completed. I’ll also have to stick on a rubber switch cap as the original plastic switch is unusable now.

So the light is up and running. It’s a pretty good thrower, at least for a someone who isn’t a throwaholic. I’ve just got to finalize testing and fix up a few things, and it will be ready to go.

Details of the driver:
16 × 350mA AMC7135s on 5 separate channels (1,2,4,8 and a dedicated 7135 for PWM). By doing it like this I have 16 constant current steps from 0.35A up to 5.6A, and a dedicated 7135 for PWM for levels between the 0.35A steps.
That only leaves one pin left… I’ve put the E-switch, off time cap and voltage monitoring on the same pin. This was initially an experiment but after extensive testing in a few driver designs I’ve found it very reliable, but it requires a whole different approach to the firmware.

Firmware details:

  • Four different UIs I like for different situations (normal use, climbing, caving, photography etc etc).
    UI1: “Traditional” UI. Four modes including boost. Mode change by either E-switch or off switch, short for mode up, long for mode down.
    UI2: Three modes controlled by off switch. E-switch engages boost. Hold E-switch for longer than 2 seconds and boost “sticks” until timeout.
    UI3: Single “ramp” mode. E-switch engages boost like UI2. Short off press enables adjusting ramp mode. Increase by pressing E-switch and hold, decrease by double press and hold. After timeout (notified by blink), E-switch goes back to engaging boost.
    UI4: As UI3, but no boost. E-switch adjusts ramp mode output.
    The adjusting ramp mode in UI3 and 4 goes through the entire range of moonlight up to full blast with 0.35 constant current steps and an algorithm for PWM between, giving the effect of seamless output increasing/decreasing.

Functions induced by holding E-switch on startup and releasing on blink count:

  • Safety lock.
  • Readout: Added presses to select what to read out: Pre-defined 5 stage voltage levels, real voltage level, and temperature readout.
  • UI selection and also UI1/2 mode programming. All modes can be reprogrammed using same method as ramp adjusting in UI3 and 4.
  • UI1 and 2 mode memory selection: Include boost, exclude boost, or no mode memory.
  • Set number of modes for UI1 and 2. Max 4 including boost. Usually use more? Then UI3 or 4 is for you!
  • Set boost timeout, 15 second steps each E-switch press, or long press to disable.
  • Set temperature limit for overheat protection. Let it burn as hot as you want (temp constantly saved), then turn off (thanks ToyKeeper).
  • Set voltage levels for low voltage step down and critical shutdown/emergency mode.
  • Enable/disable voltage monitoring.
  • Enable/disable temperature monitoring and overheat protection.
  • Critical volt/temp action: Shut down or limited to very low output (emergency lighting).
  • Voltage calibration. Insert a cell and “tell” the MCU what the voltage is. One time thing, once set it shouldn’t need to be changed.
  • Reset everything back to default.

That’s what I’ve done so far. And now I’ve put it in a real light so I can start testing everything properly. I’ve spent 7808 bytes, so not much room for more functionality left. Might do a hidden blinky of some sort, don’t know yet, but first I need to extensively test for bugs so there is a little wiggle room to fix them… and then it’s off to CheapThrills!

Edited by: Mike C on 11/13/2015 - 09:38
Dallas
Offline
Last seen: 2 years 7 months ago
Joined: 11/11/2015 - 22:12
Posts: 116
Location: TX

The holy grail of ui’s.
Very impressive work! Beer

pilotdog68
pilotdog68's picture
Offline
Last seen: 3 weeks 2 days ago
Joined: 05/30/2013 - 23:31
Posts: 6420
Location: Held against my will in IOWA, USA

ridiculous, as always Mike

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

MRsDNF
MRsDNF's picture
Online
Last seen: 11 min 9 sec ago
Joined: 12/22/2011 - 21:18
Posts: 13058
Location: A light beam away from the missus in the land of Aus.

I love it and your skill. Well done. I assume this is strictly a single cell driver?

 

djozz quotes, "it came with chinese lettering that is chinese to me".

                      "My man mousehole needs one too"

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

Mike C
Mike C's picture
Offline
Last seen: 6 hours 54 min ago
Joined: 01/22/2014 - 08:03
Posts: 2377
Location: Sweden

Thanks for the comments. The image hosting site I used for the photos seems to have crapped out, so I’ve uploaded the photos to a different hosting site and edited the post.

MRsDNF wrote:
I assume this is strictly a single cell driver?

There is a dedicated zener footprint on it so it can easily be built for two cell lights but I have not done one yet. This is the first of my G-20 designs to make it this far. Because the voltage divider is on the same pin as the off time cap I’ve had to use resistors with much higher values (1300K and 300K), but other than that there is no difference so I’m quite sure it will be fine. I’ll be making one sooner or later.
MRsDNF
MRsDNF's picture
Online
Last seen: 11 min 9 sec ago
Joined: 12/22/2011 - 21:18
Posts: 13058
Location: A light beam away from the missus in the land of Aus.

Smile Thanks.

 

djozz quotes, "it came with chinese lettering that is chinese to me".

                      "My man mousehole needs one too"

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

djozz
djozz's picture
Online
Last seen: 0 sec ago
Joined: 09/07/2012 - 17:04
Posts: 16142
Location: Amsterdam

Very nice driver, with an impressive UI, even suitable for a simple UI-fan (UI1 for me!Laughing).

CheapThrills
CheapThrills's picture
Offline
Last seen: 20 hours 45 min ago
Joined: 07/02/2011 - 10:45
Posts: 3567
Location: Suomi

Wow! May take a while to handle that fully but does not seem to be overly complicated 8)

Mike C
Mike C's picture
Offline
Last seen: 6 hours 54 min ago
Joined: 01/22/2014 - 08:03
Posts: 2377
Location: Sweden

djozz wrote:

Very nice driver, with an impressive UI, even suitable for a simple UI-fan (UI1 for me!Laughing).


Yeah, that first mode is so that I can just flash a standard off time switch light without E-switch and have it work with everything pre-definded, just like any other firmware.

CheapThrills wrote:
Wow! May take a while to handle that fully but does not seem to be overly complicated 8)

No, it’s pretty straight forward. The problem is remembering how many blinks and presses do what. I sure don’t remember them all so I need a list when testing Smile
eebowler
eebowler's picture
Offline
Last seen: 5 days 19 hours ago
Joined: 08/13/2012 - 11:34
Posts: 1822
Location: Trinidad and Tobago GMT -4

I’d like UI3 with the blink when critical voltage is reached option. Thank! Smile

My gratitude to those who are willing and able to help others (in whatever way you can)! Being human is more than just existing for yourself. Smile