Author Topic: Power loss detection  (Read 275 times)

0 Members and 1 Guest are viewing this topic.

Offline Jan Audio

  • Frequent Contributor
  • **
  • Posts: 412
  • Country: nl
Power loss detection
« on: March 26, 2020, 04:35:59 pm »
Hi, i have a PIC16F1789 with internal EEPROM, i would like to save parameters on power-down for my new project.
The PIC16 runs at 32MHz, it has 256 bytes to save, with all perihpherals running.

So i have these skottky diodes from ebay : 1N60P
And i have these capacitors : 470UF @ 16v.

Will it work ?
I know i should not use chinese parts, i just have these diodes laying around and wanto use them.

Maybe you suggest another diode type ?
I am going for a 0,3v threshold to keep the chip close to 5v.

Will this capacitor be enough of 470UF ?, i seen a schematic they use 1F.


Is this 1N4007 a special diode for this ?, whats so special ?
Do i have to worry about diode-peak-voltage on power on ?, maybe thats why the 1N4007 is so special ?

I read a byte and compare it so i dont overwrite the same, and have a checksum.

Maybe i need other parts ?
thanks
« Last Edit: March 26, 2020, 04:43:46 pm by Jan Audio »
 

Offline ggchab

  • Regular Contributor
  • *
  • Posts: 229
  • Country: be
Re: Power loss detection
« Reply #1 on: March 26, 2020, 05:09:28 pm »
I am not sure that having a so big capacitor after the regulator is a good idea. It's better to have it before and have the PD signal connected before it.
I don't know where your 12V is coming from but in one of my projects, I use the attached circuit and it works very well. Plenty of time to save data in eeprom. Depending on the load of your circuit, you may have to adapt the value of the capacitors.
(U$3 is the input for a small transformer)
 

Offline Jan Audio

  • Frequent Contributor
  • **
  • Posts: 412
  • Country: nl
Re: Power loss detection
« Reply #2 on: March 26, 2020, 05:37:39 pm »
Thanks

So your regulator only feeds the MCU.
Question : Why do you have more of the same capacitors instead of a bigger one ?

Nice one with the transistor, i could take it from the PSU (15v) input.
I have 15v -> 12v regulator -> 5v regulator (PIC16s, opto, LCD) -> 3,3v regulator (DSPICs)
I should take a seperate 5v regulator for the target PIC16 with EEPROM, then i dont need any diode.

thanks again, i need to think about this.
 

Offline ggchab

  • Regular Contributor
  • *
  • Posts: 229
  • Country: be
Re: Power loss detection
« Reply #3 on: March 26, 2020, 05:47:28 pm »
I used several capacitors simply because I did not have enough space for bigger ones (too high)  :)
 

Offline techman-001

  • Frequent Contributor
  • **
  • Posts: 634
  • Country: au
  • Electronics technician for the last 47 years
Re: Power loss detection
« Reply #4 on: March 26, 2020, 11:06:46 pm »
Hi, i have a PIC16F1789 with internal EEPROM, i would like to save parameters on power-down for my new project.
The PIC16 runs at 32MHz, it has 256 bytes to save, with all perihpherals running.

So i have these skottky diodes from ebay : 1N60P
And i have these capacitors : 470UF @ 16v.

Will it work ?
I know i should not use chinese parts, i just have these diodes laying around and wanto use them.

Maybe you suggest another diode type ?
I am going for a 0,3v threshold to keep the chip close to 5v.

Will this capacitor be enough of 470UF ?, i seen a schematic they use 1F.


Is this 1N4007 a special diode for this ?, whats so special ?
Do i have to worry about diode-peak-voltage on power on ?, maybe thats why the 1N4007 is so special ?

I read a byte and compare it so i dont overwrite the same, and have a checksum.

Maybe i need other parts ?
thanks

There is absolutely nothing special about the 1N4007, it's a common 1 Amp diode rated for 700 volts.

I recommend you just use a DSO to monitor the voltage into your MCU after you cut the electrical power to your device.

If you don't have a scope, use the MCU ADC to do it as it writes the voltage to a terminal on your pc via a UART?

When it stops writing values you also know when it crashed from under voltage etc.

Never guess, always measure :)

Offline ajb

  • Super Contributor
  • ***
  • Posts: 1743
  • Country: us
Re: Power loss detection
« Reply #5 on: March 27, 2020, 04:15:45 am »
For best results, isolate your MCU from as much of your other circuitry as possible, and on detecting a power loss, put any other circuitry you can into its lowest power state (turn off displays, LEDs, etc).  Ideally, stop everything else the MCU is doing and just save what you need to save.  This will reduce the amount of capacitance you need.  Move your power loss detection to the input side of the regulator, that will give you more warning.   It also means that any capacitance on that side of the regulator contributes more substantially to your time to save.  By the time the MCU's rail starts to fall you are going to be very short on time.  Checksum the data so that you can easily detect a failed save.  If the parameters you're saving are configuration, consider saving two copies with a checksum on each so that if a save fails you can revert to the previous values. 
 

Offline Jan Audio

  • Frequent Contributor
  • **
  • Posts: 412
  • Country: nl
Re: Power loss detection
« Reply #6 on: March 27, 2020, 02:01:08 pm »
I need 2 diodes,
1 for the check with small cap,
1 for the power(400mA) with big cap, wich goes into the 12V regulator that powers the project.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf