[Oshpark] BLF SRK FET v3 (46mm / LFPAK56 / Dual+Triple Channel / ATtiny13A+85)

That’s very helpful, thanks. I’ll look into both.

I’ll change R1/R2 from 33k/8k2 to 330k/82k first, just to see the practical result. In theory it should lower the parasitic drain (@4V) about 0.09mA, pushing it from 0.25mA to 0.16mA. I might try another x10, which would save another 0.009mA, and see if voltage measuring will still work.

Turning off ADC rings a bell. Found it again in post #2 of Toykeepers Firmware repository. She mentions @Crux:
Investigate, measure, and document ultra-low-power sleep modes. Crux’s posts here and here, ideas here (link is external) and here (link is external) and here (link is external)
The firmware I just use has an ADC_off routine, but it’s only called when there is no voltage monitoring. Calling it before starting sleep mode looks easy, but I’ll have to find where to put the ADC_on command to reenable it after a switch press.

But that looks very promising and together might bring the drain down by x100. :slight_smile:

Narsil has the support, so could check there as well, 7/11 version is the latest: Shared project folder on Google Drive

Here's the full function:

/**************************************************************************************
* SleepUntilSwitchPress - only called with the light OFF
* =====================
**************************************************************************************/
void SleepUntilSwitchPress()
{
// This routine takes up a lot of program memory :(

// Turn the WDT off so it doesn't wake us from sleep. Will also ensure interrupts
// are on or we will never wake up.
WDT_off();

ADC_off(); // Save more power -- turn the AtoD OFF

// Need to reset press duration since a button release wasn't recorded
wPressDuration = 0;

// Enable a pin change interrupt to wake us up. However, we have to make sure the switch
// is released otherwise we will wake when the user releases the switch
while (IsPressed()) {
_delay_ms(16);
}
PCINT_on();

//-----------------------------------------
sleep_mode(); // Now go to sleep
//-----------------------------------------
// Alternate method? --> set_sleep_mode(SLEEP_MODE_PWR_DOWN);

// Hey, someone must have pressed the switch!!


PCINT_off(); // Disable pin change interrupt because it's only used to wake us up

ADC_on(); // Turn the AtoD back ON

WDT_on(); // Turn the WDT back on to check for switch presses

} // Go back to main program

Just what I needed :beer:

that should fit in here very nicely

void sleep_until_switch_press() {
    WDT_off();  // Turn the WDT off so it doesn't wake us from sleep
                // Will also ensure interrupts are on or we will never wake up      
    press_duration = 0; // Need to reset press duration since a button release wasn't recorded
    while (is_pressed()) {  // Enable a pin change interrupt to wake us up. However, we have
        _delay_ms(16);      // to make sure the switch is released or we will wake when the user releases it
        }
    PCINT_on();
    sleep_mode();   // Now go to sleep
            // Hey, someone must have pressed the switch!!
    PCINT_off();    // Disable pin change interrupt because it's only used to wake us up
    WDT_on();   // Turn the WDT back on to check for switch presses
}               // Go back to main program

New resistors for R1/R2 aren’t there yet, bit I couldn’t resist changing the code. Just adding the two lines about ADC brought the sleep mode current down from 0.254mA to 0.89mA 0.089mA at 4V. It’s even down to 0.068mA at a more relevant 3V.

That’s so simple and effective, when you know what to do. Again thanks TomE for the hint.

void sleep_until_switch_press() {
    WDT_off();
    ADC_off();     // <++++++++++++++
    press_duration = 0;
    while (is_pressed()) {
        _delay_ms(16);
        }
    PCINT_on();
    sleep_mode();
    PCINT_off();
    ADC_on();     // <++++++++++++++
    WDT_on();
}

.

EDIT Oct 16: The above values were with 33k/8k2 as R1/R2. In the meantime I changed to 330k/82k and that brought the current when off down to 11µA (0.011mA) with a cell that is 3.3V resting. LVP still working as before. Now that’s really good.

Cool! Think there's a typo there on the values?

Yes, sure it is. Ah, these zeroes…
Corrected

Thanks, i just tried it and it works on the tripledown driver with a e-switch :slight_smile:
Finally I can use that driver in my e-switch lights.
Do you think it is possible to add a memory function, so that when power is cut via the clicky switch it remembers the last mode and starts in this mode? This would make it usefull for dual switch lights too.

The more I look at this, the more I'm intrigued and interested. If you could extend the MCU pins to accomodate an 85, that would be great. But besides, the BLF Q8 SRK board has the stock 10 uF C1 and we add a 0.1 uF C2, though. Our C2 has to be close to pins #4 and #8 - I've found it works well with the 25/45/85's. I almost always air wire it across the MCU on stock drivers.

It looks like you got other important things in place, like the RGate and gate pulldown which we are populating. Plus the LDO would be a huge+ over what we have.

We designed ours for FET+1, and using pin #3 for an optional indicator LED. If your driver could accomodate that option as well, it would be right there with ours, but of course, your's can be configured for so much more.

The STAR Momentary firmware does not include any memory options or saving functions, so that part would need to be made up from scratch or transferred from a clicky firmware. I’m really not a firmware guy, but I think it is possible.

.

This can be done.

- ATtiny85,

- C2 closer to MCU,

  • indicator LED to pin3, very well.
    Anything else? :wink:

While I’m already sketching the board…
Could you give me some input, just to know if I might omit options if the space was needed.

- Is the outer diameter of the Q8 board (46.02 mm) enough or would the “ears” of BLF SRK FET still be needed?

- As momentary switch pin2 is most commonly used, is pin3 for the switch an option at all anymore?

- There was talk of a snubber circuit for the FET, is that still in discussion?

- what for are in Q8 (v3) the two small rectangular pads above BATT LED?

  • Is the Zener Diode in Q8 the usual Zener-Mod-Diode and not necessary with an LDO version?

Any feedback is welcome.

Oh boy - not sure if I'm stepping on toes. Yours is a more generic board since it serves many possible options, while ours is more single/special purpose.

- Is the outer diameter of the Q8 board (46.02 mm) enough or would the “ears” of BLF SRK FET still be needed?

The ears would serve well for a generic SRK board that could be used in various/most clones that don't have a retaining ring. Actually I requested it for ours, since our OSHPark BLF Q8 is only gonna be used a prototype, typically in the cheap SRK clones available today. It turns out though we haven't found a need - we can still get a tight press fit, least on the clone I'm using so far.

- As momentary switch pin2 is most commonly used, is pin3 for the switch an option at all anymore?

I'm not aware of it being used on pin #3

- There was talk of a snubber circuit for the FET, is that still in discussion?

Hhhmmm, not sure - can't recall details, but we are not using it at this point, but DEL is going to be scoping our new board, so if he's satisifed, it won't be used or considered I'd think

- what for are in Q8 (v3) the two small rectangular pads above BATT LED?

Ok, that's a good question - I see them, they are there.. Just not sure. Maybe either sets of pads can be used for wiring up a indicator LED, not sure...

- Is the Zener Diode in Q8 the usual Zener-Mod-Diode and not necessary with an LDO version?

No, it's not meant to be the typical zener diode. It was intended to be optional, only if we could not get a stable VCC input to the MCU with the other enhancements. Richard's new MTN17DDm v1.1 uses az ener the same way as our intention, but it doesn't look like we need it. In fact it's not recommended because of the leakage that adds to parasitic drain significantly.

Any updates? Still very interested in the progress, Great Job btw!

Almost done. Just finetuning.

BLF SRK FET v3.1
.

EDIT: I just saw the results @DEL posted in the Q8 thread. As further alterations in the circuit seem to be useful, I removed the link for now, await the progress with excitement, and you may see the following as an intermediate state.

.

.

.

.

:slight_smile:

BLF SRK FET v3.2

.

Changelog (from v3.0)

- combined ATtiny 13A/85 footprint

- added support for battery indication LED (I+/I-/R5/±)

- moved C2 closer to MCU

- added Rmcu to reduce ringing

- added multiple spots for C1 and R1

- increased GND path to FET

- increased amount of GND vias

- increased amount of LED+ vias

- added thermals for AMC7135s

- slightly larger GND pads for AMC7135s

- removed star-pads

- removed snubber pads

  • removed SW+(3)

.

Oshpark Link

.

.

.

.

.

.

Partlist

- 13A/85: MCU ATtiny13A or 25/45/85; 8S1 (SSU) or 8S2 (20SU)

- Rmcu: Series resistor between VCC and MCU Pin1; 0805

- FET: N-Channel MOSFET at Pin3 or Pin6; LFPAK56

- Rgate: Series gate resistor; 0805

- Rpldn: Pulldown resistor (gate to GND); 0805

- Q1: Single AMC7135 at Pin5; SOT-89

- Q2-10: Up to 9 AMC7135 at Pin3 or Pin6; SOT-89

- D1: Schottky diode (~0.25V) for 1S (4.2V); SOD-323

- LDO: Low dropout regulator for 2S (8.4V) [LDO needs C1 and C2]; SOT-23-5 (Vout is pin5)

- C1: Cin [before Rmcu (C1a) or behind Rmcu (C1b)]; 0805

- C2: Decoupling capacitor for MCU; 0805

- R1: Voltage divider to VCC [before Rmcu (R1a), before D1 (R1b) or behind D1 (R1c)]; 0805

- R2: Voltage divider to GND; 0805

- SW+(2): Pad for momentary switch to Pin2

- SW-: Pad for momentary switch to GND

- Tin/Rt1/Rt2/T+/T-/Ct: Temperature sensor

  • I+/I-/Ri/±: Indicator LED

.

Happy modding :slight_smile:

I missed this some how. This V3.2 version is looking really good. I like the pin wiring options. I have a triple version of Narsil posted - been testing it and seems to work pretty well.

Full source here: https://drive.google.com NarsilTriple v1-2.zip

Thanks for the code!
Triple channel is so awesome. It eats a lot of pins, but it eliminates almost all disadvantages of a FET driver.
I was still testing and adjusting v 3.0 in my 7x SRK (a 1A-4D-7A multi-tint-light, best tint ever). My next plan is to install a Q8-thread inspired brass ring on the driver as battery contact.

EDIT: Oh boy, I just went through the code. You firmware people never cease to amaze me.

Well, when you've ben writing C code since '81, you learn a few things... But there's always new things to learn - that's a big reason why I like what I do so much.

Tom, can I freely choose between 85 and 85V for your firmware?
NarsilTriple.c and tk-attiny.h only mention “85”, but I recall the V-versions being more reliable because they work down to 1.8V.
85 is 20 MHz, 85V is 10 MHz, does firmware detect this by itself or do I have to make changes?
Much obliged.

Should be no problem with either MCU - nothing in the firmware special for either. I bought a few V's in the beginning and freely mix them up. Just fyi, I did some low voltage testing on a 85 (no V). We run them at 10 Mhz btw. I could run the light down to 2.3V without a hitch, accept the LED was a very light glow. I was pretty much amazed btw. The 350 mA 7135's, maybe combined with DEL's new 25/85 circuitry allows us to run with a PWM value of 1 with no prob, even on a drained cell. The 85 is spec's down to 2.7V, but add 0.2V for the diode, and you have 2.9V as spec'd low, but it ran on a cell at 2.3V, and since the LED is totally useless at that level, I don't see any problem at all. I literally had to cup my hands over the head to see the LED light up, and could only tell it was lit from turning ON/OFF - slight difference. I don't recall ever being able to do that, or anyone else posting bout it!!

Dunno, dunno why - maybe the 85 PWM rates, maybe DEL's great tweak on the circuit, maybe the 7135's, but the 7135's is the same batch I bought from FastTech years ago, maybe a combo of all these things.

I've been buying all my 85's from Richard - dirt cheap, cheapest around, and all he has is the 85's no V. Since basically no one has been buying them except for me, he's still got 55 in stock at that great price. I'm afraid if they ever do get popular, he'll have to buy a new batch and charge twice the price. His price is $1.35, while Mouser is over $2 in qty 10 or so, last I checked. Richard literally makes pennies on these things - amazing he even bothers, but he's there to help, not just sell/make money.

Ohhhh - btw, the spec sheet on the "V" says 1.8V-5.5V only for clock rates of 0-4 Mhz, which Narsil doesn't do, or bistro. For 10 Mhz, it's spec'd exactly the same as the non V MCU's: 2.7V-5.5V

Oh bout the clock rate, it is, and must be 10 Mhz -- the fuse values are for 10 Mhz, and the code/build is for 10 Mhz. If you want to tinker to lower the rate, by all means go ahead. I think DEL, maybe couple others used a lower rate fine, but PWM rates I believe will go down quite a bit. For me, I see no point in dropping from 10 Mhz, but the option is there. We had discussions bout MCU rates a while back in the 25/45/85 thread. Think Halo wanted us to go lower as well -- forgot, another reason as well, maybe...

Wow, very nice driver board. Way too many components for me to understand it. I’m sure there’s a kitchen sink around there somewhere. :wink: