Implications of publishing result of readSupplyVoltage every loop()?


#1

Hello,

If we update the value of a variable exposed in Particle Cloud using Particle.variable every loop, how will that affect project battery life? My gut tells me that System.readSupplyVoltage() is not all that power intensive, but the code that publishes the updated value to Particle Cloud might be. Or does Particle Cloud only pull the variable when requested, even if it hasn’t changed?

Thanks,
Geoff.


#2

If you are using a Particle variable, it will only get pulled when the cloud asks for it. So there is no battery implication. All you are doing it updating a local variable, the Particle firmware knows the address of the variable and just gets the value when someone polls for the value. It is passive, in that it doesn’t update anything on the cloud.

Publishing is different, that will affect battery life if you are publishing often since it actively sends data every time. So a Particle.publish will use more battery

To read the battery voltage requires the ADC, which doesn’t require a lot of power consumption but does use about 250uA (if I remember correctly). So if you were to do that extremely frequently, it would affect battery life. It would be better to read it only as frequently as you absolutely need to.