I am now in the process of designing a clock based on a Photon. The main feature will be keeping the time of course so I am looking for some info about connecting a back-up battery to VBAT pin that will supply internat RTC in case of the Photon is without power (power outage…). I am used to RTC modules that contain a rechargable battery which is charged when the module is powered.
So the question is - when I connect a battery (Li-ION, 3.6V) to VBAT pin, will the photon also automatically charge the battery?
The VBAT pin is a pin on the STM32 processor designed to allow an external power source (battery, supercap) to sustain the processor’s RTC and a portion of the onboard RAM when power to the processor is removed. As such, VBAT is an INPUT and does provide any charging capability whatsoever. You may want to refer to the following topics for more info:
Thank You guys for replies. 99% of customers will use the clock with Photon connected to internet. But there will be some using it without a connection and I must also to take care about this group So time keeping without a possibility to sync it via internet is necessary.
Connecting VBAT directly to a powersupply is good idea, this is also a way how RTC modules deal with this problem. However, it is necessary to limit the voltage to 4.2V max, for Li-ION batteries. So a 5V line with two diodes in series might work well.
I will also try a supercap and how long it is able to keep the time…
I may suggest, use two Li-ION batteries, which could accept ~8 volts, so 5 volts will not harm them. As i understand it, the Li-ION batteries do not have a problem, not being charged to their full capacity.
I think superCaps are lots more expensive, and they will not last as long as Li-ION batteries (not meaning in years, but in minutes to discharge).
I have used Li-ION batteries that are the size of a AA battery (14500), they are of course 3.7 volt rather than 1.5. Not to expensive I think.
A battery holder that accepts two AA batteries works well.
@Jack, @dfarny, if you want to supply VBAT independently of the primary voltage source (LiON) then a supercap or other suitable battery is fine since only a max of 19ua will be drawn.
However, if you want to power both the cpu and VBAT from a single source then @Jack’s approach is solid. However, don’t expect any RTC backup if the batteries fail and there is no internet to connect to.
Vbat is not usable at this time on the Photon. The Particle team has it on their ToDo list to make it usable in the next few weeks.
As of now, even if you have a battery (charged) on the Vbat, after a power failure, and the power comes back on, the cpu does not know where to continue running script. In a few weeks we expect to see a way to use Vbat.
@Jack, you are somewhat correct. The Vbat pin functions as it should - the RTC will keep running and the backup SRAM area will be maintained. What is not supported yet is the ability to allocate variables to that backup SRAM. As for “when the power comes back on”, the CPU will do a full reset and it will be up to the user code to recover its “state” from the data stored in the backup SRAM and run its code accordingly.
However, another item that will be considered is to exploit the STM32 “brown-out” interrupt feature where user code could be called when power drops to allow an elegant shutdown of the code (if that is possible).
As for the application - it is not confidental. I am designing a nixie tube clock (what is nixie: http://www.daliborfarny.com/my-work/) with Photon as its heart. The clock must work also without internet (not everywhere is a WiFi) and also for user without a cellphone. So it will have interface to set the time and that time must be stored in battery backed RTC to prevent time loss in case of power failure.
I checked the STM32F205RGY6 datasheet and it seems that it will be possible to connect a battery to VBAT pin and keep the time this way. I dont need anything else than time backed by battery, also the Photon itself will not be backed.
So, if the VBAT pin will not be wired directly to Vdd pin on Photon board, it should work well.
@dfarny, your application is neat.
I am still not sure how accurate the Photon clock will be over a couple months. Is your clock showing second resolution? I bet you or one of the others on here would have an estimate for the long term accuracy.
The accuracy is not critical, the clock is primarily designed to work connected to internet. User who has the clock off-line must count with some inaccuracy. The clock will later have also a seconds position, so it will be possible to measure the accuracy.
VBAT is directly wired to the controller core and hence 3.3V is the nominal and 3.6V already stretching the limits.
Noone said that this has to be a LiIon without voltage regulation. But since VBAT does not pull a load of current and can even go down to 1.64V (IIRC) recharging might not be required also. A standard coin cell should do the trick.