HDS Systems        
Results 1 to 21 of 21

Thread: Nitecore D10 software

  1. #1

    Default Nitecore D10 software

    Anyone re-programmed the D10 (or EX10) to fix the software bugs?
    I think I have worked out all the connections to the uC, only trouble is without a datasheet for the smps controller I'm not sure why pin 5 is connected, my guess is it's an open-drain output from the smps IC (power good?), but it never seems to change to a digital level, and is quite noisy.
    This also ties up one of the ISP pins so I am going to have to lift the leg to get the uC to flash and need to know if it should go back. Or just swap it for a new one, but access isn't ideal.

    I have re-written the firmware (from scratch, in C) to make it easier to use and more predictable but am a bit stuck unless I know what this last input is for.

    New firmware
    • off - on [release] quick low, as before
    • off - on [hold] quick high, as before
    At this point your default setting is not changed, if turned off [wait] on it will still come back on stored level.
    • About half a second to enter ramping mode
    • Ramping at any point changes stored value, ramping is always up from turn-on, unless the torch is on max. If you shortcut to min or max and ramp that changes the stored brightness too.
    Timing needs a bit of work to make it feel the same as the D10, I think my delays are a bit shorter.

    Looking at the board it has provision for a battery voltage input so could have a low battery warning, although I run mine on NiMH so have not written this at the moment.

    Currently the output only has about 20 levels, although more could be added, what sort of ramping curves are people using? Linear looks rubbish! Theoretically I could calculate the exact PWM duties the D10 is currently using, but I'm not sure its worth the effort.

  2. #2
    Flashaholic* half-watt's Avatar
    Join Date
    Jul 2007
    Location
    Southern Connecticut
    Posts
    1,095

    Default Re: Nitecore D10 software

    haven't done this, but would like to.

    while i've designed microprocessor and microcontroller h/w and written embedded systems s/w for ~30yr for both business related systems and aerospace monitoring/diagnostic/control systems, i am woefully ignorant about the h/w used in "intelligent" lights and the s/w development tools currently being used. however, i have the required technical background and experience to do this work.

    would you mind telling me, please, what h/w and development s/w you use which i would need to obtain to do something similar to what you are doing.

    many thanks, pj aka half-watt

  3. #3
    Flashaholic*
    Join Date
    Dec 2006
    Location
    Ireland
    Posts
    1,142

    Default Re: Nitecore D10 software

    I'm also interested in knowing what microcontroller is being used. If it's a microchip PIC then I can begin messing about myself as I have all the development tools for them.

    If so I may get a second D10 to experiment with.

  4. #4

    Default Re: Nitecore D10 software

    Intelligent control circuits for flash lights are amazingly easy compared to aerospace flight-control systems! Until I started looking at this a few days ago I hadn't worked on torches either!

    The D10 and EX10 use an Atmel ATtiny13V http://www.atmel.com/dyn/products/pr...p?part_id=3175
    I am using an AVR JTAGICE mkII which allows in-circuit debugging using the debugWIRE interface. I'm compiling using IAR Embedded workbench, but you can achieve the same using WinAVR http://winavr.sourceforge.net/.
    If you don't have the cash for a JTAGICE mkII the AVRISP allows simple in circuit programming and is a lot cheaper (but no debug functionality).
    Until I decide what this extra SMPS connection is for I can't program the uC in circuit as it ties up the MISO pin so the programmer can't connect.
    Consequently I have built a prototype version of the D10 without the SMPS to allow me to work on the code until I work it out.

    Note that there is no reason why this couldn't be written in assembler, in fact 4sevens said that the stock code in the D10/EX10 is in assembler. Personally I try to avoid assembler where-ever possible! Especially as there is nearly always a good C compiler option available.

    I'm not 100% sure about the circuit design, originally I expected it to be a CC boost converter, but after going over the PCB it looks like it either does CC / CV or its just CV with a very small series resistor.
    As others had previously mentioned its high frequency PWM to give multi-level, it uses the 8-bit capture/compare/pwm module on the uC, [presumably] clocked from the 9.6Mhz internal osc and switched through what appears to be an N-channel FET.

    Because of the design the SMPS is always running as it powers the uC as well as driving the LED, hence the 200uA quiescent current, the micro is probably drawing something in the region of 5uA when asleep.
    Theoretically you could change the design of the EX10 (because of the higher cell voltage) to make it more efficient when asleep by running the uC direct from the battery when asleep, but I don't have the time to do this, or an EX10!

    The piston-switch just grounds an I/O pin on the uC, so a weak pullup is probably used. As with any switched software design you need to de-bounce your inputs!

    If you are interested in playing around with designs like this I'd recommend starting off by building a prototype (or buying an Atmel STK board, they do one for most budgets), rather than buying another D10 / EX10, as you really only want the psu and uC, you don't need the expensive body of the torch and the money would be better spent on a programmer.

  5. #5
    Flashaholic* half-watt's Avatar
    Join Date
    Jul 2007
    Location
    Southern Connecticut
    Posts
    1,095

    Default Re: Nitecore D10 software

    dev, many thanks for the swift reply. good info. just what i need to keep me occupied in my upcoming retirement days.

  6. #6
    Flashaholic Tohuwabohu's Avatar
    Join Date
    May 2008
    Location
    Germany
    Posts
    184

    Default Re: Nitecore D10 software

    Quote Originally Posted by dev View Post
    Currently the output only has about 20 levels, although more could be added, what sort of ramping curves are people using? Linear looks rubbish! Theoretically I could calculate the exact PWM duties the D10 is currently using, but I'm not sure its worth the effort.
    This is what NiteCore uses in the EX10:

    off - on max - ramp down to low - off - on low - ramp up to max - off


    ramp down


    ramp up

    JetBeam I.B.S. uses linear ramping from min to max with flashing and intervals of constant brightness at 5%, 50% and 100%: http://www.messerforum.net/showpost....&postcount=189

  7. #7

    Default Re: Nitecore D10 software

    Right, after many months of this project sitting on my todo list I finally got around to re-flashing the D10...
    Unfortunately Nitecore has cleared the reset fuse so you can't re-flash the uC. Consequently I flashed a new uC and replaced the one on the PCB with it.

    Happy to report it works fine, thanks to Tohuwabohu's pictures I have implemented a slightly exponential 50 stage ramp, which to be honest is a bit un-necessary when you compare it to lots of other lights that have 1-5 levels. My ramp speed is slightly slower that Nitecore, but I'd argue you use the ramp function less with mine.

    I have ported the software to avr-gcc for easy maintenance and will eventually put it on Google Code so others can benefit from it, once I have tidied it up.

    For the time being if anyone wants the .hex output I am happy to post it.

  8. #8
    Flashaholic* bluecrow76's Avatar
    Join Date
    Jul 2006
    Location
    Tiger Town
    Posts
    638

    Default Re: Nitecore D10 software

    Is this strictly for the D10, or will it work with the EX10 as well?

    Good work!
    EDC: Surefire e2l, Novatac P7/d2flex

  9. #9

    Default Re: Nitecore D10 software

    Quote Originally Posted by bluecrow76 View Post
    Is this strictly for the D10, or will it work with the EX10 as well?
    I can't be 100% sure as I don't own an EX10, and have not got the schematics for it, but I suspect it probably would work fine.

    You would need to confirm the piston input (PB2, pin 7) and pwm output (PB1, pin 6) connections are the same to be sure.

  10. #10
    Flashaholic d1dd1's Avatar
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    201

    Default Re: Nitecore D10 software

    Great !
    Did you implement other features ?

  11. #11

    Default Re: Nitecore D10 software

    Quote Originally Posted by d1dd1 View Post
    Great !
    Did you implement other features ?
    No, currently it just works as listed in the first post, which is all I wanted.

    In theory I could probably fit some more functionality in, its currently using about 70% of memory. Trouble is as soon as you add more features it kinda defeats the whole reason I like the D10, it's simple and functional! Most of my other lights have strobe and SOS modes, in the unlikely event I might need that I'd take one of them with me, but for day to day tasks the D10 does all I want.

    However if anyone has a killer idea for the D10 I can think about adding it, I'm a bit short of projects over the holidays...

  12. #12
    Enlightened
    Join Date
    Jan 2006
    Location
    Poland
    Posts
    18

    Default Re: Nitecore D10 software

    Hello ;-)
    I have Nitecore SmartPD with totally new software, made by my friend(Df) from polish torch forum www.swiatelka.pl

    http://www.swiatelka.pl/viewtopic.php?p=15149#15149
    see photos and movie on Youtube

    For better energy saving we must use another pinout topology. Now my torch uses only 100uA if its off and in LOW (13 programmable brigtness levels) power consumption~~ 2mA ;-)

  13. #13
    Flashaholic balou's Avatar
    Join Date
    Dec 2008
    Location
    Switzerland
    Posts
    346

    Default Re: Nitecore D10 software

    Calineczka or dev: do you have any sourcecode available?

    Calineczka: what changes did you make to the circuit?

  14. #14

    Default Re: Nitecore D10 software

    I'll post the source to Google code at the weekend.

  15. #15

    Default Re: Nitecore D10 software

    New Google code project made and some source added, I have another branch I'm working on that adds low battery warning, but its not finished yet.

    http://code.google.com/p/avr-flashlight/

  16. #16
    Flashaholic jag-engr's Avatar
    Join Date
    Apr 2008
    Location
    Arkansas, USA, Earth
    Posts
    286

    Default Re: Nitecore D10 software

    I think I would like to go the other direction with my EX10 and dumb it down. Do you think that you could set up one of the following UI's?

    Super-Simple McGizmo-Style PD UI (based on two levels)

    Circuit Closed, but Switch not depressed: Low Mode (~5 lumens)
    Circuit Closed and Switch depressed: High Mode (~100 lumens)

    Like the original McGizmos, the circuit could be closed by tightening the head until it comes on at low. The switch could be depressed by tightening the head further or by depressing the piston for a momentary high. The light could also be used my depressing the piston part way for momentary low or all the way for momentary high.

    Novatac-/LiteFlux-Style Click UI (based on three levels)

    From off:

    1C: On at MIN (3 lumens)
    2C: Toggle to MED (20 lumens)
    1C+Hold: Jump to MAX (130 lumens)

    Once MED is engaged, another double click (2C) could take you back to MIN and vice versa.

    Once MAX is engaged, a double click (2C) takes you back down to MIN.

    Note: These are what I would consider ideal levels (unless low can go lower). I don't especially like the ability to select from 100 different, these three would be perfect for me.

    PM sent with question about the feasibility of either of these projects.

  17. #17

    Default Re: Nitecore D10 software

    interesting guys......

  18. #18

    Default Re: Nitecore D10 software

    will Crisp AVR USB work instead of the JTAGICE mkII...specs says it works with both win avr and the tiny13..

    looks to be about $67 US shipped after euro conversion..and they take paypal.

    crisp avr usb ->
    http://www.chip45.com/index.pl?page=...wnload&lang=en

  19. #19

    Default Re: Nitecore D10 software

    Quote Originally Posted by dev View Post
    However if anyone has a killer idea for the D10 I can think about adding it, I'm a bit short of projects over the holidays...
    Locator beacon anyone?

  20. #20

    Default Re: Nitecore D10 software

    Quote Originally Posted by MWClint View Post
    will Crisp AVR USB work instead of the JTAGICE mkII...specs says it works with both win avr and the tiny13..

    looks to be about $67 US shipped after euro conversion..and they take paypal.

    crisp avr usb ->
    http://www.chip45.com/index.pl?page=...wnload&lang=en
    From what i can see the Crisp AVR USB is just a programmer, it does not provide debug capabilities, and for the price an AVR-ISP mk2 is cheaper at $34:
    http://search.digikey.com/scripts/Dk...e=ATAVRISP2-ND

  21. #21

    Default Re: Nitecore D10 software

    Quote Originally Posted by dev View Post
    New Google code project made and some source added, I have another branch I'm working on that adds low battery warning, but its not finished yet.

    http://code.google.com/p/avr-flashlight/
    awesome. i'm not sure how many of those, whom I'd had told that my torch is powered by open source operating system, would actually believe me :-D

    keep hacking

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •