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.
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.
I am not sure how accurate the Photon will be over a couple days, or a couple months. What do you think?
@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).
I really don’t know what this application is, and it may be confidential. But, with some details, we may be able to suggest some different options.
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.
Thank You guys,
@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.
Lots of good info in this thread. Thanks.
You might find this thread useful also.
It discusses using a supercap rather than a battery, but the use case is similar to yours.
Thanks, I will finally use a supercap instead of battery. The mentioned thread explains it pretty well!
I don’t see how a maximum of 3.6 is useful. If that was a Li-Ion, it would be nearly dead.
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.
I just figured out that the Photon Power Shield is the solution to my backup power needs for the Photon. I didn’t know there was such a thing.
@dfarny Hey man your Nixie Tubes and overall clock designs are beautiful!
No wonder your back ordered for months!
I’m here to ask you about you about the accuracy of the Photon’s RTC that you’re using to keep the time on the clocks that are not connected to the internet. Do you have an idea now at how much time drift you get using Photons built-in RTC?
I’ve been testing the DS3231 RTC which is supposed to be one of the more accurate options and it’s off by 2 mins and 20 seconds after a little less than 1 year. I’m tracking the suns position in the sky and accurate time is needed to do this.
@RWB Hello! Many thanks, I am pleased you like our clock!
The accuracy of Photon’s RTC is not good, far from DS3231. In my case, the Photon drifts around 1-2 seconds per day when the clock is running without connection to internet. I am not actually sure if the time is maintained by RTC or caculated by the processor when the module is running - the internal RTC might be used only when Photon is not powered (and RTC is supplied from backup battery). I tried to explore RTC calibration features which should improve this significantly, but I didnt find satisfactory information on this topic (too many contradictory information) and because almost all customers use the clock online (time is in sync), I assigned this task low priority. I will have to solve the calibration one day as we are working on several projects with Swiss watch/clockmakers and the clocks are supposed to run also offline. If you find something, please let me know.
You can find some more info here: https://community.particle.io/t/internal-rtc-calibration
If there is anyone who is capable of setting up the calibration functions on Photon, I am willing to pay for his services.
Thanks for confirming this
I think I may just have to spend a little more money and just use a GPS module for accurate time. The RTC was an attempt to avoid the use of a GPS sensor.
Good luck with the Nixie Clocks! When I reach some financial goals I plan on getting your tubes and PCB.