need help completing this circuit

OK, so in order to detect power loss, I'm going to try hooking this:
http://www.isocom.com/datasheets/db92449.pdf
ISP814 to my 120VAC, 60Hz line (with roughly 150k of resistors) to limit current.

On the other side, the idea is to connect to one of the Arduino's digital I/O ports, using the pull-up. But I have at least one (possible) issue on that side: the ISP814 is using two inverse, parallel diodes to keep it lit as the AC cycles, but as it crosses zero, I assume neither will be lit. Thus, I think I need a cap and possibly a resistor on the side connected to the Arduino (across the ISP814's pins 3 & 4) to "smooth" the output, right?

Any ideas/help would be much appreciated!
-AJ

Any reason why you are trying to do this at line voltage? You could use the output from a wall wart power supply and work with much safer voltages.

Voltage dividers from the AC line still have the potential to feed you 120VAC if the voltage divider fails. For a safer setup always step it down with a transformer.

For a safer setup always step it down with a transformer.

That's true, of course, and other hints like
-" use resistors on both power wires " or
-" don't setup those resistors on a breadboard, but aways keep the power line and resistors isolated "
-" two 47k resistors in series is safer than a single 100k "
are very bad, because either you don't need them or you should not be encouraged playing with mains :wink:

That said, you can either smooth the signal on pin 4 electrically or have a "software solution" :
Power is OFF when digitalRead gives HIGH for more than ~10 millis
You could even use the pulse frequency to compare the accuracy of Aduino's clock with the 60 Hz supply ...

Or use an optoisolator. Have your voltage divided down/rectified AC driving an optoisolator, monitor the other side with the input.

Well, if you consider durability and costs, two (roughly) 75k resistors connected on either side of the 120VAC should far outlast a transformer, which also costs additional money and requires resistors anyway to reduce whatever the output is to < 5VDC. Also, this project won't have an AC receptacle to plug-into, so "wall-wart" is out, though if you exclude the durability and cost previously mentioned, some generic transformer could be included.

CrossRoads:
Or use an optoisolator. Have your voltage divided down/rectified AC driving an optoisolator, monitor the other side with the input.

Forgive me, obviously a novice, but isn't this an optoisolator I'm trying to use?

[quote author=AJ Weber link=topic=102972.msg772818#msg772818 date=1335369373]
isn't this an optoisolator I'm trying to use?
[/quote] Sure. If you've got it already, you can use it. Alternatively, you may look for a cheap single diode optocoupler and add a separate diode or led outside. Especially if you will use the unsmoothened pulses. Half the pulses should still be enough to detect power off.

Sorry, I missed the link in the initial post.

By the way, what will you do when power goes away? Is the arduino seperately powered, battery backed, super-cap, etc?
Or you are looking for loss of power to something else?

to detect power loss

What's the Arduino going to do for you if it detects a power loss?

this project won't have an AC receptacle to plug-into, so "wall-wart" is out

Why?? If you can connect this circuit of yours anyway, what's so difficult about putting a standard jack on the 120Vac side and plug in the wallwart?

Pete

The "project" is being powered by an external, 12v battery that is already present.

If the AC power is lost, I'm going to send a notification (going to experiment with one of the available GPRS Shields).

I understand the idea of stepping-down the voltage from 120VAC. I have an old wall wart here that is currently outputting 5.6VDC. Is there a simple way to connect that to one of my digital I/O ports (via a resistor, I'm sure) and just wait for the pin to go LOW? (Is the 5.6v outside the Arduino's tolerances? Should I use resistors to reduce that voltage further to be safer - in the sense of protecting the board?)

Thanks again for all the ideas/help!

5.6 is a little high, reduce it a little, like to 4.5V, and read it as high/low.

Use a resistive divider to reduce it. Voltage divider - Wikipedia

Connect your gnds so that you have a common reference and use large value resistors so that you don't dissipate a lot of power and burn up the resistors.
10k and 47k would be a good choice but you should make sure the input is really 5.6 volts as it could be higher when it's unloaded ...