Polish project: Extended version of Nanjg 105C driver based on Attiny25V

OMG :tired: JackCY if you are not able to understand/imagine how this driver works it doesn’t mean it has to be failure. It works just fine and everything is described in detalis - first post. And I tell you the truth : this mechanism saves EEPROM writes comparing to typical NANJG driver :slight_smile: . I see You don’t know to much about Li-Ion cell parameters. Have You heard about internal resistance of Li-Ion cell? It is an aging, destructive process of Li-Ion cell life cycle. Now, genius answer me: which way of voltage measurement (under load or in resting condiction?) is better to verify internal resistance (wear level) of a battery cell?

Internal resistance is measured under load, surprise I can measure it too.

OMG you, who said it is a failure?
Too many questions for you I guess, not enough praise.

Saves EEPROM, I guess the same way other drivers do. Just maybe not the stock ones but since those are locked and we can’t copy them and investigate them we can’t tell anyway.

Both readings of a battery can be useful.

There will be added one more function: RESET to factory settings (modes to: 0,15; 10; 32; 100 and temperature for a safety threshold to 60*C). Inovoked by 8-click.Just in case if user’s Deregulated settings (and have a trouble to correct set by itself). In few days I will provide pricing.

Bocian, will this driver be available to purchase?

Yes, it will be. Soon.

I think it is a wonderful driver, If they are not too expensive, I'm in for a few when available :-)

There will be also available another, cheaper version of programmable driver based on Attiny13A (everyting like in this project except temperature monitoring and battery cell voltage measurement).


I'm mostly interested in swapping out an Attiny13a for the Attiny25v. Same package size but with 2k memory vs 1k and a temp sensor?

Yes. :)


PS. Hi DrJones, nice to see You. You are doing a great job here with Attiny13 :slight_smile:

Uhhh...so why are they not making the 105C's w/ the 25v from the start? Just cost?

EDIT: Or just jump to the 85v?

They don’t need it for the simpler programs and cost is different.
Place an order to the factory and they might make it. It’s all about what shops want to sell and buy or order from the factories/distributors.

For DIY most people go with Attiny85 in this package.

Here is the SALES THREAD

Hi Bocian,

thanks :) I spent a lot of hours optimizing code to get all the functionality into the 1kB of ATtiny13. I occasionally used ATtiny25 and 85, also experimented with off-time memory (using a cap and a 100k discharge resistor; yours is the simplest off-time memory setup I've seen; nice idea to use the internal resistance. I'll have to investigate further), but my premises were not to mod the hardware.

I really wish they had used ATtiny25 or better.

However recently I begun to design my own boards, clearly not using the ATtiny13 :) After so many hours of writing compact code, I feel sort of guilty when writing 'expensive' (in terms of program space) lines of code, even though the 85 has plenty of space. :)

How do you make the 0.2% and 0.015%? Just by PWM levels or something more tricky? I found that the real brightness at the lowest PWM levels strongly depends on hardware variations. With some luck I get a nice very low low, the same value in another driver/LED combo (same models) may be much brighter - or won't even light up.

DrJones sorry for a mess, but I’ve answered Your question in sales thread 0:)

Maybe if Your custom project is not very advanced yet You should think about using current regulation based on operational amplifiers instead of common AMC7135. That gives You lower drop Voltage for a constant current regulation and possibility to mix digital control PWM and analog output (no flickering and using LED advantages in lm/W when low powered). Currently I’m developing Headlamp XP-G2 S2 mod using such solution and it works wonderful (those efficiencys when powered 0,2-20mA and more)l 8)

Ok, about the cap on the input pin. I was reading this thread, https://budgetlightforum.com/t/-/17286#comment-400487, which outlines what DrJones was referring to with a discharge resistor. Does an I/O pin have a specified state when power is disconnected from the MCU? According to the diagram in the datasheet (what PilotPTK referenced), although not a complete diagram of the circuit, it looks like the cap would discharge immediately when the device is powered off. I tried measuring the resistance of the pins, but different pins came up with different numbers and the resistance changed over the time that my DMM was connected.

It's great that adding a simple SMD cap can give us "off-time" mode switching, I just don't see how it will work besides just trial and error (add a cap and see how long it takes to discharge). It would be nice to know what state the pin is in, and what the resistance is, when the battery is disconnected.

Bocian: I'll reply here though :)

Interesting; I didn't know the ATtiny25 can handle the lowest modes more reliably. I'll try that. And yes, one of my next drivers will have 2 channels, one with only 1*7135, the other with the remaining ones. I'll also try an AMC7136 based driver for a change.

I thought about an OpAmp linear driver, too, PWM filtered with an RC low-pass (maybe second order), but I'm not enough of an electronics engineer to know how to choose a suitable OpAmp for those small voltages down to some µV for the low modes. There's quite a gap between understanding the principles and really building a working circuit (depending on the complexity of course).

JonnyC: I tried measuring the resistance of star4 to GND; depending on the multimeter used I get ~5 MOhm or 30 MOhm - they measure at different voltages. I'll probably try an oscilloscope soon.

It is in off state and the resistance is dynamic, not the same value at different voltages. I asked before, Bocian did not like the questions.

Yes a capacitor is enough if you have a big enough capacitor and big enough resistance in the MCU when it is off so the capacitor does not discharge too fast. The specs don’t say these values like resistance of different pins in an off state.

The way it is implemented in BLF-VLD thread is by adding a resistor and using a smaller capacitor, to charge the capacitor fast there is a diode to bypass the resistor. All you need really is a capacitor if you can find big enough one for your MCUs resistance.

Johhny, 1st page, I got: 66kOhm on 3 samples of Nanjg105C with ATtiny13A, on all pins, 200k range on DMM, minus on ground. If I put minus on pin the resistance was 27kOhm. Resistance was higher when I used 20MOhm on the DMM, maybe 1.3MOhm, I did not note it down. It is really a bit of a trial and error unless you can make a graph of resistance vs voltage.

From Bocian’s values of capacitors I calculated/guessed a resistance of about 1MOhm for the capacitors to have some reasonable voltage left after 0.5-1s. Although beware he uses 25V not 13A, may not be that comparable.

JackCY - Sorry, I totally passed over your exchange with Bocian and then asked basically the same question, ha . I looked through the datasheet and searched the AVR forums and couldn't find any info on the state of pins when the device is powered down. So it really does just seem like a crap shoot on picking a capacitor that would work.