@Jack, no VBAT does not provide voltage or current to charge the supercap. Look at the recommended circuits in the links I provided.
Thanks peekay123. Since VBAT does not provide any voltage/current, it may be better to put the superCap/Battery on the 3v3 pin then.
VBAT is only used for a UPS right?
Hope to get my Photon shortly (this week maybe).
@Jack, the 3.3V line is supplied by an onboard switching regulator which won’t be able to handle the current surge on the supercap. You are best off using the 5V (Vin) line supplied by your USB power supply. VBAT is designed to maintain the RTC and a portion of onboard RAM in the absence of power. In your case, using the supercap on Vin is the best approach.
@peekay123, good idea. I am trying the supperCap (5.5v 4f) on the 5V line now. Will take a few minutes to check the results.
I am testing with [Spark.sleep(99999);]
Do you know how much power the 5V to 3.3v regulator uses?
@peekay123, the superCaps on the 5v line Last test, (5.5v 4 farid superCap, on 5volt pin) lasted for 6 minutes. That’s not to bad for a UPS. Of course, something larger, would last longer.
So that brings the question, what is the benefit of the VBAT ?
------ When the 5volt drops -----
A. using superCap/battery (UPS) on the VBAT pin, all processing is halted, variables are saved, uses less power. External power needed to charge battery.
B. using superCap/battery (UPS) on 5volt pin, all processes continue, uses more power. Battery charged by 5volt pin.
I do not understand the statement “Using STANDBY mode, processor will use 2-3uA from the 3.3v supply and less than 1uA from the VBAT line”. Does that mean which ever one is connected, or does that mean that both have to be connected for STANDBY mode to work?
STANDBY mode is “Spark.sleep (SLEEP_MODE_DEEP, int seconds)”, right?
Sorry if I ask dumb questions, just trying to understand this Photon. Thanks for your help.
As I understand it, the power from VBAT will kick in if the 5volt is stopped.
How about if you are running the Photon from a 3v3 source ?
When you feed power though a USB cable or via the VIN pin,
it actually goes through a SMPS and converted to 3V3 for the BM-09.
So if you were to be powering the photon directly with a 3V3 source, the VBAT would still kick in since the VDD on the BM-09 is actually taking in a 3V3 power source.
Hope this helps!
I half way understand that. Thanks for helping me. I think I understand that, VBAT is not looking at the 5 volt, as much as it is looking at the 3.3 volt produced by the 5 volt. So, if the 5 volt, drops to 4 volts, it still produces the 3.3 volt, and does not switch to VBAT mode. ?
When does the Photon switch to use the VBAT power supply?
Let’s put it in another way as per the datasheet:
VBAT = 1.65 to 3.6 V: power supply for RTC, external clock, 32 kHz oscillator and backup registers (through power switch) when VDD is not present.
From the photon datasheet: (http://docs.particle.io/photon/hardware/#4-2-recommended-operating-conditions)
Supply Input Voltage VIN +3.6 +5.5 V Supply Input Voltage V3V3 +3.0 +3.3 +3.6 V
So what you said is right. Since 4.0 volts is still above the minimum of +3.6v, the VBAT will not kick in.
I would need to read up more and see what are the conditions for VBAT to kick in
VBAT kicks in when the STM32’s VDD drops, so if VIN or 3V3 more importantly drops below the minimum required 3.6 and 3.0 respectively, VBAT will start to sink current from an external source.
I thought that when VBAT kicks in, it means that power is no longer provided to the WIFY, processing etc (heavy power users), and VBAT power only runs RTC, memory backup etc.
I didn’t think power from VBAT would just start trickling in if 3v3 gets low. Can you clarify my confusion? Thanks.
EDITED: I think I understand now. If the VBAT circuits go below the required voltage, it will draw the extra amount needed from VBAT.
The high power circuits will just stop working when they don’t have enough voltage. Two separate power systems. Is that sorta right?
A little different than both of those… basically you have to control these Sleep modes in software. When you put the STM32 in a particular sleep mode, namely STOP and STANDBY… the RTC and SRAM backup registers CAN source current from VBAT … IF you have a 3.0 to 3.6V voltage source there, AND the voltage source on VDD of the STM32 (essentially the 3V3 pin) drops below 3.0V. If you keep power supplied to the 3V3 pin, the STM32 will prefer to source current from that input that from the backup battery attached to VBAT. This makes sense since you don’t want to drain your backup battery when you are hypothetically “plugged into an infinite current source”.
I’ll have to double check on this, but you enter these STOP and STANDBY modes from System.sleep() with and without the SYSTEM_MODE_DEEP parameter. Definitely with the SYSTEM_MODE_DEEP parameter. The one I’m questioning is the non-deep-sleep mode.
I guess I did not understand VBAT then. I thought (read) that it would work without any software sleep mode commands.
@BDub, Please confirm, you say that VBAT is not used unless a software sleep mode is called ?? Please review this, as I respectfully think it is incorrect.
Is Spark.sleep() the command you were looking for rather than System.sleep()? Are both available?
This is great. If I am reading your post correctly, you are saying that there are two versions of deep sleep mode:
- where you’re running off VIN consuming 160uA. This is very similar to the core’s deep sleep.
- introduced in the photon is a deeper sleep mode (is there a name for this mode?) whereby VBAT runs just the RTC and SRAM.
If this is correct, my follow up questions are then
- What is the measured consumption of state #2?
- Is the photon able to wake up from #2 based on elapsed time?
Let’s keep things simple:
VBAT kicks in when the processor loses power (3.3V). It is NOT dependent on any sleep modes whatsoever. The only purpose for VBAT is to maintain the RTC clock and a specific 4KB of RAM during the power “outage”.
AT THIS TIME, you cannot specify if a program variable is stored in this “special” 4KB space. This, however, will be implemented in the coming weeks.
@jack, I reviewed the datasheet and some other app notes and yes it appears VBAT operation is independent of any software control. However, without some form of software interaction I’m failing to see how you will utilize VBAT operation to any benefit.
Instead of citing different examples that may not work that I’m thinking of… what is the application and way you’d like to utilitize VBAT? Then we can just focus on making that work for you
@BDub Thanks for the update.
How I would like to use VBAT?
Use like an uninterruptible power supply (UPS).
When the 3v3 goes to low, the processor and wifi stop working, but the RTC and special memory, continue to be powered by the battery on the VBAT pin.
When the 3v3 comes back, the processor starts running again on the line of code where it stopped, and the wifi will come back on (if it was on when the power went down).
I would also like it if the battery connected to the VBAT could be trickle charged by the chip, rather than having to add a diode and resistor externally.
Just my thoughts…
@Jack, when power is lost on the processor, it will not restart from where it left off. When power is restored, it will reset and using VBAT will not change that. What WILL change is the fact that your code can detect via the “maintained” RAM the power loss and start up accordingly.
Though too early to tell if it will be implemented, the STM32F205 does support a brown-out detection feature:
A PVDO flag is available, in the PWR power control/status register (PWR_CSR), to indicate if VDD/VDDA is higher or lower than the PVD threshold. This event is internally connected to the EXTI line16 and can generate an interrupt if enabled through the EXTI registers. The PVD output interrupt can be generated when VDD/VDDA drops below the PVD threshold and/or when VDD/VDDA rises above the PVD threshold depending on EXTI line16 rising/falling edge configuration. As an example the service routine could perform emergency shutdown tasks
In your case, there is NO mechanism that allows user code to stop when power is lost. VBAT is not designed to do that. You could use a supercap for the 5V supply to maintain power to the processor. By detecting if the power that charges the supercap is present or not you could put the Photon into a deep sleep mode where the supercap will last a LONG time. When power is restored, it could trigger a waking interrupt and the Photon would start running from where it left off.
Since you ask how I would want it to work, lets try a second option:
Vbat can run all systems (wifi processing etc).
Have a system variable that will indicate if the 3v3 is to low, (which means we are now drawing off of VBAT).
Your code can look at that variable, do any processing/publishing needed, and then can turn off the wifi, and secondly, the program can turn off the processing. Of course, I want processing to continue where it left off when 3v3 is restored.
This would give the programmer the options. If the battery on VBAT is large enough, then maybe no action will be required.
May want to have two variables tho. One to show the value of the 3v3 line, and one to show the value of the VBAT. That will enable the program to go to low power mode if the VBAT starts getting low.
It is unlikely that the power will drop, so all this may be lots of overkill…