Photon backup power supercap / detecting power loss - schematic feedback

I’m building a mini-fridge fermentation temperature controller with my Photon, and I want to ensure I get alerted in case of a power failure.

I’m a SW guy, so the HW side is not my forte! Here’s my first shot at building a circuit to do this - the Photon would interrupt on D7 going low to trigger the power loss alert and do whatever graceful shutdown is needed. Feedback please?

Edit to add: I’m not worried aabout using Vbat to keep the RTC/SRAM alive - clock sync etc would be taken care of on startup regardless.

I’d probably add something like a 10K resistor between D7 and GND to force the pin to pull down when 5V is removed. Your design will most likely work but with 5V removed D7 could end up in some weird floating state since it will essentially have nothing connected to it.

1 Like

@potatotron Thanks! I’ll definitely add the pulldown resistor. Once I get time to prototype this i’ll report back with my findings - it should be easy enough to test out.

You don’t need an external pulldown resistor; you can just set the pin to INPUT_PULLDOWN before you call attachInterrupt.

I don't believe this is correct. The source is 5V. The Photon pins are 5V tolerant but the docs say

All GPIO pins except A3 and DAC are 5V tolerant (when not in analog mode), if used as a 5V input the pull-up/pull-down resistor should be disabled.

This might actually explain some weirdness I had in another part of my project… hmmmm… thanks for the pointer :slight_smile:

You are correct; I forgot about that little detail.

Did you need a capacitor to store some power before everything shutdown or can the photon still publish a message when power is lost? Thanks

@Allan, it would be difficult for the Photon to keep doing anything without power! So yes, you need a super capacitor or battery backup solution for the Photon to still publish when the primary power source is lost.

1 Like