1

I just started working with arduinos recently. I'm really interested in working with relays. I would like to turn a desk lamp on and off using an ios app or a web browser button. I have no experience working with relays but I would love to experiment with relays in order to turn a desk lamp on or off based on an external switch in like an IOS app or a browser.

I am wondering what are the risks in relays with arduino ? I would like to switch a desk lamp on or off using a relay but I don't really understand the risks with creating a desk lamp powered using a wall socket and turned on or off using a arduino relay module . What is the worst case scenario if I screw up ? What are the risks and precautions I should take while working with relays and trying to build a relay controlled desk lamp?

I live in an apartment and I am trying to make sure that my entire building does not lose electricity or I don't screw up the electricity in my unit. What are protective measures that I can take to minimize damages while working on this project?

8
  • 3
    What is the worst case scenario if I screw up ? -- You are dead. Your apartment block has burned down. Your family are all dead. The neighbours are all dead. MAINS ELECTRICITY IS DEADLY - YOU NEED TO KNOW WHAT YOU ARE DOING WITH IT
    – Majenko
    Commented Sep 5, 2016 at 22:25
  • What are protective measures that I can take to minimize damages while working on this project? - Get some qualifications in working with mains electricity.
    – Majenko
    Commented Sep 5, 2016 at 22:25
  • 2
    I'm sorry but your response is not helpful at all. I've been going over tutorials and it does not seem that difficult. I kind of wanted some tips and advice on common errors people make and maybe some good precautionary measures from people who have been working with relays for a long time. Please be more specific as to what constitutes as "qualifications with working in mains electricity". I am currently in upper year for an undergrad program for electrical engineering and I am sure I will be able to follow through or search the web a little more to understand your tips or advice Commented Sep 5, 2016 at 22:32
  • I am currently in upper year for an undergrad program for electrical engineering - You're way more advanced than 99% of the people that visit here then. Most would succumb to "Darwinism In Action", hence the big warnings I post whenever mains is involved.
    – Majenko
    Commented Sep 5, 2016 at 22:36
  • 2
    I prefer to use wireless remote control outlet switches, and connect a 433mHz transmitter to the Arduino. That way I can switch AC appliances on and off, without ever having to touch any of the mains electricity stuff.
    – Gerben
    Commented Sep 6, 2016 at 9:13

3 Answers 3

3

Basic safety precautions:

  1. Always fully unplug the lamp before working on any wiring, even when working with the low-voltage side of things.
  2. Invest in a proper enclosure and follow the rules of insulation and earthing: if the enclosure is metal or has exposed metal they have to be earthed. If it is plastic it is insulated and there is nothing to earth (plastic is best).
  3. Use nylon bolts etc when situated near mains voltages.
  4. A proper relay module with good screw terminals is recommended.
  5. Do not tin your mains wires when screwing them into a terminal block
  6. Do your mains wiring with your left hand in your pocket (an old electrician's trick: if you should get a shock the path to earth is down the side of your body and through your foot. If you have your left hand touching something the path to earth could well be straight across your chest, through your heart, and down your other arm, killing you. It has saved my life a few times...)
  7. Keep mains voltages and low-voltage areas separate. Cable ties and self-adhesive nylon cable tie pads are great for keeping cables where they should be.
  8. Shield any exposed mains connections from touch. Things like the underside of the relay module where the terminal blocks are soldered, that sort of thing.
  9. Don't let the relay module wave around loosely. Keep it well secured in the enclosure.

I'm sure I could find more tips if I tried :)

The main thing to remember is that mains electricity is deadly and should be treated with the utmost respect.

For the ultimate in safety though you could get an isolating transformer. This separates your work from the main supply and means that the only way of getting a shock is by actively touching both outputs of the transformer at once - something you're not really likely to do - and even then it's usually a very localised path for the electricity (through a finger or two).

Adding an ELCB to the lamp's plug (if it is earthed) can be a good precaution while you are working too - and making sure the socket is connected to a ring main that is protected by an RCD is pretty much essential (in the UK it is the law that all ring mains are protected by an RCD - I would hope the same is the case where you live).

1
  • Thank you very much for your help :) Really appreciate it Commented Sep 9, 2016 at 1:42
1

Read through the Sparkfun Beefcake Relay Hookup Guide. It points out many things to keep in mind.

The kit is quite good, I just finished putting one together to control a humidifier off an Arduino with a DHT-11 to keep ambient humidity within a range.

As people have posted, don't ever do any work while the mains are plugged in!

In your project, you'll be able to test the relay without the mains being plugged in, the relay will make a nice "clicking" sound and if you use the "Beefcake" kit, an LED will light up when the relay is "on".

Be sure to have everything in a "housing" and not flopping around. They sell blue plastic junction boxes for about $1 which is what I used. A GFI or GFCI socket is safer to use, though more expensive.

Good luck!

1
  • Thank you very much for your help :) Really appreciate it Commented Sep 9, 2016 at 1:42
-1

this is andrew. I saw your Question. Relay's are not even risky Electronic device , it can be controlled by 5v or 12 v.

On behalf, you can just run your simple led blink program to Start up your relay. Just use the Default (13th) pin for relay input. Run your Code. If your code runs successfully, the relay activates, led in the relay will light up and as well as Your default Led also light up in your arduino Board. After that you can give the output 220v power to control electronic Devices. if any doubt just ping me.

4
  • Working with mains is not risky? Really?
    – gre_gor
    Commented Aug 1, 2018 at 13:23
  • Really, its not Risky. But Be Carefull On Dealing with Current. Commented Aug 2, 2018 at 5:16
  • But, screw it up well the power (110v-220v) to the relay On Common and Normally Open or Normally Closed Pin. Commented Aug 2, 2018 at 5:17
  • Be, Sure there is no short Circuit. Commented Aug 2, 2018 at 5:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.