0
\$\begingroup\$

In my AVR project, I need to measure input voltage (before buck converter), and check for power loss to quickly save some data to EEPROM.

Measuring input voltage is just to display its value, but I am considering using the same voltage divider to generate external interrupt to save data to eeprom.

Is the schematic below correct and will it do the job?

enter image description here

PWR_DWN goes to my INT pin(pulled down).

\$\endgroup\$
  • \$\begingroup\$ I can't guess what you think the diode is doing for you. If you're already regularly sampling the input voltage, then why have it trigger a separate interrupt at all? Perform the shutdown action when the reading gets too low. \$\endgroup\$ – Olin Lathrop Nov 30 '16 at 15:46
  • \$\begingroup\$ I just want to save my data before I turn off supply voltage and have no idea how to do this best. \$\endgroup\$ – pablos91 Nov 30 '16 at 16:55
  • \$\begingroup\$ Then you should say that in the question and not ask about a particular solution you came up with. \$\endgroup\$ – Olin Lathrop Nov 30 '16 at 17:13
0
\$\begingroup\$

Since you are already regularly sampling the input voltage, you don't need any more hardware. The information about the input voltage is already available to the firmware as things are now.

You do have to sample the input voltage "often enough". Every 1 ms (1 kHz rate) is probably plenty fast enough. That's a rather slow rate to run the A/D at, so should not represent much burden. Each sample, compare the new value to some minimum threshold. If it is below this threshold, then set a flag or whatever you do so that the shutdown sequence is eventually run. Since you probably have 10s of ms of time at least before power is lost, sampling every 1 ms should be good enough.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.