PDA

View Full Version : Without resetting....Switching PIC over to Backup Battery



financecatalyst
- 21st December 2010, 22:47
I am trying to make a timer which will normally be plugged into the mains socket during normal operation. It has a 16F877A & one 16x2 LCD module. LCD module is powered by the PIC itself.
I would like to ask if someone has a good design or an idea to put PIC on backup battery power as soon as there is a mains powercut without resetting it. I will be using an smps delivering 12V to 7805 which will give 5 V to my PIC.
Through one resistance from 12V, PIC will know about the powercut and will switch OFF the LCD & turn it back on when power returns.
I have 3V backup plan (2 x AA) (NON-RECHARGEABLE). Can someone help me put it together so PIC can jump straightaway to 3V & back to 5V when power returns.

Archangel
- 24th December 2010, 06:14
Hi financecatalyst,
If you can suffer a .7 volt drop, why not just use 2 diodes, one on the battery and 1 on the mains fed supply, the pic will draw from whichever is outputting the highest voltage. No reset. as for the other stuff, sense the mains fed supply with an analog port, or heck even a digital port (if power then main loop) and jump to the disabled routine if not true.

ScaleRobotics
- 24th December 2010, 19:13
Hi financecatalyst,
If you can suffer a .7 volt drop, why not just use 2 diodes, one on the battery and 1 on the mains fed supply, the pic will draw from whichever is outputting the highest voltage. No reset. as for the other stuff, sense the mains fed supply with an analog port, or heck even a digital port (if power then main loop) and jump to the disabled routine if not true.

The January 2011 Nuts and Volts magazine shows a simple example using exactly that. They let people embed it into blogs and such, but I am not sure it will be visible without a subscription.

<table border="0" cellpadding="0" cellspacing="0"> <tbody><tr style="background-color: rgb(210, 210, 210); height: 30px;"> <td><img class="navlogo" src="http://n-cdn.dashdigital.com/nutsvolts/include/icons/navbar_logo.gif?lm=1292898564000" alt="Nuts &amp; Volts" align="left" height="28"> </td> <td style="color: rgb(102, 102, 102); font-weight: bold; font-family: tahoma,sans-serif; font-size: 11px; line-height: 15px; padding-right: 5px;" align="right"> <span id="top_right_text">Look inside &gt;</span> </td> </tr> <tr style="background-color: rgb(255, 255, 255);"> <td colspan="2" style="padding: 10px 0px;" align="center"> <a href="http://nutsvolts.texterity.com/nutsvolts/201101?pg=41" target="_blank" onclick="window.open('http://nutsvolts.texterity.com/nutsvolts/201101?pg=41','sharewidget','toolbar=no,menubar=no ,resizable=yes,scrollbars=yes,left=0,top=0,width=' +(screen.width-10)+',height='+(screen.height-10)+'');return false;" title="View Magazine"> <img src="http://n-cdn.dashdigital.com/nutsvolts/201101/data/imgpages/smtn/0041_wdxmxd.gif?lm=1292898564000" alt="41" border="0"> </a> </td> </tr> <tr style="background-color: rgb(210, 210, 210); height: 30px;"> <td colspan="2" style="color: rgb(102, 102, 102); font-weight: bold; font-family: tahoma,sans-serif; font-size: 11px; line-height: 15px;" align="center"> <span id="bottom_text">January 2011</span> </td> </tr> </tbody></table>

financecatalyst
- 28th December 2010, 19:17
Thanks for the answers. I checked the Nuts&Volts article, it actually uses 9V battery before 7805. I am using 3xAA, which puts 7805 out of picture.
I tried it with 2 diodes, what capacitor values & what types should I use to minimise current consumption as well and where should I place them to avoid resetting. I will check it on my breadboard before making my PCB and setting it there.
Currently it is still resetting, I tried it with few random capacitor values but no success.

Currently on my breadboard, one 4007 is attached to 5V line from 7805, and one from 4.5V battery set.

El_AMPo
- 29th December 2010, 01:30
Try only feeding the pic with a 1000uF capacitor when the power is cut and the switching from main to battery takes place.
How? leave the two diodes but after the regulator one for the battery, other for the regulated supply, add a 1000uf capacitor before the pic and raise the regulator voltage to keep the 5V

"...maybe could work" circuit diagram:

http://img522.imageshack.us/img522/5413/batterybackup.jpg

Is a good practice to make a power supply detection signal with a voltage divider or another diode after the regulator.

Also if i'm not wrong 16F877 will not work under 4.0 volts but similar ones work happy up to 2,0V like the LF version, saying that. change: or your pic, or your battery, or maybe a "low drop" diode will do the trick

financecatalyst
- 29th December 2010, 14:23
The problem was BOD, once switched off it worked with just 1000uF at the supply.