User avatar
faramon
Posts: 123
Joined: Sat Jun 11, 2016 8:36 am
Location: Croatia

Controlling light with classic light switch and GPIO

Sat Jun 25, 2016 5:37 pm

Hi,
is there someone that had a need in addition to traditional switches incorporate management of light through GPIO and how shema is look like? It should be combined to make a similar cross-coupling switch.
I have a need to switch light ON and OFF through my standard 220 V classic switch and throught relay 220 V.
I hope I wrote it understandable...
Ideas?
Thank you,
Faramon

User avatar
Jednorozec
Posts: 809
Joined: Sun Nov 24, 2013 2:17 pm
Location: Deposit, NY

Re: Controlling light with classic light switch and GPIO

Sat Jun 25, 2016 6:10 pm

If you need to ask about handling 220V, don't do it!
The most important leg of a three legged stool is the one that's missing.
It's called thinking. Why don't you try it sometime?

User avatar
faramon
Posts: 123
Joined: Sat Jun 11, 2016 8:36 am
Location: Croatia

Re: Controlling light with classic light switch and GPIO

Sat Jun 25, 2016 6:21 pm

Hi,

in theory, handling 220V is not problem when we use opto isolating relay board 250 V / 10 A. Many use it on this way and i prepare these days to connect 220 V circuit throught relay with isolator.
I need to connect relay and 220V switch somehow parallel to switch light with classic switch and with raspbery server. That is my idea.
But why not connect to 220 V relay with opto isolator? Is there a problem in practice? As I said, i have seen a circuit sheme and youtube film where one of raspberry user connect raspberry with relay for open and close garage door.

Faramon

User avatar
davidcoton
Posts: 5130
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Controlling light with classic light switch and GPIO

Sat Jun 25, 2016 10:23 pm

faramon wrote: I need to connect relay and 220V switch somehow parallel to switch light with classic switch and with raspbery server. That is my idea.
But why not connect to 220 V relay with opto isolator?
An opto-isolator will save your Pi, if used correctly. It will not save you or your house from wiring mistakes on the mains.

An ordinary on-off light switch cannot be used in a two-way circuit. The best you can do is that either switch or Pi can turn the light on, but both must be off for the light to go out. You will need a different switch and a changeover relay, together with correct two-way wiring, to make it work properly.
Jednorozec wrote:If you need to ask about handling 220V, don't do it!
If you must do it, get a local competent person (qualified electrician) to do the mains wiring, and to check that it is all safe and legal.
Location: 345th cell on the right of the 210th row of L2 cache

User avatar
faramon
Posts: 123
Joined: Sat Jun 11, 2016 8:36 am
Location: Croatia

Re: Controlling light with classic light switch and GPIO

Sun Jun 26, 2016 8:10 am

Thanx,
i am an middle and high voltage electrician and 220 V circuit is not a problem, i will do it right.
I tought that there is a problem within an relay.
Thanx to davidcoton, i thought so, is not a simple way to do two-way circuit. I will look for some other solution.

Faramon

geoffr
Posts: 89
Joined: Wed Aug 22, 2012 11:25 am
Location: Melbourne, VIC

Re: Controlling light with classic light switch and GPIO

Mon Jun 27, 2016 1:51 am

faramon wrote:Thanx,
i am an middle and high voltage electrician and 220 V circuit is not a problem, i will do it right.
I tought that there is a problem within an relay.
Thanx to davidcoton, i thought so, is not a simple way to do two-way circuit. I will look for some other solution.

Faramon
You could use a SPDT relay together with a SPDT switch - he same way you would wire a two-way switch with two SPDT switches. The only problem I see here is that you would not know the state of the light from the state of the relay. One option is to replace your regular light switch with two momentary switches which are connected to GPIOs on the Pi - one for switching off, one for on. When detect one of those buttons being pressed, set the desired state on the relay (which would just need to be a SPST relay in this case). The software on your Pi would thus always know the state of the relay, and whether the light is on or off.

One other point to keep in mind is that the Pi's GPIOs are 3.3v and can't source much current. You would need an intermediate step (like a darlington transistor) to drive your relay.

Not being an electrician, I would personally stay away from the 220v stuff...

User avatar
faramon
Posts: 123
Joined: Sat Jun 11, 2016 8:36 am
Location: Croatia

Re: Controlling light with classic light switch and GPIO

Mon Jun 27, 2016 7:36 am

Thanks for suggestions...
I bought Raspberry Pi entirely for IoT stuff and the 220V voltage is necessary.
I do not know another solutions for doing IoT.

Faramon

BMS Doug
Posts: 3823
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Controlling light with classic light switch and GPIO

Mon Jun 27, 2016 7:37 am

faramon wrote:Thanx,
i am an middle and high voltage electrician and 220 V circuit is not a problem, i will do it right.
I tought that there is a problem within an relay.
Thanx to davidcoton, i thought so, is not a simple way to do two-way circuit. I will look for some other solution.

Faramon
given that you claim to be an electrician then I would suggest that you use the relay (many SPDT versions are available) and a light switch to make a standard two way lighting circuit.

If you need further hints about using a relay to operate as a light switch then you aren't really an electrician.


Make certain that the relay board that you have is actually safe for use with the voltage as cheap imports may not have safe isolation distances on the board. Also ensure that the relay board PCB tracks are protected from contact by some form of enclosure.
Doug.
Building Management Systems Engineer.

User avatar
faramon
Posts: 123
Joined: Sat Jun 11, 2016 8:36 am
Location: Croatia

Re: Controlling light with classic light switch and GPIO

Mon Jun 27, 2016 9:46 am

BMS Doug wrote:
faramon wrote:Thanx,
i am an middle and high voltage electrician and 220 V circuit is not a problem, i will do it right.
I tought that there is a problem within an relay.
Thanx to davidcoton, i thought so, is not a simple way to do two-way circuit. I will look for some other solution.

Faramon
given that you claim to be an electrician then I would suggest that you use the relay (many SPDT versions are available) and a light switch to make a standard two way lighting circuit.

If you need further hints about using a relay to operate as a light switch then you aren't really an electrician.


Make certain that the relay board that you have is actually safe for use with the voltage as cheap imports may not have safe isolation distances on the board. Also ensure that the relay board PCB tracks are protected from contact by some form of enclosure.
You're right, I went to the Electrical Engineering High School 18 years ago (4 years, with my 15, 16, 17 and 18 years old, now I have 35 years old). Then Maritime Studies, 2,5 years of marine electronics ... Now, more exactly last 10 years I'am Oracle, Clarion and PHP programmer, so that a lot of the basis of Electrical I have forgotten but good part is still here, just need to remember some stuff because I have never worked as an electrician, so, my working practice as electrician is equal to zero...
But, i am not sufficiently well formulated question.... I have GPIO 3,3 V signal from raspberry pi that triggers relay on relay board with an opto isolator and want to connect this relay board with an ordinary switch in combination to switch light on or off from low and middle voltage, something like cross-switch, with switch on wall or my smartphone!

Return to “General discussion”