Photon VBAT supercap circuit

When I get my Photon, I’d like to use a supercap to keep the RTC synchronised in the face of power outages.

After some reading and some number crunching, I came up with this:

Edit: added D2 as per discussion. My calculations below still reflect the circuit without it.

(Updated schematic from post #41)

The super cap will be a 1.5F 5.5V cheapie from eBay.

The STM32F205 datasheet gives limits for VBAT operating voltage of Min 1.65V, Max 3.6V (p. 71) so that means the cap must be either charged at 3.3V or have a more complicated circuit to clamp the output to 3.6V.

Assuming I charge it at 3.3V, if I want to use a single 1W resistor to limit its charging current, that gives Max 303mA and Min 11Ω. Using a slightly larger 15Ω one, I get a charging time (5τ) of 2 minutes, which is ok.

If I use a Schottky diode, to avoid discharging the cap through the 3V3 rail, that should charge the capacitor to at least 3.1V, because at the end of the charging cycle, when the charging current is small enough, the diode drop should also be small (I can see a 0.2V / 0.1A point in the VF / IF curve in the diode’s datasheet.)

The STM32 datasheet gives a typical current consumption in VBAT mode (with backup SRAM, low-speed oscillator and RTC all enabled) of 1.68µA (p. 84.) C1’s voltage, after some time of constant current discharge, is V = V0 – I × t / C, so it should remain above 1.65V (the bottom limit for VBAT) for about 15 days. That’s neat!

The 100nF frankly I have no clue about, but I have seen it in every schematic on the topic. I suppose it’s there to provide a direct path for high frequency noise generated by the µC, so that it’s not forced through the cap. Why that is desirable I’m not sure.

Did I make any noobie mistakes?

Would you recommend a different circuit?


@tobia, that circuit looks fine for charging a superCap hooked to Vbat.

@tobia, THE 100nF capacitor is there to ensure the Vbat voltage rise-time is within the specs (it can’t rise too fast). Also note that this circuit will NOT work with the Photon’s onboard 3.3v regulator since it will not source the 300ma or so you need to charge the supercap. This will mean using an external 3.3v supply. :smile:


I don’t know the calculations, what would R1 need to be ?

The photon can supply 100ma max so use @tobia’s calculation to figure it out for 50ma, leaving a decent margin.

[quote=“peekay123, post:3, topic:12390, full:true”]
The 100nF capacitor is there to ensure the Vbat voltage rise-time is within the specs (it can’t rise too fast).[/quote]
I wouldn’t have guessed it in a million years! :astonished:

Yes, I’m aware there’s not much juice left if I use the internal regulator. I’ve already planned an external 3.3V supply. I’ll update the schematics to make it clearer. Thanks.

1 Like

Just a question. Why not move the resistor up into the same leg as the diode and have the big cap directly connected to vbat? Then make the resistor bigger to satisfy the max draw constraint?

1 Like

@rvnash, that sounds like a really good option.

If the Photon can easily supply 50ma, to charge the superCap, and the 3v3 does not drop out ever hour, that would work well.

Hi @rvnash and @Jack

It is not really a good idea to move the resistor since when the supercap has a lower voltage and the 3.3V supply is restored, there is a diode inside the processor that will let current out of the VBAT pin. The processor data sheet specifically warns against this and suggests a diode to prevent reverse current flow, but that would limit the lower voltage at which the supercap could supply backup register power. Having the resistor where it is shown above is a good solution to limiting the in-rush current in both scenarios.

A lot of circuits are not so critical but these big capacitors require engineering experience to use correctly and safely.


Make sense. But I guess you could add a higher resistor where I suggested to limit the charging current.

So, If I understand you, it would be charging the cap, but maybe to fast? If that’s the case, then with proper resistor value, VBAT will charge the cap?

If I had my Photon, I could test this, but still anxiously awaiting. Anyone got a Photon and want to test this ?

If you can tolerate a slower charge rate, and increase the resistor accordingly; there is the related win of being able to use a lower wattage resistor too. Unless your use case specifically needs a really fast charge cycle, I’d recommend taking this route. You really should not be forcing power supply design decisions based on the RTC backup regime, IMHO.

1 Like

@Jack, how many times can we repeat this! The VBAT will NOT charge the cap. @bko is referring to a protection diode which will be incorrectly biased if the external circuit is not correctly designed. Please read the STM32F205 specifications before asking the same question repeatedly and getting the same answer which you don’t seem to believe. If you want to test this on your own Photon and potentially blow the Vbat function then please do so. And if you prove me wrong, I will be sure to give you all the credit. Until then, the specifications stand as the defacto definition of usage so please don’t confuse other readers yet again.


I must have misunderstood this, sorry for any lame questions I may have ask.

@Jack, when you have these types of questions you may want to consider sending a private message so we can keep the confusion out of the topic. With everything Photon being so new, the only suggestion I can make is to wait for the Elites and Champions to test stuff out and write use-case topics for folks to have clear instructions. I know it means waiting but in the end, it will all be worth it. It may also save you from blowing your Photon! :wink:


So, what I have learned from this thread is, don’t hook the battery/cap directly to Vbat, but put a resistor of appropriate value between them.

I think we have this thread solved. If the OP (original poster) is satisfied, they should mark this topic [SOLVED].
As it turns out not at this point (ScruffR)

Yes, what I meant is that my design already includes an external 3.3V supply for other reasons, so I can minimize the resistor value for 1W peak dissipation. If I were using the internal regulator, I’d certainly pick a higher resistor, so as not to exceed the 3V3 pin current limit.


Thanks @bko!

I think it’s a good idea to add an appropriate schematic here:

From Page 64 (section 4.1.2) of the STM RM0033:


Hi @BDub

As always, you nailed it! The things I don’t like about this circuit are that you are two Schottky diodes drops down from the 3.3V rail to VBAT and as @AndyW said above, you don’t generally have to push soooo much current into the backup cap so a larger resistor and slower charge time would be OK.

This does avoid the unintentional and unfortunate current leakage through the protection diode on VBAT when the 3.3V rail comes back up. It is never a good practice to intentionally have current flow through protection diodes.


@BDub and @bko, you both nailed it nicely. Gosh I love being around smart folks :stuck_out_tongue: