Standard Nanjg driver in dual-switch lights

Well, I am a software developer and worked on embedded systems, micros, DSP's, etc., but never worked on anything this small in a high level language. So I have modified luxdrv (and understand it mostly) with my own custom set of modes frequently, but doing something as complex as Dr Jones has, I haven't spent the time for that, and am probably a whole lot weaker when it comes to the hardware interface and control -- I've always had the fortune to work with EE's to tell me, show me how to program the interfaces, or adapted in their low level interface routines. I got Werner's BETA too, but once again, if he is not willing to release his source code, I'm still stuck unless Werner builds exactly what I would like for each light and/or application.

Unfortunately I don't see any released source code for supporting an e-switch now or in the near future, unless Werner is planning on doing that when it's all done and tested.

I wrote some code probably over a year ago now that I put in use in a Ultrafire T50 (no tailcap switch, just an e-switch). It's just a basic 3 mode setup and functions like a normal light would with off-time memory. Has a press-and-hold to ramp though. It's probably some really ugly code, but it worked.

I completed some new polished code that I was going to use in an SRK with ramping, but ran out of room before I could put in the low battery logic. Then I saw all of the crap that DrJones was able to fit into his secondary switch program and I gave up I'll get back to it one of these days.

Wow - the XP-11 is a total $12 clone of the $38 T50, didn't realize that til now... Cloned at least in looks - sure the internals of the T50 is far superior. I got a Dr Jones lumodrv in my XP-11 - love the light now, lots of power at 3.5A and an AR lens.

I'd be interested in the source code though, if you are willing? Sounds a lot like lumodrv. My lumodrv is somewhat busted - it's not the real lumodrv version, something else, double and triple clicks don't work the way they should -- I'm confused with what it can and cannot do. If I understood him, think the Doc sent me the wrong version.

The way I use it is as a 2 mode light, the way it came stock. But if I want very low moonlight, I use the ON-hold feature to ramp then have to quickly release the button - if I'm lucky, I get the lowest moonlight setting. Not the way I want it, but still very useful.

Wow, the XP-11 is a clone of a clone. And yeah, that's cheap!

I'll take a look at my code tonight and see what the heck it does, and see if it's worth passing on.

Is this the light your talking about as there is nil stock. Any other stockists? Thanks.

I use this other metod for the side switch

XP-11 here for $12: wallbuys.com XP-11, real (thinking) T50 here: cnqualitygoods.com UF-T50, manu site listing: ultrafire.net UF-T50. This is the same thing for a Small Sun T-08 and the real UltraFire UF-T60 (T60 is 3X the cost, has a real classy interior design - much better pill and quality battery carrier, while the T-08 has a cheesy loose fitting pill, open flat contact ring for the batteries). The XP-11 though is real nice solid light, but suffers from a slightly hard to press button, terrible UI, and not so ideal brass pill - thin, it kind of suspends in air but with a threaded reflector, accept for a tight fit near the base where the driver is. Simple mods is to upgrade to a copper star, and use some thermal grease on that pill end that slides in tight to the body, and thermal grease on the reflector threads. I think it can handle 3.5A ok with these mods and gets the heat out to the body enough. Wrapping would be a PIA with the switch and switch wiring in the way.

moviles2 - wow, looks excellent! I don't really understand it much, but I assume you did the mods that's defined in that circuit, but seems like that's for a MT-G2, and not conventional 4v LED's? 2 cells 8.4v input with the zener diode mod. Not sure I understand the reason/role of the temperature monitoring and knockdown circuit... Actually, there's a lot I don't understand here...

I put the same code in a UF T20 (the T50's little brother). Both of those lights are a pain to work with because there's very little room.

Here's my post about it. Wow, crazy how time flies. https://budgetlightforum.com/t/-/12119#comment-271430

Awesome…absolute brilliance!

Simply wiring a momentary on pins 1 and 4, with the tail clicky for on/off and using STAR_mom can make any of the ATtiny based drivers a side button type light…INCREDIBLE!

That’s brilliant comfy!

I haven’t been around much so I must have missed it. How are do you make a 105c handle eight volts?

I think he put a zener on the input VCC pin to reduce the input voltage into the ATtiny without smoking it

You can see where he placed it on his new 20mm OSHPark driver

No, this is for drivers still using standard clicky switch firmware. The reset just tricks the MCU into thinking the power was interrupted with the tail clicky, and it changes modes (light turns off while the reset button is pressed, and turns back on when it's released). It will still change modes if you use either the momentary button on the reset pin or with the tail switch.

Would STAR_momentary and an always on tail cap give the ability to turn off the driver with the 0 in the modes (only if you use the phase corrected PWM (TCCR0A = 0x21)?

(pretty much make it a mini SRK wouldn’t it)
Oh no…would have to solder ground to pin3 rather than reset…duh
#define SWITCH_PIN PB3 // what pin the switch is connected to, which is Star 4

Never mind…your method is more or less a brute force method to add an “extra” mode change ability with a momentary push button…method mentioned above would change the design to something completely different

brute force seems to work :smiley:

Can anyone please kindly show a photo of how the actual Nanjg 105C driver should be wired (how to wire the RESET pin and GND) in order to work with a light with both side switch and tail switch? Apparently comfychair has attached a photo in the OP but the file host doesn’t seem to work correctly now.

Anyway it is indeed a very brilliant idea from comfychair. :slight_smile:

Reset is pin 1, gnd is pin 4, the gnd ring, or any 7135 middle pin. Use a momentary switch (normally open) and tie one side of the switch to reset pin and the other to gnd. Switch doesn’t care about polarity.

So a e-switch only has two wires (one wire for each side) normally? Are there any additional wires that a e-switch needs to connect to the Nanjg 105C driver to make it work?

I don’t have anymore light with electronic side switch now and see the thing for real. I used to have a Courui big head thrower but I have sold it to someone else quite some times ago.

No, all it does is momentarily connect reset to gnd so no other connections needed. You still need a power switch or lock out to turn the light off.

Thank you, I think I have an idea now. :slight_smile: