Page 1 of 1

Relay - can it be used in reverse (signal microcontroller) ?

Posted: Thu Aug 23, 2018 8:05 pm
by DaxTrajero
Newbie alert: Is it possible to use a mechanical relay that, when there's an AC voltage, switches the DC side of the relay? ie. someone turns on a light, and the raspberry pi is signalled

Or is the alternative to use a solid state opto-coupler and resistors?

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Thu Aug 23, 2018 9:03 pm
by PhatFil
you can use a 'Power Relay' I think thats the term? A relay that switches on with an AC mains voltage instead of a logic circuit level of dc voltage.

most if not all such relays you will find wil be designed for switching ac loads which shouldnt be an issue as long as you dont employ a ssr (solid state relay) tho i dont think 'power' ssrs are very common..

mechanical/magentic coil relays rated for ac loads will be fine for switching a low voltage dc load, its the other way round you want to avoid.


try sticking "240v ac coil power relay" along with 'SPST' (single post single throw) in your shopping searches..

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Thu Aug 23, 2018 10:02 pm
by drgeoff
You need to use a relay that is specifically intended to work with AC on its coil. Most relays will "chatter" if energised with mains frequency AC. There is not much difference between the coil of a relay and the coil of an AC buzzer or bell. :)

https://www.techwalla.com/articles/diff ... relay-coil

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Thu Aug 23, 2018 10:37 pm
by Brandon92
Hello,
There are indeed special relay for this kind of interface. In the document search for "MasterINPUT". And the overal name for this kind of relay is "Relay Interface Modules".

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Wed Sep 11, 2019 10:11 am
by boyoh
One safe way to interface the light to give the
Pi a input, would use a 5vdc power adapter
On the lighting circuit. Then use the 5vdc to
Give a 3.3v Pi input using a voltage levelling
Circuit , You could use a potential divider
Or opto isolator or a transistor, the choice
Is yours
Regards BoyOh

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Wed Sep 11, 2019 10:25 am
by davidcoton
boyoh wrote:
Wed Sep 11, 2019 10:11 am
One safe way to interface the light to give the
Pi a input, would use a 5vdc power adapter
On the lighting circuit...
Except very few lighting circuits have provision to connect power adapters -- certainly UK lighting circuits should not normally have 13A sockets (because they cannot supply 13A).
If you go this way, get help from a qualified electrician.

EDIT: add "UK". Detailed advice will vary between countries.

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Wed Sep 11, 2019 12:25 pm
by ElEscalador
You could certainly use a relay with a 100vac coil like this one https://amzn.to/2NVr0RV and monitor the contacts as you would any switch - I do it all the time for different reasons but I also worth with and control voltages up to 480 3 phase for a living.

I think the above is is on the right track and safer that you can use a number of methods to detect the light. Here is one module that is prettty much done for you - or you can buy a phototransistor/photoresistor and DIY a circuit if you wanted to learn more about how they work. But here is a module that should work https://amzn.to/2LqjDQH

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Wed Sep 11, 2019 4:51 pm
by Burngate
ElEscalador wrote:
Wed Sep 11, 2019 12:25 pm
You could certainly use a relay with a 100vac coil like this one https://amzn.to/2NVr0RV
Unless you're in Britain, or Europe, or other places with 230V AC

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Wed Sep 11, 2019 7:19 pm
by boyoh
Witch ever way you use to implement this
Project, means connecting to the AC mains
Other than using a light sensor circuit
The AC mains part of the project
Must be done by a electrician ,

Regards BoyOh

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Thu Sep 12, 2019 12:01 am
by ElEscalador
Burngate wrote:
Wed Sep 11, 2019 4:51 pm
ElEscalador wrote:
Wed Sep 11, 2019 12:25 pm
You could certainly use a relay with a 100vac coil like this one https://amzn.to/2NVr0RV
Unless you're in Britain, or Europe, or other places with 230V AC
Very true - my bad. I can't help it - as an American, I was raised that we're center of the universe. Also our new thing is to refuse to correct or acknowledge mistakes, so if everyone will just pretend that 100vac is not a typo that'd e great. Don't make me take a marker to some textbooks to prove how correct I am.

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Thu Sep 12, 2019 8:36 am
by boyoh
davidcoton wrote:
Wed Sep 11, 2019 10:25 am
boyoh wrote:
Wed Sep 11, 2019 10:11 am
One safe way to interface the light to give the
Pi a input, would use a 5vdc power adapter
On the lighting circuit...
Except very few lighting circuits have provision to connect power adapters -- certainly UK lighting circuits should not normally have 13A sockets (because they cannot supply 13A).
If you go this way, get help from a qualified electrician.

EDIT: add "UK". Detailed advice will vary between countries.
I was hoping someone with common sense
Would understand that an electrician would
Be able to make safe connection to the existing
Lighting circuit for him to fit the power adapter
It then would be solid state no relays,

Regards BoyOh

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Thu Sep 12, 2019 12:26 pm
by davidcoton
boyoh wrote:
Thu Sep 12, 2019 8:36 am
I was hoping someone with common sense
Would understand that an electrician would
Be able to make safe connection to the existing
Lighting circuit for him to fit the power adapter
It then would be solid state no relays,
In my time working as an electrician I have learnt that, unfortunately, common sense is not always available.
Advice given on this forum with respect to mains connections should never assume that readers (not only the OP) have any understanding of the dangers involved.

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Thu Sep 12, 2019 1:08 pm
by boyoh
davidcoton wrote:
Thu Sep 12, 2019 12:26 pm
boyoh wrote:
Thu Sep 12, 2019 8:36 am
I was hoping someone with common sense
Would understand that an electrician would
Be able to make safe connection to the existing
Lighting circuit for him to fit the power adapter
It then would be solid state no relays,
In my time working as an electrician I have learnt that, unfortunately, common sense is not always available.
Advice given on this forum with respect to mains connections should never assume that readers (not only the OP) have any understanding of the dangers involved.
Point taken, we should never assume that a poster
Under stands the danger of working
On mains power, I hope now we can help him
With his low power project. There is to much
Emphasise on Coding than learning electronics
With the RaspberryPi There will be more
Coder then electronic engineers in the future.

BoyOh Retired Electrical / Electronics Technician

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Thu Sep 12, 2019 6:09 pm
by ejolson
DaxTrajero wrote:
Thu Aug 23, 2018 8:05 pm
Newbie alert: Is it possible to use a mechanical relay that, when there's an AC voltage, switches the DC side of the relay? ie. someone turns on a light, and the raspberry pi is signalled

Or is the alternative to use a solid state opto-coupler and resistors?
The difficulty with all the proposed solutions is that they will detect whether the power is on but not whether the light is on. It could happen that the bulb is burned out.

Checking whether the light is on can be done with some sort of photodiode. Fortunately such parts are cheap and don't need to be connected to mains voltages. Given the dangerous uses computers can be put to, perhaps someday coding will, in general, also require a government issued license.

Re: Relay - can it be used in reverse (signal microcontroller) ?

Posted: Thu Sep 12, 2019 8:56 pm
by davidcoton
ejolson wrote:
Thu Sep 12, 2019 6:09 pm
Given the dangerous uses computers can be put to, perhaps someday coding will, in general, also require a government issued license.
No, the issue of licences will be privatised. That way more people can make more money out of the poor coding footsoldier.