Voltage Detector

The relay card has 9V battery, you want it to turn on an LED when 230V that the relay contacts are switching is lost?
How about something like this?
AC from relay comes in, divide it down and rectify/filter it to a reasonable DC level, drive the base of a P-channel MOSFET.
When AC is present, MOSFET is off.
When AC is lost, Gate is pulled low, turning the MOSFET on and lighting the LED.

If not, please clarify your requirement further.

Why not replace led with optocoupler ?

(CrossRoads) thanks for your input that looks spot on :slight_smile: few question:
1 The two first resistor (the divider) what resistances would you recommend? i have had a play with a volt divider calculator but was getting random numbers.
2 i have be using those diodes so do you think they would be adequate? Diode
3 100UF for the capacitor?
4 Resistor next to the cap 10K?
5 do you think this is an adequate Mosfet? Mosfet

Thanks Again

And one more question, if i was using this on multiple relays all switching different phase but with a common 9v would this cause an issue?

Thanks Joe

would this cause an issue?

issue with what ?
what kind of issue ?

I still think replacing the led with an opto-coupler would allow you to put everything under software control instead of requiring a human to view a led.

issue with what ?
what kind of issue ?

The GND will be linking phases together, but obviously through four resistors, could that cause any issue?

I still think replacing the led with an opto-coupler would allow you to put everything under software control instead of requiring a human to view a led.

what software? the end is just an LED.

and how would you make an opto work as there is no neutral?

An opto is nothing but a led driving a phito transistor through an isolation barrier. Tbe output has a pullup resistor and sends a high or low to arduino.

so how would you wire it?

again there is no arduino in this project

"Tbe output has a pullup resistor and sends a high or low to arduino."
More likely Needs a pullup resistor.

so correct me if I'm wrong, on the LED side in replacement of the neutral your using the earth?

More likely Needs a pullup resistor.

Yes, I was trying to explain the concept of an opto.

o correct me if I'm wrong, on the LED side in replacement of the neutral your using the earth?

No. Forget about earth and neutral. What I am about to describe creates an isolated interface from your voltage detector to an arduino input so YOU do NOT need to LOOK at a LED ! The arduino will detect it and the software will deal with it.

Just look at the led you already have. (the one connected across the transistor)
VOLTAGE DETECTOR.jpg

Now remove that. (JUST THE LED, but change the pullup resistor (the one connected to the last transistor) to the correct value for the opto)

Now connect the opto led where your led used to be.
Now connect the emitter of the opto output to the arduino GND
Now connect a 10 k pullup resistor from the collector of the opto output to +5V .
Now connect a wire from the collector of the opto output to an arduino digital input.
You DO NOT NEED TO THINK OR ASK ABOUT THE EARTH OR NEUTRAL.
NOTHING ELSE CHANGES . Everything else in your circuit remains the same. Only the led is gone and the resistor value is changed.
The result , after following the above is an isolated input to the arduino. NO ELECTRICAL CONNECTION TO THE REST OF YOUR CIRCUIT. (unless you are connected to the the arduino GND for some reason).
DO NOT CONNECT 9V BATT GND TO ARDUINO GND !

JUST FOLLOW THE ABOVE INSTRUCTIONS.

right ok i see where your coming from now thanks for explaining that.
just to say again there is NO Arduino in this project so at the end its just an LED, so correct me if I'm wrong again but the output of the opto will still be the wrong way round and it will be pulsing?

thanks again for you input

Ok, no arduino Hmmmn. How did I miss that ?
I guess I have arduino on the brain LOL...
Ok your question about the opto suggests you still don't "get it".
Let's PRETEND for a moment there IS an arduino ( at the "end")
GOOGLE "OPTO COUPLER"
An ooto has an INPUT ( the LED) and an OUTPUT ( the photo transistor)
YOUR DETECTOR has a LED (what a coincidence)
If we REPLACE YOUR LED with the opto coupler led and follow my other instructions, what we wind up with at "the end" , is a microprocessor interface for your voltage detector.

The "point" of your detector is to generate a "trip LED" for the relay card. The simplest way would be an ac relay with a 9V battery powered led connected to the N.C. contacts of the relay so when the mains was lost, the relay would deenergize shorting the N.C. contacts , lighting the led. With no mains , your detector stops pulsing because all of the transistors are off. If the last transistor iis off , then the led across the collector and emitter of the transistor would be ON because the transistor is not shorting the anode and cathode of the led.

. In that case, the arduino ( that we're pretending exists) could detect that automatically using the digital signal coming from the collector of the optocoupler where it is pulled up to 5V by the resistor. But , in retrospect, a microprocessor seems overkill for a led. ( LOL)

Yer normally it does include an Arduino lol

something like this?

NO NO NO !

You violated the FIRST LAW OF OPTO COUPLERS 1

NEVER CONNECT THE INPUT GND TO THE OUTPUT GND !
Remove the LED from across the opto collector and emitter and put it in parallel with opto led
Adjust resistor value of resistor connected to last transistor to something that allows enough current through opto led and physical led which have been placed in parallel.
Remove the connection between the opto led cathode and the opto transistor emitter
Remove the connection from the opto transistor pullup resistor and the 9/v battery.
Connect the opto transistor pullup resistor the arduino 5V
Connect the opto transistor emitter to arduino GND.
NOW , you electrical isoslation.
There is NO POINT IN USING AN OPTO ISOLATOR IF YOU ARE GOING TO JUMPER THE INPUT TO THE OUTPUT . That makes no sense whatsoever because it defeats the WHOLE PURPOSE of an opto ISOLATOR.
By connecting the opto transistor ONLY to the arduino and NOTHING ELSE, the logic signal sent by the opto has NO ELECTRICAL CONNECTION TO THE VOLTAGE DETECTOR because the opto led and the opto transistor are separated by a transparent 5000 V isolation barrier.
If you MUSH have the visual led there , you would NOT put it where you put it because that prevents the opto transistor from sending a logic signal. The led forward voltage would be on the collector of the transistor all the time and you would never get a HIGH (opto led off) or a LOW (opto led ON)

You would put it in parallel with the opto led and adjust the current limiting resistor according to support both leds.

i don't have 5v just the 9v

so the LED is staying in the same place?

so the LED is staying in the same place?

I thought you only posted that last schematic to ask if that is what I meant when I thought there was an arduino, but you said there is no arduino so of course there is no purpose for the opto coupler without an arduino. My last reply was an attempt (not sure if I succeeded ) in explaining to you how an opto coupler works but by your last reply it seems like you thought I was suggesting you add an optocoupler even though you don't have an arduino.
Let's try this:
Scenario A : (no arduino) => thus , no opto coupler
Scenario B : You decide to ADD an arduino to detect loss of mains power and send an RF signal somewhere or send an SMS text message or send an message by internet, then my last reply applies as is .
The physical (visable)led stays where it was, and all the instructions in my last post apply.

Scenario A : (no arduino) => thus , no opto coupler

no arduino

Scenario B : You decide to ADD an arduino to detect loss of mains power and send an RF signal somewhere or send an SMS text message or send an message by internet, then my last reply applies as is .

no just the LED

all i would like to do is light up a LED when i have a lose of power that is it no more lol

going back to the start
this works but the LED works the wrong way round:

so you lot come up with this to reverse the operation of the LED:

but that did not work the LED says on

so need to find a way of solving that or find a better way of doing this

A big problem with this kind of touch switch is that the slightest leakage current in the first transistor is magnified tremendously.