Control AC Devices ...
 
Notifications
Clear all

Control AC Devices with Arduino SAFELY - Relays & Solid State Switches

11 Posts
6 Users
7 Likes
3,345 Views
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1053
Topic starter  

Learn how to safely control AC devices using an Arduino. I will show you how to safely experiment with solid state switches and relays. We’ll also build a light-operate relay and a marquis-style light chaser!

Detailed article with code samples: https://dbot.ws/ardac

** I had a few sound issues with some of the experiment scenes, the isolation transformer I was using interfered with one of my microphones, so I had to back it off and apply a sharp 60Hz parametric filter. I apologize if it sounds a bit weird in spots! **

In an earlier video, I showed you how to control DC devices with an Arduino using BJTs and MOSFETs. Today we will learn how to control Alternating Current or AC devices. And, most importantly, I’ll show you how to experiment with AC in a safe and controlled fashion.

Controlling AC using semiconductors is a challenge, as most transistors only conduct current in one direction. One type of semiconductor that will do the job is the TRIAC, which itself is essentially a fusion of two Silicon Controlled Rectifiers, or SCRs.

Another way of controlling AC (or DC for that matter) is a good old-fashioned relay. Although relays have been around for over 180 years they are still a popular and practical solution for controlling AC devices.

One extremely important issue when controlling line-voltage (or mains voltage, if you prefer) AC current is isolation. You need to make absolutely sure that there is no electrical connection between your low-voltage logic circuitry and the high-voltage AC.

An excellent device for achieving this isolation is an optoisolator. This device separates the two circuits with a beam of infrared light, completely isolating them.

Put an optoisolator together with a TRIAC and you have a Solid State Switch, or Solid State Relay (SSR). Combine an optoisolator with a relay and driver transistor and you have a Relay Module. We’ll be using both of these devices with an Arduino today.

Here is the Table of Contents for today's video:

00:00 - Introduction
03:06 - Controlling AC
08:00 - Alternating Current Safety
09:28 - My AC Workbench Setup
12:39 - Using Relays
16:34 - Arduino Light-Controlled Relay
24:29 - Using Solid State Switches
28:43 - Arduino Light Chaser
36:24 - IoT Relay

The last item, the “IoT Relay”, is a commercial product that allows you to safely switch any AC device without having to build anything. It’s certified for use in the US and Canada and is perfect for those who just want to get the job done, or who are uncomfortable working with high-voltage AC.

It also lets you use the Blink sketch to flash a desk-lamp!

Hope you enjoy the video, if you want the sketches I used please see the article on the DroneBot Workshop website at https://dbot.ws/ardac.

"Never trust a computer you can’t throw out a window." — Steve Wozniak


   
Quote
(@kutgv)
Member
Joined: 4 years ago
Posts: 10
 

Hi electronics wizards,

 

I try to switch 2 12V DC LED lights with a SSR (OMRON G3MB -202P https://www.openhacks.com/uploadsproductos/g3mb-ssr-datasheet.pdf) but it does not work. The LED on the board goes on and off but not the connected LED strip. Then I saw on the SSR a reference to AC 240V/2A on the output. Did I make a mistake and can a SSR only switch AC?

 

I will switch to an optical relay module ( ). Can I e.g. switch DC on relay 1 & 2 and 220V AC on relay 3 & 4 independently?

TIA

Mario

PS better to be safe then sorry (and in the hospital ... :S)

PPS tx for this forum where stupid questions are allowed 🙂


   
Inst-Tech reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

Is there some place I don't know about where you can buy the 120VAC to 120VAC isolation transformer for considerably less than $50 and 120VAC to 30ishVAC step down transformer for somewhere closer to $10 each?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
jker
 jker
(@jker)
Member
Joined: 3 years ago
Posts: 82
 
Posted by: @kutgv

I try to switch 2 12V DC LED lights with a SSR (OMRON G3MB -202P https://www.openhacks.com/uploadsproductos/g3mb-ssr-datasheet.pdf) but it does not work. The LED on the board goes on and off but not the connected LED strip. Then I saw on the SSR a reference to AC 240V/2A on the output. Did I make a mistake and can a SSR only switch AC?

DC SSRs exist, but they are distinct devices. If you want to switch DC with an SSR, you need to buy a "DC to DC SSR".

I will switch to an optical relay module ( ). Can I e.g. switch DC on relay 1 & 2 and 220V AC on relay 3 & 4 independently?

Yes, those relay modules should be independent on the "switched" side. If you have the device in hand, you should be able to verify this quickly with a multimeter, checking for continuity between the live and switched pins across the relays. (It is conceivably possible that someone would be silly enough to connect them on the PCB, so you should check)

 

I realized after typing this up that this question was asked a full year ago, but it shouldn't do any harm to put an answer here for others.

"A resistor makes a lightbulb and a capacitor makes an explosion when connected wrong"
"There are two types of electrical engineers, those intentionally making antennas and those accidentally doing so."


   
ReplyQuote
ron bentley
(@ronbentley1)
Member
Joined: 2 years ago
Posts: 385
 

Sound advice throughout and helpful exposition.

Thanks

Ron Bentley
Creativity is an input to innovation and change is the output from innovation. Braden Kelley
A computer is a machine for constructing mappings from input to output. Michael Kirby
Through great input you get great output. RZA
Gauss is great but Euler rocks!!


   
Inst-Tech reacted
ReplyQuote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

@jker and @ronbentley, Indeed, solid state relays (SSR's) are the way to go on AC voltages above 24 volts, but as an interesting note on trouble-shooting the SSR's, don't use a digital multimeter on them to check the voltage output when their in the off state..the reason is because all solid state devices have current "leakage", and although it's in micro-Amps (uA), it's enough to make the digital volt meter indicate that voltage is present at the output when the device is in the off state..We used a electrician's volt meter call a Wiggy volt meter, to trouble -shoot SSR's.. they're fairly inexpensive. You can get them on Amazon for ~$10-$20 or so.. https://duckduckgo.com/?t=ffab&q=wiggy+voltmeter&ia=web

But the main thing is to be sure you don't touch any of the wiring because you think it's in the off state or high resistance state.. remember safety is the #1 goal in working with electricity.. It only takes about 9 mA to stop your heart!

Have fun, be safe.. and change the world with innovation, or at least your world...lol

 

image

kind regards,

LouisR

 

LouisR


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

@inst-tech That was my best friend when I was working at the steel mill as an electrician about 60 years ago.

I once was trying to caution my mechanic about how little current it took to kill you as he smiled and firmly grasped both terminals of my car's 12V 100A battery!

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
Inst-Tech reacted
ReplyQuote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

@zander..yep.. We had all kinds of neat toys to play with at the mill..the last 20 years, I was running the Control valve asset management shop,and was more involved in process control applications were control valves were used. BTW: I still have my wiggy..you never know when you might need it!...lol

regards,

LouisR

LouisR


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

@inst-tech Mine disappeared a long time ago, not that useful around the house, I am more likely to have one of those 'sniffer' things in my hand than a meter or the clamp on if the wires are broken out or I use the 110 extender. Last on the list is a regular VOM. But around high voltage I would only use the wiggy!

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

Did you also use a Megger? Not sure of the name, but it basically tested the insulation I think. It's been 60 years so the memory is weak.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
Inst-Tech reacted
ReplyQuote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

@zander, Yes, I used Megers, and motor diagnostic equipment.. technology has really changed alot since you were working in the mills back in the day.. here's a link to what they're up to these days... https://www.emerson.com/documents/automation/brochure-electric-motor-problems-diagnostic-techniques-ams-en-6652274.pdf

Also, I did diagnostics on Control valves, with the advent of smart positioners on control valves, now we had positive feedBack on valve position, actuator pressure, and a host of other diagnostics that would probably bore the stuff out of you...lol ..

image

https://www.emerson.com/documents/automation/instruction-manual-fisher-fieldvue-dvc6000-digital-valve-controllers-en-125596.pdf

 

regards,

LouisR

LouisR


   
Ron reacted
ReplyQuote