I am trying to design a circuit whereby I use a single power socket of 240v AC to power an arduino and a relay.
I want to ensure that the Arduino is properly isolated. I would prefer to use only a single 240v supply if possible with that powering the relay and the Arduino properly isolated from the relay.
I have attached a circuit where I am unsure of the result:
Is this properly isolating the Arduino?
Do I need to add a second phone charger to power the relay?
Do I need to use 2 240v power plugs - one to power Arduino via a phone charger and another to power
the relay via a 2nd phone charger?
Or perhaps there needs to be 3 240v power plugs - 2 as above and a different one to carry the 240v load?
One power-plug and one power supply is enough. That's assuming everything runs off the same DC voltage, or that your power supply has the right multiple voltages, etc.
Your drawing looks right as long as one of those connections to the light is ground.
A relay is "automatically" isolated. That is, there is no (internal*) electrical connection between the coil and the contacts. If you have a multimeter, you can check that (by measuring Ohms).
Electro-mechanical relays usually need a driver circuit (because the Arduino can't put-out enough current for the coil) and some relay boards (with built-in driver circuits) have additional optical isolation between the driver circuit/coil and whatever is driving it. That's not always necessary but helps to minimize voltage spikes from coil which can sometimes cause glitches in the microcontroller. Typically the optically-isolated driver shares a common ground through the power supply (depending on how you connect & power the relay board) so it's not totally isolated, but the relay contacts are isolated.
A solid state relay is optically isolated, and you can get solid state relays that will operate directly from the Arduino without a driver.
And of course, the power supply/phone charger is (transformer) isolated.
You can wire the contacts to the "non-isolated" part of the circuit so they are no longer isolated. i.e. Relays used in cars are usually switching the same 12V that's running everything else.
If you use an electromechanical relay then you are isolating the relay coil (high voltage) from the arduino by using a magnetic field or if your using a solid state relay then you are also isolating the arduino using light. In both cases there is no physical connection between high voltage and the arduino.
You may need optical isolation of the relay driver circuitry and that means a separate 5V supply for relay(s).
See: THIS PAGE
=======
I see this type of answer a lot but exactly how "separate" does the 5v supply need to be?
In my circuit the phone charger is supplying 5v to the relay and also 5v to the Arduino. Is this setup ok? If I had a second phone charger connected to the same power point for powering the relay then is that more "separate"? Does that result in proper isolation?
If I had a second phone charger connected to the same power point for powering the relay then is that more "separate" does that result in proper isolation?
Yes, that is really isolated. See this diagram that shows how optical isolation works IF the two sides have independent power supplies.
That said, You MAY be OK in your case if the wiring and grounding is well done..
terryking228:
That said, You MAY be OK in your case if the wiring and grounding is well done..
Ok so my understanding is
The phone charger is providing isolation from the 240v AC supply via a magnetic field.
I'm not isolatiing the relay from the arduino since they are powered from the same source.
The danger is that the arduino "might" get a voltage from the coil of the relay that might damage it.
Having a second phone charger to power the relay would protect the arduino in the unlikely event of getting that high voltage.
Since a phone charger is at least 5 times the price of an arduino and I really don't want to use a cheap crappy one to protect against the 240v supply, it seems best to just have one, make sure of good "wiring" and replace the arduino if it gets fried.
The danger is that the arduino "might" get a voltage from the coil of the relay that might damage it.
No, the usual problem is that ElectroMagnetic Interference conducted back to the Arduino causes the system to be erratic and fail (usually without permanent damage).
Symptoms may include:
Lockup of the Arduino controlling the relays and switching. Everything just stops.
Loss of ability to communicate with a PC connected to the Arduino by USB
Noise and erroneous readings on sensors or attached devices when relays or loads are switched
LCD display stops working or displays the wrong characters
terryking228:
No, the usual problem is that ElectroMagnetic Interference conducted back to the Arduino causes the system to be erratic and fail (usually without permanent damage).
Symptoms may include:
Lockup of the Arduino controlling the relays and switching. Everything just stops.
Loss of ability to communicate with a PC connected to the Arduino by USB
Noise and erroneous readings on sensors or attached devices when relays or loads are switched
LCD display stops working or displays the wrong characters
Thanks Terry
I think I now know what to look for and how to deal with it.
If the Ardiuno is erratic / failing then invest in a second phone charger to provide separate power supply to the relay.