Hi -
I have a device based around a RasPi Pico that runs on a powerbank for around 10 hours per charge. While running, it logs activity at various times to internal memory. It detects darkness, turns on some high-power LEDs, then detects dawn and turns off the LEDs. Usually this sequence occurs before the powerbank runs out, but sometimes the power runs out before the LEDs turn off.
I want to detect the fact that the power has disappeared and log the fact and time before the device finally dies! It seemed a fairly simple task: detect the disappearance of the 5V supply from the powerbank and run an ISR, keep the CPU going with a capacitor across the 3.3V, write the log entry then let the system die.
The problem is, I cannot get the system to run the ISR, even though I am using irq(trigger=Pin.IRQ_FALLING... in the code. Scoping shows an abrupt fall in the 5V level and the 3.3V slowly decaying over 150mS or more, which is quite long enough to write the log, so why isn't it working?
I have not posted diagrams, code etc at this stage as I didn't want to make too long a post, but I'm happy to do so on request. If anyone has a better way of achieving this, I'd be delighted to hear it!
Phil
I have a device based around a RasPi Pico that runs on a powerbank for around 10 hours per charge. While running, it logs activity at various times to internal memory. It detects darkness, turns on some high-power LEDs, then detects dawn and turns off the LEDs. Usually this sequence occurs before the powerbank runs out, but sometimes the power runs out before the LEDs turn off.
I want to detect the fact that the power has disappeared and log the fact and time before the device finally dies! It seemed a fairly simple task: detect the disappearance of the 5V supply from the powerbank and run an ISR, keep the CPU going with a capacitor across the 3.3V, write the log entry then let the system die.
The problem is, I cannot get the system to run the ISR, even though I am using irq(trigger=Pin.IRQ_FALLING... in the code. Scoping shows an abrupt fall in the 5V level and the 3.3V slowly decaying over 150mS or more, which is quite long enough to write the log, so why isn't it working?
I have not posted diagrams, code etc at this stage as I didn't want to make too long a post, but I'm happy to do so on request. If anyone has a better way of achieving this, I'd be delighted to hear it!
Phil
