pulse output on optoisolator state change.

Thread Starter

robinscottlawrie

Joined Feb 15, 2018
35
HI All, im trying to create a simple circuit that will trigger a relay for 1 second (or thereabouts) when the mains power goes out (or comes back..)

the relay will trigger a wifi connected momentary switch and send an alert to my phone.

this will be very useful, as power often goes out here, usually just after weve left on holiday, and we come back to a rancid fridge.

given an alert i can ask the neighbours to reset the circuit breaker etc.

i have a ups with a 12v output that will be powering this circuit, plus the wifi switch and my router.


i found the basic circuit i was looking for here:

http://discuss.littlebits.cc/t/how-...ulse-when-the-input-is-a-constant-on/23894/41

which, assuming it works, would be an ideal starting point, as i have all the components.

the mains sensing part i took from an earlier project i discussed here, which i currently have in use. an ac optoisolator with a 220k resistor to bring the mains level down. id like to reuse this as i have a few of the optoisolators left over.

anyway, long story short, i took the suggested 555 circuit into ltspice, and modified it to include the optoisolator portion of my earlier circuit.

surprise! it doesnt work.

i get zero on the output for the first circa 2 seconds, then it goes high and stays there. doesnt seem to be affected by the input state change at all.

as you can tell im a noob!

attached, a screengrab of the ltspice circuit, and the ltspice file.


any help most appreciated!

thanks, Robin.
 

Attachments

Thread Starter

robinscottlawrie

Joined Feb 15, 2018
35
ahh thank you very much for the fast reply. most appreciated.

i see youve added a reasonable amount of components to the circuit, could you (if you have time) give me a brief walkthrough of what is going on?
 

Thread Starter

robinscottlawrie

Joined Feb 15, 2018
35
ha.. great. that does look rather simpler. does of course mean id need to buy (probably 50) of those chips online..

i notice that the specified chip is a quad gate. not expensive i see, but 3 redundant parts. does a single xnor exist so i can keep things as compact as possible?
 

crutschow

Joined Mar 14, 2008
34,281
i notice that the specified chip is a quad gate. not expensive i see, but 3 redundant parts. does a single xnor exist so i can keep things as compact as possible?
I know of no single CMOS XNOR gate chip.
Why do you want it to be so compact? One 14-pin DIP is not that large.
Certainly the layout won't be much larger than the other circuits.

But that reminds me to mention that all the unused inputs must be tied to ground, or possible overheating damage to the chip can occur.
 

Thread Starter

robinscottlawrie

Joined Feb 15, 2018
35
ok youve got me, i have an obsession with making things as small and efficient as possible. i like your solution for that reason. i just need to check if i can find those chips in small quantities for a sensible price in Italy.. otherwise ill stick with the 555 version as i have a bag of those, and all the other bits to hand.
 

Thread Starter

robinscottlawrie

Joined Feb 15, 2018
35
ok, first attempt. distrelec Italia. 29 cents for the chip, 14 euros shipping, and 3 euro 50 tax. ahahaha...haha. cry.


second, mouser, 49 cents for the chip, and 20 euros shipping with fedex.


ahh how i miss the local electronics shops of my youth.
 

Alec_t

Joined Sep 17, 2013
14,280
could you (if you have time) give me a brief walkthrough of what is going on?
Sure.
When mains powers on, the optos short C2, thus giving a negative pulse via C3 and D2 to the Trig pin of the 555.
When mains powers off, C2 charges up and Q2 turns on, thus giving a negative pulse via C1 and D1 to the Trig pin.
When the 555 is triggered its pin 3 goes high, turning on Q3 and hence Q1.
R5 pulls the Trig pin back high.
 
Top