Make sure voltage is sufficient before booting Photon?

I have a small irrigation system from Irrigatia for the plants on my balcony. This depends on a solar panel (and batteries) for power and uses a water reservoir as its water source, and thus is completely off-grid. This is perfect for me as I do not have access to electricity or water on my balcony.

It does, however, have one point of improvement, namely in how it notifies me that its water reservoir is getting low: Whenever water drops below a certain level, a small buzzer inside the unit beeps for a few seconds, and thatā€™s it. I have been working on piggy-backing a Photon inside the irrigation system to send me a push notification to my phone instead, but need to make this run as frugal as possible to maintain operations of the irrigation system itself.

My first test initially appeared to be working as it should, but after a short while it drained the batteries and never got up and running again. My theory is that the Photon kept trying to reboot as soon as a sliver of power was generated, which then caused an immediate drainage that shut everything down again.

I am currently working on a second version of the code which I think should solve the issue for the most part. However, in the case of complete drainage of the batteries again - say after many days of rain - I might end up with the same situation where the Photon will constantly try to reboot and thus preventing the batteries from ever gaining any power again.

So, after a lengthy intro, hereā€™s what Iā€™m wondering;
Is it possible to make the Photon do a voltage check on startup, and immediately go back to sleep (for a defined period of time) if this is below a certain level? The goal is to make sure conditions are right for the Photon to run its check and send its message to the cloud before it starts draining the power supply more than necessary, and allow some time for recharging if need be.

I donā€™t think this is possible with a photon by itself, the hardware just isnā€™t there for it. If you use an argon, it has a built-in fuel gauge for checking battery voltage. Iā€™m pretty sure you have to use the jst battery connector though.
Edit: only the boron has a fuel gauge on 3rd gen hardware.

You need an external voltage watchdog to prevent the Photon from doing a low voltage ā€œboot loopā€.

1 Like

There is no fuel-gauge on the Argon either.
But the nRF controler is less power hungry than the STM32 of the Photon.

1 Like

Thanks for your swift replies, I really appreciate it :+1:

The result is unfortunately as expected though, it would almost have been too good if this was possible :smile: Any pointers as to what kind of ā€˜watchdogā€™ might be useful for me?

Iā€™ll check out the specs of the Argon as well :+1:

Ahh thanks for the clarification, I thought it did. I guess just the boron then.

There seems to be a rudimentary battery voltage level available ā€¦

https://docs.particle.io/reference/device-os/firmware/argon/#battery-voltage

1 Like

The problem with any microcontroller is that they will go into a reboot loop when the supply voltage is near their low recommended operating level. This can also occur when the voltage supply is ok but the current supplied is insufficient to supply the booting process. This is most likely what is happening here. So the device can't monitor itself under those conditions since it can't fully boot.

An external voltage watchdog (chip) will hold the RESET of the device until the supply voltage reaches a preset level, which in most cases indicates a safe booting condition.

If I recall, the STM32F205 in the Photon has a brownout detector but I'm not sure how this would work here. If enabled, it could prevent the processor from doing the boot loop. Research required.

UPDATE:
You may want to look at this thread (with caution)...

3 Likes

That option is also mentioned in the link I posted above - in fact it is the same link as you reposted there :wink:

1 Like

Agreed - however I read your response to indicate that there was no battery measurement available and wanted to clarify that there was somethingā€¦ and yes I should have followed your link before replying :smiley:

1 Like

Agreed, this is a possible way to read it

but I acutally said

which is a specific component that is not present on the Argon.
Even the link you and I posted do explicitly say so

So we can put it down to a mismatch between what was said and what was received - as we are all humans (I guess :wink: - :see_no_evil: :hear_no_evil: :speak_no_evil:)

1 Like

I think you are looking for something like this:

Reset / Enable Controller - KA75330 3.3V Voltage Detector


1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.