I would like to try to turn on a light plugged to the main using a 2 channels 5v relay (SRD-05VDC-SL-C). This very useful video on the relay module explains it well but I'm still a bit scared as I never worked with Main and would like not to die or burn the house down if possible.
On the trigger side, I seem to be able to use the arduino 5V and a pin to trigger the switch of the relay (apparently it needs no more than 20ma).
On the other side, I'm not sure how a light bulb would be wired onto the relay module. It's not just Gnd and live; it's Live, Neutral and Gnd.
Would it be Live<-->NO, Neutral and Ground<-->COM?
It's not just Gnd and live; it's Live, Neutral and Gnd.
Would it be Live<-->NO, Neutral and Ground<-->COM?
Not unless you want to blow the fuse (or trip the breaker) for the 220vac and vaporize the wire all in one shot.
FYI,
It's not called "Live". It's called either "Line" or "Hot".
The ground is not related to the control of devices . It is there for your protection. The ground is supposed to be the point YOUR chassis
(metal box) is connected to so if you have a loose wire and you touch the box you won't die. Your arduino doesn't HAVE a gound., IF
you install your arduino in a metal box then the green ground wire should be terminated on a screw attached to your box to meet electrical code standards for safety.
The Line and Neutral which carry 220 volts
The Neutral is NEVER SWITCHED ! (Don't do it ). The Neutral wire goes DIRECTLY to the white neutral wire of your light.
The LINE from the facilities power (wall) goes to the COM and the Line from the Light (LOAD) goes to the N.O. contact.
FYI. ,
Using a physical contact relay to switch HVAC is not a good practice but by itself does not constitute a safety violation. It is not a good practice because there will ALWAYS be some degree of arcing when switching ANY AC LOAD UNDER POWER. (That means turning the device OFF, as opposed to turning it ON.)
You can verify this for yourself without any lab equipment.
The catch is you can't use a lamp or light for the load because you need to have the load ON in a dark room . (think about it)
Plug a load into an outlet. Turn ON the load. Turn OFF all the lights in the room so it is dark. Put your hand about 10" AWAY from the plug and pull the cord and plug from the outlet in the dark WHILE the load is switched on and under current (like a motor or fan or any thing but a light). At the moment that the plug begins to leave the outlet , the electrons will jump across the gap as the contact separates from the blade in the outlet. Electricity travels at 1/100the the speed of light so it is plenty fast enough. As the gap increases,
the arc which occurs across the gap as the contacts separates is actually plasma. You will see a flash as you unplug the device. This is what will occur inside the relay every time you turn the light OFF, but NOT when you turn it ON. If you operate the relay with a non-light generating load in a dark room you will see the flash inside the blue plastic case of the relay. The relays are rated for "n" number of cycles and I have been told that it is safe to ignore the arc because it is harmless and the only effect is that is erodes the contacts gradually over time requiring the replacement of the relay after some number of thousand cycles. The arcing can be supressed using a "snubber" circuit but it probably isn't necessary for just a light. Personally , my choice would be a solid state relay because there is no arcing because it has a zero -crossing detector inside and only switches states at the ac waveform zero crossing point.
Also , whenever buying SSRs on ebay, ALWAYS LOOK AT THE SPECS !
There are MANY DC SSRs as well, and there are also 120vac AC SSRs so there are about ten ways to screw up when ordering an SSR online.
So if I understood well, it is safe as long as I wire this properly. The arc effect is also safe, but the relay will stop working after x amount of times switching the lamp off. What would happen when the relay reach it's maximum number of cycles? Would it just stop working? Is it still safe?
For the wires, 'line' coming from the wall socket goes to COM and the 'line' coming from the lamp goes to NO. Gnd and Neutral stay wired to the lamp as normal.
Is the advantage of a Solid State Relay just to not have the arc and therefor have a relay that will last longer?
A solid state relay can last 200 years.
A relay switching 220vac maybe several thousand cycles. If there are 365 days in a year and you switch the light 3 times a day , and the relay is rated for 3000 cycles, it would last 2.7 years. When it fails , it fails because it is eroded and the metal is no longer making a good contact. The problem here is that if you run a simulation program that simulates the physical erosion of the metal, at some point in the simulation the metal in the CLOSED position is NOT making good contact but is SO CLOSE to making contact that the electrons can jump across the gap based on the equation:
Voltage (V) ionization of air = 1,000,000 V/per meter (The voltage at which air spontaneously ignites)
rearranged and solve for distance (d) in meters at which air ignites at a voltage of 220Vac :
220Vac (is to) as x 220vac
-------------- -------- ===> x = --------- === 0.22 mm == 220 um (micrometers)
1,000,000 V (is to) 1 meter 1,000,000 V
Which is to say, when it fails it will begin arcing and WILL NOT STOP ARCING until the power is turned off or the plastic case melts from the heat generated by the plasma of the arcing. If you want to find out what happens that why don't you connect a load to a plastic relay and switch it every 100 ms around the clock continuously until it reaches the failure point and see if the plastic catches fire and bursts into flames.
Compare this to an SSR that can operate safely for 200 years. (let's say for some reason you don't live 200 years. If you only lived another 50 years, then the $10 SSR would cost you [$10/12 months per yr]/50 years = 1.6 cents. (US)
For the solid state, I'm guessing I'm going to need to find a module as I rather have something ready-made on this one.
I'm sorry but I don't know what you are saying here. I can't tell if you mean you plan to use an SSR or if you are saying you have something else planned. I think you mean the latter but not sure.
As far as the wooden box is concerned, I guess if you don't think it is going to burst into flames it should be fine. You do know that's why they use metal boxes for electronics , right ? Have you ever seen a chip burst into flames ? I have. I made the mistake of using a 10 A 12V
power supply for a little tiny circuit that had one 8-pin chip because I didn't have a smaller supply available. I was probing the chip with a DMM to measure the voltage and the meter probe slipped off a pin and landed between two of the pins and shorted the output to ground. Since the power supply was rated for 10 A, instead of just shutting down like the arduino onboard 5V regulator , it supplied as much current as the chip demanded and the chip immediately started GLOWING RED and then a little flame shot out of the middle of it.
Great fun ! But since your only using 220vac you should be ok...LOL
raschemmel:
Great fun ! But since your only using 220vac you should be ok...LOL
Haha, ok I get it. Metal box it is then. I still need to put that metal case inside a big wooden box. I probably need to look into that to now.
For the Solid State Relay I meant that at the moment I have the 2 channels 5V relay module, that thing has all the transistor, resistors, etc.. build in. If I use a Solid State Relay I'm guessing it's not just a matter of wiring it straight in with my arduino and light. I will do some researches on that.
I'm looking at the datasheet for the relay (Download - Parallax). The cycles seems to be 107 for mechanical use and 105 for electrical.
So that's 10 000 000 mechanical and 100 000 electrical. Not sure how to relate to this but 10 000 000 mechanical movements is roughly 27 000 times a day for 365 days. For electrical it would be 273 times a day for 365 days. I know it's not future proof but hey ho, just wanted to mention it, if you do a project that isn't made to last (e.g: short exhibition), that sound pretty good.
I'm also surprised there's not a security system inside that module in case you reach that limit.
a Relay is a great little device. the relay has 3 separate voltages associated with it. And it is an isolation device. the fact that it is an isolation device is one of the great benefits of it.
the relay itself consists of a a coil as the driving part of the device. When the coil is energized, it 'pull in' the contacts.
think of your finger as the coil and the little lever on the wall. your finger can move the lever and when the lever moves. something happens on the other side. and you will (should) never know what voltage the 'other side' might be.
in the case of the relay, the part we are most concerned about is the coil. what voltage, what resistance, etc it is because it is the only thing we actually control. I said earlier that there are three voltages. well the coil has a voltage rating, often 12 or 4 volts. and that is all we are concerned about. energizing that coil. so, if we use 5 volts, we can use a wide variety of devices to complete that circuit. since most of us live in the 5 volt world, we need to use a circuit that is based on 5 volts to energize a coil that might be 12 volts. we use an FET or a transistor and then make sure the transistor is fully energized with our 5 volt signal.
if we were to flip the wall around and look at the bits inside the wall. the relay contacts are a totally separate and different animal. they are isolated completely from the coil. in fact, if the relay was rated for the voltage, there is no reason you could not switch a couple thousand volts.
the key parts for your application are more about getting the live wire to the relay and then from the relay. that is were your safety is paramount. if you have to take the lift to you flat, make sure you have a torch and access to the stairs in case you trip a circuit breaker.
as spycatcher2k said, live to 'C" to "COMM" and 'NO' or 'normally open' out to your device. make those connections well .
Think of the coil side as the low voltage side and the contacts side as a snake that will bite you.
keep them separate and Bob's your uncle !
Arduino, 5V relay, 220v: checking I'm not putting myself or others at risks
If you have to ask, you are.
Great input mate
simple logic dictates that if you have to ask, you do no know.
if you do not know, then you are experimenting.
if you are experimenting with something that could kill your or others...
I would offer that using low voltage devices like 12 volt lights and batteries would allow one to gain experience without risk.
finally, most of us know someone who knows about wiring in a house. ask for help and a visit for their inspection.
Arduino, 5V relay, 220v: checking I'm not putting myself or others at risks
If you have to ask, you are.
Great input mate
simple logic dictates that if you have to ask, you do no know.
if you do not know, then you are experimenting.
if you are experimenting with something that could kill your or others...
I would offer that using low voltage devices like 12 volt lights and batteries would allow one to gain experience without risk.
finally, most of us know someone who knows about wiring in a house. ask for help and a visit for their inspection.
True, but taking the time to actually explain why it could kill you can potential stop people from doing it. Little narky comments never stopped inexperience people, on the contrary I would say. I guess that's the difference between people having knowledge and people being able to share their knowledge. Anyways, that comment isn't really important.
Unfortunately I don't know an electrician, I'm also going to look into safer solutions but I think I will give it a go, at least to try it, even if I don't keep that module in my project. I'm sure other people will buy that relay module, and maybe reading that thread will help.
Thanks a lot for all the help. It's nice to learn more about how things work.