[WIP] 15mm PAM2803 w/ ATtiny13A rough layout / possibility

While fast PWM 0/255 does generally work, it has also been rather unstable on every device I’ve tried. As one example, I was getting 3 lm on a full cell, 0.1 lm at about 3.9V, and barely enough to see the LED at 3.6V. Nothing at all below that.

Phase-correct PWM at 1/255 is much more stable at different voltages.

Then again, I haven’t tried anything remotely like this boost driver. It might behave very differently.

At a guess… If it has only a FET and no constant-current channel, moon mode probably isn’t feasible. OTOH, you might be able to add a separate moon mode with a simple resistor from a MCU pin to the LED. The MCU should be able to power the LED directly. No PWM necessary, and I think the MCU can even go to sleep with an output pin high. So, it might be pretty efficient.

Just an idea. You know, for when you find extra room on the already-cramped board. :slight_smile:

TK, I’d say that this is pretty different from the FET/linear drivers you are accustomed to. Like 7135 driver the base circuit here (from the PAM2803 datasheet) attempts to provide constant current. Unlike the 7135 this circuit has the ability to pull more power from the battery as input voltage drops. With only 1xAA ouput current is not actually constant AFAIK, but I speculate that results will be better than DD & linear drivers. I could be 100% wrong about this next bit, but I suspect that having a low-duty-cycle PWM (like PWM=0/255 FastPWM) will probably allow the PAM2803 to perform a good bit better than the datasheet shows. (Better in this case meaning more able to drive the 0/255 at a consistent level.)

RE: driving the LED from an MCU pin w/ resistor. That’s an interesting idea for this situation. When the normal output PWM channel on the MCU is turned completely off the PAM2803 will boost to almost exactly 5v and stay there. I’m assuming that this should give much more consistent output than any DD or linear driver attempting this approach. Choosing a load resistor is a simple matter of using any online LED calculator, they all expect a constant input voltage and that’s what we’d have here (5v).

Earlier today I realized that I had an important question for you RE: this driver. What’s the state of offtime without the cap? I know it’s workable, but what are the details?

Offtime without the cap generally works fine as long as you don’t care about having more than “short” and “long” and don’t need to tweak the threshold between the two.

The attiny’s SRAM basically has either decayed, or it hasn’t. At least, when looking at a single byte. In my experiments, this happens at anywhere from 0.3s to 4.0s, depending on how long the rest of the circuit takes to settle. On a nanjg driver it’s about 0.5s. On a FET+1 it’s generally about the same. But if there is an OTC, and that OTC is charged, the SRAM decay doesn’t happen until after the OTC has discharged most of the way.

In general, most of the SRAM bits decay to a “1” state. So, set a byte to 0, read that byte on boot, and if it’s still 0 you know the light hasn’t been off for very long.

IIRC, something like two thirds or three fourths of the bits decay to a “1” state. So it’s possible that the selected byte could just happen to decay to all zeroes, but it’s very unlikely. The chance is something like 1 in 20,000.

Using this trick to store values between boots is somewhat more risky if there is no OTC or other power source to sustain the data for a few seconds. The long/short detection byte might be all zeroes, but the data byte(s) may have had a bit decay. The time window for this is pretty short though, and risk can be reduced by using more than one detection byte… Still, any genuinely important data should be stored somewhere more stable. Or use a different method to measure time, and only trust the decay-prone data when the time is safely under the limit.

That’s probably more detail than necessary, but hopefully it gives you more of an idea what to expect. The attiny can hold values in SRAM until it runs out of power from other components, and this is around half a second on most BLF drivers.

So the 2803 has both a switch pin and Vin, can pwm be applied to the switch obviating the need for the fet?

@all - measuring input current on my HF DMM it seems really nonlinear vs PWM. Could be PWM confusing the DMM though.

Heh, I’ve had the same genius idea myself several times. Eventually I have to snap myself out of it - the unfortunate and in-hindsight-obvious answer is no. The MCU won’t run if the PAM2803 shuts down, it is bootstrapped on the PAM2803’s output.

I suppose it actually isn’t obvious if you haven’t read the OP in a while or aren’t familiar with the term bootstrap or it’s use in this context… OK, so here we go. The MCU (ATtiny) won’t run on low voltages like 0.9v, but the PAM2803 will. We currently have the Enable/Shutdown pin on the PAM2803 tied to Vinput, so it turns on as soon as battery voltage is applied. The PAM2803 uses a sense resistor to do CC (constant current) output, so once it turns on it will drive the LED at the current set by the sense resistor. (On 0.9v input it won’t do a good job, but it will try). Generally speaking this means that we’ll get something like 3-4v output from the boost circuit (to match LED Vf at the set current). The MCU is attached to the same output as the LED, so the MCU doesn’t start until after the PAM2803 starts boosting. The LED is hooked up through a transistor and once the MCU is up and running it can PWM that transistor. During any time period where the LED is not hooked up the sense voltage drops to 0v. The PAM2803 will attempt to increase the sense voltage (eg the sensed output current) by increasing output voltage. We depend on the PAM2803’s overvoltage protection here: the PAM2803 has OVP set at approximately 5v. The peaks are within the MCU’s regular maximum of 5.5v. If we were turning the whole PAM2803 off here it would be like blipping the clicky switch.

Other stuff:

  • The “Switch” pin isn’t what you think it is. Switch is a pin which the PAM2803 will momentarily connect to GND as part of the boost circuit’s operation. “Shut Down” / SHDN is the pin which would turn the chip off (and we can’t use for the above reason).
  • I had something else…

EEPROM isn’t strictly required in order to make a useful driver. I suspect it can still use the memory decay trick for short-term memory and offtime measurement, meaning it could run a multi-mode interface. I have several firmwares which work without eeprom, and even one example code base for use on an attiny10 processor.

I think I understand but allow me to display yet more of my lack of understanding. There is a cap on mcu Vin and another off time cap. I assume with the boost ic off and no fet to cut current to the LED that voltage remaining on the Vin cap would drop through the LED very quickly. Would a diode between led+ and mcu Vin prevent that drain and allow the mcu to stay awake between pwm pulses? This is where you get to stomp on me. I would consider it a catharsis for past sins. >:-/

I had wondered that too. I can think of at least two sitautions where it wouldn’t work though, even if it’s fine for normal PWM.

It probably wouldn’t help at initial boot time (boost still needs to come up first), and it wouldn’t allow for longer blinky modes like a beacon.

Adding diodes like that gets tricky. We push high voltage through the Schottky diode and into the output cap. Currently in my layout that cap is all the smoothing we have for either the PAM2803 or the ATtiny (or the LED).

I’d show my schematic to help, but it wouldn’t help: my schematic has a terrible layout and the PAM2803 is represented by a QX5241 because I was too lazy to make a new part. It’s hard to follow IMO.

I’m pretty confident that the PAM2803’s Pin5 (Vout) requires a cap. The MCU definitely requires a cap. The LED could maybe get by without one. So at a minimum we move from 1 cap to 2 caps and 2 diodes while dropping the transistor we use for PWM. We might (probably) still need a bulk capacitor on the output to keep it decently smooth, I dunno.

…And all that depends on the MCU running on that capacitor. EDIT: plus TK’s points are correct as well.

I was wondering about that too. Do you think it might be feasible to smooth out the LED power to turn FET PWM into something more like a constant current? Would that require a ridiculously huge capacitor? Am I trying to give a bicycle to a fish?

I think TK’s comment on initial boot makes sense(also the only part I understood, oof!) since with shtdn tied to pwm the boost ic wouldn’t be able to turn on to waken the mcu in the first place. Logic trap.

bicycle/fish. To smooth out PWM you’d use a big RC circuit, but as you said the cap would be ridiculous.

IF we had the space, and we don’t, we could attempt to bias the FB pin using an op-amp and a small voltage source based on an RC circuit which was fed with PWM from the MCU. EDIT: this is something I’d like to play with in 17mm though.

Good enough, heh. :slight_smile:

Keep these explanations up wight and you may have me understanding whats going on. :slight_smile:

Bumping a good thread. Anything new?

Hi RBD
Thanks for asking.
I’m still on this project and will be prodding further when I wrapped up HQ10D, UniversalBreakoutBoard and BLF SRK FET V3.
Just as time permits.
Short status here:
HQB15 works fine
After what the scope guys brought up I will keep the 2 resistors in the design
Cell gets drained very quickly without LVP although the led is off.
I strongly doubt our usual Lvp will work in 1aa config (no voltage for mcu to regulate anything.
I even have doubts that lvp by cutting pwm to the fet will work at all, as the boost circuit is not cut (i want to test that).
I’m about to make the 17mm version based on the SS24 diode, hoping to make it easier for others to try this if they want to.
CU

Is there any type of component which would be open by default, but which could be closed to block current when it receives a signal? (then would stay closed until power is disconnected and reconnected)

If so, something like that could be used for LVP. Put it before the boost circuit and it could maybe cut the power on command. I don’t know if something like that exists though.

Yes, perhaps we can use pin4 of the boost controller (“SHDN”)

In 2aa config switching to gnd will shutdown the pam2803
I can connect mcuPin3 with pamPin4
@Toykeeper, can the mcuPin3 deliver Gnd as output and how (which Register do I set how)?
Voltage can still be measured via mcuPin7—- probably only 17mm Board

In 1aa mcu wont work in SHDN as mcu needs >1.8V

Random confusion:
1, Where is the parasitic drain, in the boost ic?
2, I thought that 13A Vref was somewhere south of 1.1V so B+ straight to pin 7 without R1, just a high value R2. Since the boost ic works down to .9V the mcu will still be awake as long as it needs to be for a nimh(min 1V).
3 re 1, How much drain does the boost ic represent on its own(quiescent current?

It sounds like this is an issue only for a light left switched on and forgotten. Complete shutoff might not work but a slow beacon mode might be appropriate(always wanted one of those without all the other blinkies that usually come with it).

1. I believe so. Looks like the boost circuit is constantly trying to boost when the eneloop regains some power, then dropping again under slightest load
DMM always shows rising and falling voltage at the eneloop

2. vref is not the point yes its 1.1v
Attiny needs acc to datasheet 1.8v to work

3. in SHDN pam2803 needs 1yA when pin4 is pulled to gnd (datasheet pg 3)
My idea for 2aa is to measure voltage with mcuPin7 and switch the pam2803 with mcuPin3
Give me 24 hours and I come up with a oshpark Board

Yes it’s only needed for Lights left on
Drains eneloop within a day it seems, Rough
Well, i could live with a dead eneloop once in a while
Most boost driver dont have LVP anyway

Looking at HJK’s review of the nanjg 110 running off a single AA Eneloop and referencing his run time tests of that cell it looks like the stock driver can just stay above the 1.1v mark for most of the run at @ 2A draw so it should be able to keep the LED and mcu powered at least that long. It seems like serendipity that Vref is .1V above where we’d want to stop anyway so it makes a good LVP when B+ drops below Vref. With the boost ic functioning down to B+ = .9V the mcu should still be powered sufficiently to at least signal low voltage via the fet even if it can’t completely shut down the driver. It doesn’t look like this would work for primary cells too well as their discharge curves aren’t nearly as flat.

I get the feeling we’re not quite in sinc on the Vref vs mcu power thing. The mcu is connected to boost ic (out) so as long as the boost ic has .9V input then the mcu should have more than 1.8V and be awake, right? If LVP is triggered at 1.1V(light starts unique to LVP blink mode) then we have ~ .1V warning before the cell drops to 1V and another .1V before the pam2803 can no longer power the led and mcu but continues to drain the cell.