Attiny25/45/85 FW Development Thread

That’s right. But I wouldn’t remove C1 from your layout since it will be required probably in some setups. C1 might give some problems since it increases the time until the mcu detects power off state. More tests required.

I didn’t build a voltage divider in my test setup, so yes, I used a dedicated pin for power down recognition.

If it is possible to use a level change interrupt for power down recognition it might be possible to combine it with the voltage divider. If not, and if a power down event falls into a ADC measurement, it might take too much time until the firmware can detect this and is able to power down the outputs and ADC. Fast reaction is crucial. It has to be tested if a level change interrupt is fired during ADC measurement on the same pin (probably yes) AND if we can use the watchdog interrupt and power down state within the level change interrupt function. I tried this way first but the watchdog didn’t wake up the mcu within the level change interrupt function - but it was only a quick hack and could easily be wrong programming on my side.

I regret I won’t have much time for further tests next days.

I'm having trouble seeing how the lighted tailcap can be compatible as is. We need voltage shutdown. The lighted tailcap needs it not shutdown.

The lighted tailcap takes the power from before the MCU path, it should not have any effect on the MCU power usage as the diode will block off all reverse current.

The tailcap would cause issues with OTC timing though (the theory was that it was pulling power through the MCU/OTC to power the LED’s). So without an OTC it should not have timing issues anymore.

Never used the lighted tailcap. Is there a circuit diagram?

I am not aware of one per se. Although if you look at the diagram I posted earlier the BR (bleeder resister) is what sends power to the tailcap.

Very simply really, it simply allows some leakage current to flow back through the body to the tailcap when the switch is off. This then powers the positive side of the tailcap which has another resistor bypassing the switch to ground to give you the power you need to light up the LED’s.

Yeah I’m more of a hack than an engineer, I can’t understand diagrams very well so I don’t make them myself.

In the tailcap there is simply a resistor (or pot) and an LED in series, both parallel to the main power switch. So when the clicky switch is ‘off’, a small amount of power flows through the tail LED.

On the driver there is a “bleeder resistor” that bleeds power form Batt+ to the battery tube, completely bypassing the driver. With the right value bleeder, I’m sure the MCU sees some voltage but not enough to boot up or keep an OTC charged.

It’s all very experienced based as far as how it works, I’m not sure what other things influence the operation.

edit: This is the closest I have made to a diagram. I used the “ground” symbol to refer to the flashlight body. It also doesn’t show any bleeder. You get the idea. This is from the original discussion thread Feb ’15

Even 6,3V for a cap is a very, very low voltage rating for these drivers…

@pilotdog68:
Thanks! What are the common resistor values?

It depends on the Vf of the LEDs chosen, how many are used, how bright the user wants them, etc.

For the bleeder, I normally use 1kohm, others use more like 560ohm, The highest I have seen work while maintaining normal driver operation is ~2kohm.

For the LED resistor, I don’t know for sure because I use a potentiometer usually, but I would suspect between 50-100kohm (I use 100kohm pots)

Why do you say that? C2 is behind the diode and R5 decoupling resistor in the latest designs. 6.3V gives a quite a bit of margin for error (it should never seen more then ~3.9V in theory). Or am I missing something?

Even for 2S operation the zener is before C2 and as such would keep voltage from going over 4.3V.

I thought I read somewhere that you should use caps with at least double the rated voltage that the voltage you’d expect them to see.

A good rule to follow if you have plenty of space for the larger caps but the rating is there for a reason, cap will be fine up until that voltage. A safety margin is good, we should have about a 2.5v safty window from what we expect them to see in our case which is a 50% safety margin. More then enough IMO.

4V caps are pushing it for sure, although they would technically work they would have no margin for error.

Now AC caps play by different rules and with those I think you do need caps with twice the voltage rating to account for 2 or 3 phases of power.

Aight, thanks for the explanation. I still have to learn a lot about all this stuff. From now on, I think I’ll shut up for some time and let the experts do the talking. :slight_smile: Will follow with interest though.

Everyone has to learn somewhere.

When trying to cram things into as small of a space as possible some of the “ideal rules of thumb” have to be put aside in the interest of space. Particularly when cheap is an important factor as well.

Integrated the lighted tailcap parts in my OTC-less design: 1k bleeder and a 2.2k resistor in series with LED (low resistance since I only have outdated 5mm LEDs which need more current).
With the bleeder I was able to remove the 10k resistor (which sat at the same place).

Works flawless.

You may even try it with just the 10k you had and no additional bleeder. The bleeder was necessary to allow the OTC to drain. With no OTC, it might not be needed.

Tried it right now - doesn’t work with 10k and the chosen tailcap parts. Might be different when using larger series resistor and up-to-date-LED.

shows how much I know :zipper_mouth_face:

Actually ceramic caps get derated for DC voltage. The spec sheets all publish a curve for derating V vs applied dc voltage. But I don't think tantalum caps have that issue. They do get some thermal derating eventually as I described. They also like to explode when they aren't happy, but where's the fun without a litttle danger. Yeah, 6.3V probably isn't an ideal design margin, but it likely works. I'm still a bit confused on the tailcap. Will have to think about it later.

I missed that. may need some tuning/thought to keep battery monitoring (non-otc type) and and tailcap working. I guess the tailcap light Vf is creating voltage drop. Maybe have to tune things right, maybe much lower divider resitors for a lighted tailcap build.