Experiences with CR2032 battery backup?


In one of my Photon projects I use a CR2032 backup battery (non-rechargeable) and I monitor the battery voltage through one of the analog inputs (A5).
After two weeks in operation with Vin connected to 5v for approx. 50% of the time, I noticed that the voltage measured on the backup battery has dropped to about 2,7volts.

  1. Is this normal behaviour and should I expect that such a huge voltagedrop is only manifest in the beginning of the batteries life???
  2. Could it be that this is due to the load of the analog input (A5)???
  3. Or should I have serious doubts on the quality of the CR2032 batteries that I am using???


Too little info here :wink:
How have you wired the battery?
What are you powering while running on battery only?

A typical CR2032 will only provide 220mAh - this means running a Photon of it will drain it quite quickly since the STM32/WiFi combo used on it is not really a low-power unit.


The battery is directly connected to Vbat as it is used only for retaining variables when system power is off. Apart from that it is also directly connected to analog input A3 (not A5 as I said earlier) as I also want to monitor the status of the battery.
So it is for retaining only!
When the system is running the application, it is powered through a 5v power supply on Vin. The application is only using WiFi and cloud connection occasionally, and then it is initiated (and eventually also disconnected from within the application and powered by the regular 5v supply.


What kind of sleep mode are you using?
Does the same happen without the connection to A3?
Does it happen with the connection but never actually reading the battery voltage?
Can you try pinMode(A3, INPUT) before going to sleep?


I do not use any sleep mode at all. The Backup battery is only for retaining some variables in case someone accidentally draws the powerplug out of the wall-socket.


@Jan_dM, STM has a note on using VBAT:

Warning: During tRSTTEMPO (temporization at VDD startup) or after a PDR is
detected, the power switch between VBAT and VDD remains connected
to VBAT. During the startup phase, if VDD is established in less than tRSTTEMPO
(Refer to the datasheet for the value of tRSTTEMPO) and VDD > VBAT +
0.6 V, a current may be injected into VBAT through an internal diode
connected between VDD and the power switch (VBAT).
If the power supply/battery connected to the VBAT pin cannot support
this current injection, it is strongly recommended to connect an
external low-drop diode between this power supply and the VBAT pin.

It may be a good idea to add a small schottky diode as recommended.


to peekay123:

  1. is my understanding correct that you assume that the current that may be injected into VBAT would probably damage the CR2032 battery?
  2. if so: if I would replace that battery by a rechargeable CR2032: could that also solve the issue???(I assume that a rechargeable battery will not be harmed by that current?
  3. if I would opt for your suggestion and apply a schottky diode: that diode will be placed between the battery and VBAT, right? If I then still would want to monitor the battery voltage: my analog input A3 will be connected straight to the battery. Or might I also face unexpected effects on the battery when doing that? I assume that the A3-input impedance will be high enough???(If I should connect A3 to VBAT instead of to the battery itsself, I will not be able to read the real battery voltage)



  1. Or discharge the battery prematurely
  2. Nope, that would require more components to keep the battery charged
  3. I suggest you hook A3 to the battery side of the diode through a 4.7K ohm resistor. Since you are measuring voltage, having the current limiting resistor won’t hurt.

A pin set to ANALOG INPUT presents the highest impedance when the ADC is not sampling. While reading the ADC, the input impedance can drop to about 40K ohms. So there is likely no need to change the pinMode() on A3 as long as it stays as an ANALOG INPUT. How often are you sampling the battery voltage?


A drawing of how it’s all connected would clear up a bit of confusion in my mind about the problem :grin:


analogRead() applies a dedicated pin mode AN_INPUT which is not the same as INPUT.
Unlike some older device OS versions after the read the pin mode will not be reset to INPUT when done. An explicit pinMode(A3, INPUT) will remove all doubt tho’


@ScruffR, I should have said “as long as it remains as ANALOG INPUT”! I’ll fix my response.


Also, while the ADC needs to see a low impedance input. this doesn’t mean you need to drain your battery.I have done a few successful low power applications using a 2M/1M divider and a 10nF cap.


Thanks for all your contributions!

However there is still one thing that I do not understand: I’ve connected the battery through a schottky diode to VBAT, and measure the battery voltage through a 4k7 resistor connected from the battery to A3 of the Photon as suggested by Peekay123. I observed that the battery voltage dropped considerably within 24 hours with the Photon being powered off (VIN = 0). When I removed theconnection to A3 completely, the thing works fine, so obviously theinput impedance at A3 is rather low when the Photon is not powered on! Seems a little bit unlogical to me.
Anyone has similar experiences???
And if this is according to specs: I cannot read the backup voltage when the system is off. Is there another way to measure this (i.e. Can it be read by the Photon directly from VBAT or so?)


About the last sentence: it is not very accurate. What I mean is: I want to monitor the backup voltage through taking samples of A3 when the system is powered on, but it is not very helpfull if the battery is dis-charging anyhow when the system is powered off.


Have you tried pinMode(A3, INPUT) after you’re done reading the voltage?
And also read the voltage less often?


My system only occasionally connects to particle cloud (initaiated by the user), and once it is connected, it reads A3 once and after that not anymore (until the next time that the connection is initiated).
Again my issue is that the battery connected to VBAT seems to discharge through the A3-input when the sytem is powered off (the USB power supply connected to VIN is drawn from the wall socket)
So the program is not running at all!
I have <pinMode(A3, INPUT);> in my setup, and I have <BatSp = analogRead(A3)*330/4096;> in the loop that is executed once when <particle.connected() == true>
Are you (ScruffR) suggesting that I should have <pinmode(A3, INPUT)> in that loop???
Again: the battery is discharging when the system is off.
It looks like the input impedance drops when the system is powered off???


As I said earlier analogRead() will set a special pin mode (AN_INPUT) and this will stay that way unless you re-set the mode to INPUT.
I’m not saying this will change anything but detaching the ADC from the pin is at least something to try.
So, yes - I am suggesting to call pinMode(A3, INPUT) after your analogRead() call in loop().

This is something I’d defer to @rickkas7


Hi ScruffR,
For your information: I did put in a call pinmode(A3, INPUT) directly after the analogRead() in the loop, but that did not solve the issue: within 24hrs the backup battery voltage dropped from 3,11 to 2,89v.
Obviously detaching the ADC from A3 does not prevent the battery from discharging when power is off.

I asked @rickkas7 for advice, but I did not receive a response until so far.
Thanks for your help.


You’re likely getting current leakage somewhere, but there’s a better way, anyway. VBAT is already connected to the ADC internally within the STM32, you don’t need an external circuit to measure it.

This code allows you to read the internal sensor:


What about just writing the variables to EEPROM? It will save you all the hassle of the battery backup method. You likely don’t even need to save all the variables, only a few key ones needed after a power pull to restart and read from EEPROM the last saved values.