BMS Doug wrote:
you need a relay with common, normally open and normally closed positions, replace one of the switches in the diagram (below) with the relay. Connect the common position of the relay where the common position of the switch is, run two wires to the other light switch (one to each of the switch contacts, one coming from the normally open relay position, one from the normally closed relay position).
you may need to give your Pi some way of monitoring the other switch, or the light output as it won't otherwise know which position the other switch is in.
In the above drawing the Hot wire is marked as Live, connect that to your existing switch Common (marked C in your picture).dlink377 wrote:
Well, I don't quite understand about it. My electrical skill is so decent (I am a web programmer), I even had minor burn on my hand when soldering the IR blaster circuit that I don't understand at all.
This is a two way light switch
This is a standard relay
Do you mean to connect Common in switch to Common in relay, L1 to Open, and L2 to close? Where do I connect the hot wire from wiring and hot wire to the light?
Where can I find high quality of relay board? I prefer finished product such as the picture above though. If DIY with buying the part if cheaper and provide higher quality I will do it.
I don't understand how to control the relay with the Pi. Usually it is only active GPIO pin so it will send 3.3v, is it the same?
For the monitoring, probably another circuit to detect 230V? Just connect the cable from the light wiring to the circuit so Pi know the light is powered or not. The problem is, I need to pull a new wire (ground) from the light again because the ground wire is directly connected to the light, not passing the switch box.
Thank you for your reply.
That's not completely true, in the UK it is permissible to replace light switches and power sockets without any certification.GTR2Fan wrote:I rather like the red warnings in the first reply, especially in the light (no pun intended) that removing mains light switches and sockets is now strictly forbidden in the UK unless you're a qualified electrician holding the relevant certificates. Not preaching, just pointing it out incase the OP lives in the UK and wasn't already aware.
Thanks. I'll look into that rather than continuing the Chinese whisper that seems to have befallen upon my ears.BMS Doug wrote:That's not completely true, in the UK it is permissible to replace light switches and power sockets without any certification.
Anyone can install a new circuit but it is required that the work is certified afterwards by a Part P inspector.
you are welcome.GTR2Fan wrote:Thanks. I'll look into that rather than continuing the Chinese whisper that seems to have befallen upon my ears.BMS Doug wrote:That's not completely true, in the UK it is permissible to replace light switches and power sockets without any certification.
Anyone can install a new circuit but it is required that the work is certified afterwards by a Part P inspector.
EDIT: That's put my mind at rest! Regulation 12(6A) of Part P seems to cover us from the perspective of ruling in what does need certification, and that anything not covered by that rule classifies as 'Non-notifiable work'. Thanks for the heads-up.
The Solid State Relay doesn't have any NC or NO state connector? How do I connect to the second switch for failover?Richard-TX wrote:Use a solid state relay for controlling mains (120-240) voltages.
Get the correct one and no special interfacing is required. Just hook up to a GPIO pin and go.
Unfortunately I want to use AC, rather than DC. But maybe will use it as background lighting for my TV LED strip. Thanks!hampi wrote:For the LED lights with 12 V DC power supply I have a DIY solution
I understand it now and how it works. One question, how can I find the most durable and safe relay to use? Do you have any suggestion in that? Or can I use SSR as Richard-TX suggested it that I find it better because there is not click noise.I don't want to burn my house down just because of the cheap things.BMS Doug wrote: In the above drawing the Hot wire is marked as Live, connect that to your existing switch Common (marked C in your picture).
connect your L1 to the Normally open position of your relay.
connect your L2 to the normal closed position of your relay.
connect your relay's common position to the lamp (this is your switched live).
Your relay board must be rated to withstand your mains voltage (and you need to be sure that this isn't just a fictional rating, mains voltage isn't a friend of your Pi, or your house if the relay blows up)
Glad to help.dlink377 wrote: I understand it now and how it works. One question, how can I find the most durable and safe relay to use? Do you have any suggestion in that? Or can I use SSR as Richard-TX suggested it that I find it better because there is not click noise.I don't want to burn my house down just because of the cheap things.
I cannot find the 240V relay in the internet to tell the Pi if the light is turned on or off. What is the name so that I can find it easier?
What I know about solid state relays is that:I don't have any experience with solid state switching, by my understanding it's good for the normally open switching but not so good when you want to do normally closed. (Or was it the other way around?).
I will just extend the cable from the switch to a enclosure and replace the switch with two way switch.BMS Doug wrote: Glad to help.
For the relay I would look for an industrial design, but that's me (I don't normal deal with domestic scale electrical wiring).
The monitoring relay should be a single pole (one contact) single throw (common to normally open or common to normally closed, either one would suit your purpose, no need to pay extra for dual throw (common, normally open and normally closed contacts).
Acronym-ise the above. SPST relay
Add your mains voltage to the search term.
For the relay that switches the mains you would need a single pole dual throw (SPDT) relay, possibly a 5v coil (switched by a transistor?).
If you mounted the pi switching device in the ceiling near the lamp you could build both relays and the pi into one enclosure (requires a false ceiling)
I don't have any experience with solid state switching, by my understanding it's good for the normally open switching but not so good when you want to do normally closed. (Or was it the other way around?).
It is cheaper if I compare the SainSmart SSR to the traditional Relay above though, I don't know about quality.Tarcas wrote: What I know about solid state relays is that:
They're more expensive.
They last longer (~1,000,000 cycles as opposed to 100,000 with standard ones.)
They don't make the click that standard ones do.
You don't need the flywheel diode with them since it's not an inductive load.
They tend to fail in an "on" mode. If it fails, it really doesn't matter since you're doing three-way switching. This may be why you understand that they're better for one method of switching than the other. Sorry, I don't know more details about this, or if they fail quicker when left in one mode over the other. With three-way switching, you're likely to use each state approximately evenly, on average, unless you deliberately pay attention to which position you leave your manual switch in so that the relay can remain in the corresponding position.
Assuming that you're modifying a light and switch that already are wired, the main modification that you need are the two (L1 and L2) wires between the relay and switch. You can minimize their length by mounting the relay close to the switch, and reuse the wires that are already running to the power source and the light.I will just extend the cable from the switch to a enclosure and replace the switch with two way switch.
The cable I need to run is: Main live wire, 2 L1 cables, 2 L2 Cables, 2 LiveWires for 2 light, and 1 common AC ground cable. Is that right? Total 8 cables. Any chance to decrease the cable count? since I may need to pull the wire
Well, my soldering skill is the worst you can imagine. You can search in Google for "worst solder" and you can see how my soldering when doing the IR blaster board. If I will do the circuit by myself, maybe I will just order it online, or pay for more experienced people to do it. I cannot risk to solder a board that will drive a main voltage across.BMS Doug wrote:Because you are having an enclosure we can use din rail and and mount the relays, pi power supply and pi onto that.
Alternatively we could design a bespoke circuit board for the application and solder the relays to it. (This would be fairly simple to design and could be printed quite cheaply).
which country do you live in and what voltage is your mains power supply?
Can you tell me which one is safe, durable, and cheap to use? I will only drive one to 4 light. Probably not more than 120W. I will put MCB to limit the current to 1A to 2A in the main (as opposed to 8A current insulation).johndough wrote:Hi
Somewhere earlier I posted something like this...
SOME SIMPLE RELAY KNOWLEDGE
Having worked with mains voltages, and lower, for about 45 years I want to attempt an explanation of how to control equipment etc with relays, digitally or manually switched.
These are my thoughts and views, and not a set of instructions on how to use any of the items or circuits mentioned. Mains voltage can and will KILL if allowed to.
My main relays of choice are Finder (http://www.findernet.com)and Telemacanique (http://www.schneider-electric.co.uk) both widely available from RS & Farnell just like a Pi.
Well, I totally don't understand at all. I am no electrical engineer, and probably this will be the first usage with relay. I only can wire simple light switch and simple electrical in house, but nowhere near to home automation level. Sorry about that.johndough wrote:The convention for naming relays and their terminals or contacts and connections will be:-
KR for a Relay and KM for a Motor rated relay. Coil connections are A1 & A2, for AC/DC.
In the case of multiple contact relays
Com Common 11 21 31 41
N/C Normally Closed 12 22 32 42
NB: Relays without C/O use N/O (13) (23) (33) (43)
N/O Normal Open 14 24 34 44
Above is a 2 pole & 4 pole Change/Over relay connection layout. Using 8 & 14 pins, (3 pole C/O would use 11 pins). Next terminal numbers for an 8 relay board. Lastly a 2 N/O & 2 N/C block
L1 is probably a solution, but I cannot turn off the light if the switch is turned on. The manual switch will be used quite frequent as the relay only for automation, such as night time will turn on outdoor light, day time will turn them off.johndough wrote:Now to veer off slightly and show a relay setup in conjunction with house lighting.
The 3 electric lamps, L1, L2 & L3 shown above are controlled in various ways.
L1: Simply adding a relay contactKR1 (Normally/Open) driven by your Pi will remotely switch the light ON/OFF so long as the local switch is OFF.
L2: Allows ON/OFF locally &remotely (2 way switching) using a Change/Over contact of KR2.
L3: This more complicated circuit has a pair of 2 way switches, with an INTERMEDIATE switch added (you can add more intermediate switches) and a relay KR3 with 2 Change/Over contacts used to replicate an intermediate switch. Giving 4 switching points
I am not experienced at all, so I need more suggestion from the experienced people like you all. In Indonesia, automation system is very rare and probably non-existent. My budget is also quite limited, so I need some cheap but safe, durable, and dependable system.johndough wrote:Therefore adding a Double pole Change/Over relay in a box, controlled remotely by a Pi can switch Domestic house wiring. However it has huge potential risk if you are inexperienced and could damage you and/or your property.
DO NOT carry out any work that is in contravention of your local laws and/or regulations.
These are my thoughts and views, and not instructions, accessing cabling within a property could lead to injury or death for you, and damage to property.
I am modifying existing switch. So if the cable count can be minimized, that will be great.Tarcas wrote: Assuming that you're modifying a light and switch that already are wired, the main modification that you need are the two (L1 and L2) wires between the relay and switch. You can minimize their length by mounting the relay close to the switch, and reuse the wires that are already running to the power source and the light.
If this is a new light and switch, wire count doesn't matter. Running a 4-wire cable is no harder than running a single wire in most cases. Just buy cable that makes sense for your installation. Plus for a new install, you should probably be getting permits and would need a licensed electrician for that anyway.
I prefer buying from RS-Component or Element14, especially Singapore site, as it is more feasible to buy from them rather than buying from local retailer.johndough wrote:Hi
Well I can hopefully help.
You need 2 relays with bases and a box to put them in.
44 Series Page 55 Plug-In Pcb Relays Finder
[Feb 10 , 2014] Relay Price : IDR CALL Min Order: 0
Schneider Relay 230V 50/60Hz Available In Pd. Anugerah Sejati Is Located At Ltc Glodok Ug Floor Of Block C2 No. 2 Jakarta Indonesia
Price : IDR CALL
or something similar.
So if you can find a relay, preferably 2, I can "talk" you thru the install.
1 relay requires more cabling than 2, so you need to choose.
After successfully controlling my TV, STB, and AC system with IR blaster, I want to improve my home automation Pi to control the light switches.
From what I learn I can just bought cheap 5V relay board from eBay and connect the wire directly. But this solution doesn't give any override / manual function in case of error in RPi. I also learn that I can use remote controlled bulbs, but that is quite costly and I cannot use standard switch.
I want a system that can be controlled with Pi and simple light switch. Pi can turn on and turn off the switch, so do the switch. I also take a look two terminal switches, but how the Pi know the light is turned on or off, and there is no two terminal relay available for cheap.
I have no idea what is opto Isolators, I might have to do search on Internet about that first.boyoh wrote: Warning, I suggest any con troll between the Pi
And electronics containing MAINS voltage
You use Opto Isolators , this will give you total
Isolation between the low volts and the mains
Voltage also noise feed back, Also you will have
No need to common the 0v (Ground)
Take great care when working with mains voltages
Unless you know what you are doing
On NO ACCOUNT connect the mains earth wire
To the Pi 0v Ground.
KEEP THE Pi TOTALY ISOLATED FROM
THE MAINS HIGH VOLTS
Well, the price is quite expensive for DIY like this. My budget is only like SGD 10 (Around GBP 5 / USD 8) each relay and the bracket. I don't want to solder it because no experience in soldering, especially main voltage. Also If I use bracket, I can change it easily if the relay is failing (is it possible a relay burned??).
I don't see why it would. If the loop that you use to read the ADC includes a sleep statement (so it's not constantly running but takes a break after reading) it should be fine. You probably only need to read it before you switch the relay, right?dlink377 wrote:But I heard that using light sensor will make your Pi CPU usage around 25%
That's actually a pretty clever solution. You'll only need that and a pair of resistors to make a voltage divider, I think. Plus of course the cable to connect it to the GPIO.I decided not to use Relay for monitoring the AC. I will probably use 5V Adaptor and step it down to 3.3V for Pi usage.
If that's the case, I'd skip the solid-state relays and plan on them burning out every 100,000 cycles. If you're switching a few times per minute, it's only a few months. If it's only a few dozen times a day, that will last a very very long time.My budget is only like SGD 10 (Around GBP 5 / USD 8) each relay and the bracket.
I think I will go with AC small LED and Light Sensor solution rather than relay or 5V adaptor. I think it is cheaper, can last longer, and quite reliable. It is only USD 1.5 for 20pcs (http://www.ebay.com/itm/20PCS-Photoresi ... 3a75b2a9d5). Do I need ADC or just use the technique here (https://learn.adafruit.com/basic-resist ... ll-reading)? I probably need to read it every access to light status and switch page. I don't know how to wire the AC LED safely and durable for few years.Tarcas wrote:I don't see why it would. If the loop that you use to read the ADC includes a sleep statement (so it's not constantly running but takes a break after reading) it should be fine. You probably only need to read it before you switch the relay, right?
Well, a good quality phone adaptor is like USD 5 (http://www.amazon.com/Motorola-Wall-Cha ... ds=Charger), not including the stepdown from 5V to 3.3V. This is also need huge amount of space (multiple charger).Tarcas wrote:That's actually a pretty clever solution. You'll only need that and a pair of resistors to make a voltage divider, I think. Plus of course the cable to connect it to the GPIO.
Well, I also thought that board is quite safe because so many people buying it and it is rated 250VAC 10A, but I won't take a chance that can do harm more than good. These board is so cheap (only around USD 1 each relay) that it is 10 times cheaper than modular solution with socket.If that's the case, I'd skip the solid-state relays and plan on them burning out every 100,000 cycles. If you're switching a few times per minute, it's only a few months. If it's only a few dozen times a day, that will last a very very long time.
Also rather than the brackets, a preassembled relay board is very cheap and easy to wire up. Something like this. I know I've seen people say "those aren't safe to use with mains voltages" but the relays are rated for 250v AC, so I would be absolutely flabbergasted if there aren't boards made using those relays that ARE safe, even if these aren't. Maybe they'll cost more than a couple of dollars, but they should be far less than your solid state + bracket. As a side note, the larger boards (2, 4, 8 relays) aren't much more than the size below, so it might be worth looking into getting a board with more relays than you think you need right now.