PDA

View Full Version : Detect Power Failure



koossa
- 12th April 2009, 19:47
Hi Picers

What would be the easiest way to detect a power failure using a PIC?

Thank you

Koossa

mister_e
- 13th April 2009, 00:12
You'll need to be more precise in your need. What kind of power failure?

If you want to monitor the PIC itself, you may look some STATUS register bits.

koossa
- 13th April 2009, 07:16
I've got 2 remote PCs, one that runs on a power backup and one that's connected directly to the electricity.
I just want to be notified when there is a power failure, so the pic needs to be connected to the "power backup pc" and when the power drop, it must send something to the PC via RS232 and the PC must send me an SMS or email.
I will run the PIC from battery, but how do I easily detect when the power drops?

Thank you!

BobP
- 13th April 2009, 09:07
Hi,

I would detect the 5v from the PC's USB socket. When 5v disappears check again for about 400mS to allow for spikes then send your serial data to the other PC.

Bob

koossa
- 13th April 2009, 09:38
Great!
I would try it!

koossa
- 13th April 2009, 12:18
Will I use a Transistor to detect power on the USB Port?

BobP
- 13th April 2009, 12:47
Hi,

If you are going to use a seperate 5v supply say the 5v from the other PC I would strongly recommend using an optocoupler to monitor the 5v.

Bob

koossa
- 13th April 2009, 13:26
Thank you!!

mister_e
- 13th April 2009, 16:17
What happen to the USB power rail if someone reboot the computer or shut it down for a short period of time (if at all possible or allowed)?

In this case a simple wall-wart transformer would do the job too.

koossa
- 13th April 2009, 16:40
Mister_e

Would I still use the optocoupler if I rather want to use a transformer?

Thank you

Koossa

mister_e
- 13th April 2009, 20:28
No real need for an opto-coupler in that case.

aratti
- 13th April 2009, 21:16
it must send something to the PC via RS232 and the PC must send me an SMS or email.

koossa, The SMS IO Controller will do what you need sending via sms the status of the inputs every times there is a change. Download the project at this link:
http://techni.caliti.es/blog/2008/12/sms-io-controller.html

and read the manual to see how to use it.

Al.