Interrupt at shutdown(Solved)

Hello. I've searched a bit and found some topics on this, which objetive was to write EEPROM at shutdown, but as writing the memory takes so much power they needed a battery backup, etc. My case is simple I think. I just need to send 3 bytes via serial at 31250 baud rate when it shutdowns. So I would use an interrupt in fall mode, is that ok? How could I make the connection? A voltage divider at the interrupt pin maybe? The voltage takes a few seconds to reach 0v, before the 7805 it is a +12/-12 power supply with 4700uF filter capacitors. thanks

Your ideas sounds like you're on the right track, think its time to prototype to get the right capacitor

I have made it (with a PIC processor) Power to a small capacitor to an interrupt pin and to a diod after that a big capacitor powering the uC.

Pelle

Nice. I’ll do it on a PCB already, but will put a socket for the capacitor to see which value is enough and safe. Thanks

edit: in this case, what’s the diode for?

The diod are to separate the “shutdownpower” from the big backup capacitor.
Pelle

Schema .jpg

I see, thanks. With the voltage divider you would have like 2,5v at the interrupt pin right? Will the interrupt pin see it as high? I think i read somewhere that HIGH for digital pin is > 3,3v , i don't know if it works the same for interrupt pins, then again, you did it for a pic.

PIC have the old TTL levels. Perhaps you have to modify the divider, but look up, Vcc is not 5 volts, it's about 4.4 volts.

Pelle

Hey. Just to let you know Pelleplut, I got it working just now with your help, only changed the voltage divider values. Thanks

The correct way is to use a comparator with hysteresis to compare a sample of the supply voltage with a fixed voltage (say from a zener or the 3V3 supply), and use the comparator to generate the interrupt, that way you get a clean transition, and no multiple pulses.

You might even be able to press the built-in analog comparator into service if the relevant pins are available.

MarkT: The correct way is to use a comparator with hysteresis to compare a sample of the supply voltage with a fixed voltage (say from a zener or the 3V3 supply), and use the comparator to generate the interrupt, that way you get a clean transition, and no multiple pulses.

You might even be able to press the built-in analog comparator into service if the relevant pins are available.

I wonder if that diode would affect the arduino overall performance, I mean, vcc will be 4,4v or so and not 5v... I will check that comparator solution