Control AC Devices with Arduino SAFELY - Relays & Solid State Switches
Vložit
- čas přidán 9. 07. 2024
- 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: dronebotworkshop.com/ac-arduino/
More articles and tutorials: dronebotworkshop.com
Join the conversation on the forum: forum.dronebotworkshop.com
Subscribe to the newsletter and stay in touch: dronebotworkshop.com/subscribe/
** 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. - Jak na to + styl
liked that "we are in an 'alternating' universe now" intro.
the multiple reminder about "safety first" deserves many thumbs up
I'm so ready to learn the AC dimming. Love your vids!
Fantastic video! Incredibly well structured and informative. Thank you very much!
Great video as always, Bill. Exactly what I was looking for. Thank you!
I love the way you explain things. It's very clear and comprehensive.
Hi Sir Bill / @DroneBot Workshop,
I just finished watching it and Thank You! so much for your well-explained and very detailed tutorial - I love it!
Your video tutorials are very big help for those people who want to learn or pursue a career in robotics.
I do appreciate your effort in making this tutorial and keep up your very good work!
I am from Philipines by the way :)
As usual, perfectly explained, with simple, understandable words, cool voice and pace, organized demonstration, and more. You are a real "Master, not only in electronics, but also in communication. Thanks.
“The blink sketch on steroids...” LOL!
Your videos are simply the best.
Thank you for all your effort! Very informative. I don't miss any of your video
Bill what I’ve really appreciated was you calling us your Friends!! Really felt like I’m your friend!
Thank you so much for this. Very good video as usual. Can’t wait for the dimming part :)
Thank You! You have been bringing joy to my life with your videos consistently. 👍🏻💅🏻💅🏻💅🏻💅🏻💅🏻💅🏻💅🏻💅🏻💅🏻
This is excellent, and I appreciate you bringing the IOT relay for AC power at the end, to my attention. I had kind of assumed such a thing existed, and now its clear it does and I can easily and safely make use of it.
This is exactly what I needed .
Thank You !
Top notch education!!! Your teaching style reminds me of attending ITT
Bill,
A year or so back I watched a CZcams video by Robojax where he showed how to control an AC load device that he cut the power cord on and wired directly to the AC wall outlet and to the relay module controlled by the Arduino. Your video just vastly expanded my understanding of relays and the fact that I was using a relay module with additional circuitry. Thank you for that. This video was very good.
Man, this is the exact video I needed. I understand very generally how electricity works, I don't need someone to explain it again to me. I just need the different methods of switching ac power safely. I cannot wait to see what other videos you have to offer sir! Thank you
thanks you so much for all the work you put into making such an awesome video !! Its really appreciated :)
Great video as always Bill.
Did you all notice guys, how Bill makes his presentations so interesting that u get glued to the channel...till he says " goodbye for now"...Excellent job Bill. I must admit that the voice modulation of Bill is one of the best I hve heard on youtube, or rather, de facto the best. The subject, topic, cautions, content, delivery, camera management, focus, details....well..u name it and it is here. Apart from teaching electronics, you are probably also teaching a thing or two to all those in teaching and tutorial business. Thanks Bill and keep it up. I wait for your videos. Regards
You are right. IMHO even the non native speakers understand every single word :) Just great stuff in every aspect ! I wonder how much time does Bill spend preparing for a single workshop lesson.
Great video as always! I have been researching a way to control my pool pumps with an Arduino. Going to do more research on the IoT module you showed.
Excellent tutorial!!
I enjoy learning from you and watching your FANTASTIC videos. I wish I had you as a teacher in college. A++
Helpful video. I liked it
I wondering for so long! Nice video tx
Very very helpful video. Your way in explaining is great . Keep going...
I really enjoy the thorough explanation and demonstrations with multiple components/setups. Great vid, if there were a double thumbs up i would click it
Thank you, you somehow guess what Arduino projects i want to learn about and now I have great reference information and tutorials now.
I can't believe I've only just discovered your channel. This is top-notch material.
Like & Sub well earned
An idea I had once for making a ln AC switching device was to build some sort of box where the relays are contained inside and what comes out of the outputs are female outlet plugs. On the power input side, definitely add a circuit breaker, ideally with GFCI, assuming you properly grounded your setup.
You can watch this is just awesome @DroneBot Workshop
Very nice video,great professor
great video as always! Thanks a million!
Excellent video, thank you for all the useful information.
Excellent safety tips!! Thank you!!
These are wonderful presentations. Many thanks.
Ahh very good explanation of how to connect Arduino safely! Thanks Bill. 👍
Another great video. Thanks!
Good explanation. Thanks for the video
Excellent video. Thank you very much for your information. You know how to explain very well. Congratulations.
i like that new recording set up with only one camera; feels more natural.
i really like the relay modules. they're super easy to use and control. since they're relays, they can be used for pretty much anything. for example, i needed to build a sound input selector, and all i had on hand was a double relay module which worked well. then i needed to control my room's light/fan, and again, i used the double relay module. i also had to use a relay (not a module, simply the components that came with the arduino kit) because it was my audio preamp and it had to be electrically isolated from the arduino circuit or else it would hum. what's more, i even found some tiny relays that are perfect for audio since they are tiny and are dpdt which is perfect for stereo audio.
also a tip, just stick with the 5v relay module since if going for the 12v versions, you will still need to run 5v from the arduino or else the relay module will expect a 12v signal which the arduino can not provide in the output pins.
I am just getting started with Arduino and this photo resistor and relay demo enabled me to create a timer switch for my christmas lights. They turn on when it gets dark outside and stay on for 6 hours, after turning off they want turn on until the next sunset. Thank you very much for your fantastic videos.
Wow! This is exactly my usecase too! I watched this video entirely for that purpose!
Thank you for the great video more inspiration for home projects
I looked through the comments and didn't see this one, so here goes. My memory from when I did this sort of stuff for a living (1970s) was that the open output voltage of transformers was always high as you found. This was so that when the transformer was used at its full power rating, the output voltage did not pull down to below the rated secondary voltage. The pull down is due to the I x R losses across the transformer secondary.
Emphasis on safety much appreciated!
Thanks, that was fun!
Awesome video. Thank you!
11 minutes in, this is really neat: one of the leads for my multimeter recently broke. Wanted to replace the lead; found it'd be cheaper to buy a new $10 unit. So, I bought two, in case one fails again; they arrived yesterday. So it's REALLY neat to see, the very next day, your demonstration of USING two multimeters for a project! :) I'm prepared, or at least, a little bit more. :)
Your voice is soothing as a learning narrator... So I subscribe. 😅
"...and as the Arduino is a microcontroller, we're going to use it to control things."
This made my day : )
It’s great what you are raise topic of safety of AC voltage.
Great information, thank you 👍
Just stumbled on your channel. Love your emphasis on safety. "a very ugly lamp" cracked me up. 😂
Let me congratulate from Lima-Peru, I am chemist and try to know more about Arduino and control optoisolated relays... great information and very well explained... thxs.
Great vídeo. Excelente chanel. from Brazil , thanks a lot
Signs often placed near high voltage installations, "Not only will this kill you, it will hurt the whole time you are dying"
Are you speaking from experience??
Not the dead part obviously.
I've had the crap knock out of me a few times.
Good day and God bless
@@bradandsusan96 Only partly, considering my DIY skills it is surprising that I haven't electrocuted myself. But have had a few shocks off an electric fence, (5kV but only a few mA), and it's not an experience that you'd readily seek to repeat.
Great video thank you. Another safe method of controlling mains power that I do is to use 433mhz approved wireless switches and use the rcswitch library and the miniature 433 transmit and receive modules. Capture the codes from the original remote and get the sketch to send them.
Thanks for introducing me to the IoT Relay. I built a homemade device similar to this. I use it with my computer usb port to turn off 120vac devices when I shut the computer off. I will be replacing my homemade unit with the IoT Relay.
Great job again, amazing tutorial... there could be feedback in the light-controlled light, it could start flashing
Brilliant video Bill Thank You! I was just wondering what the first two number in the speedvalue line relate to (0, 1023,)and what will happen if I change them?
very good proyect
Very helpful & informative. I would like to see a video on how to control a high voltage heating element with the Arduino. Maybe auto adjusting using a thermocouple. PWM not PID.
Awesome video! I've been contemplating trying my Arduino on AC devices and have been pretty nervous.
These IOT relays seem kind of hard to come by though, are there any cheaper than 60 bucks??
Very good! 🙂👍🏴
So nice
Good lecture, I want to know how to connect my electric motor with the relay and using rf to control it. Thank you.
I love your content and the dry humor hahaha
thank you so much.
This is great thanks. I was thinking about trying something like this, using the Arduino 4 relay shield, but when I looked closer it seemed that it is designed with relays for DC not AC. Can you advise, are there two kinds of relays, which are different, one type for AC and one type for DC? Thx
as alwayz. great vidéo
We would love if you make a video on how to make a proper optically isolated relay module explaining the circuitry and the reason behind choosing the equipments of such and such value. This video was very helpful.😀
It’s also about trace isolation including PCB cutouts.
@@michaelgraff6978 Yup!
Bill a commonly obtainable step down transformer is an old style door bell transformer. They are listed and one side either has a short pigtail power cord with a plug for 115-120 v and the other side has a screw terminal 2 screws for a nominal 24 V AC outlet
Thank you. Thank you thank you. From the bottom of my heart. I'm a chemical engineer dabbling in the electricity realm, and you're a lifesaver. I will say, no need to throw shade (pun intended) at the lamp at the end. We're all a little ugly :)
very responsibly tutorials sir.. safety is number one... btw is that possible if i made a fuzzy logic to control an alternating current fans? .. I think to make it as my final project in college. thanks in advance
Also, the flyback diodes do not "block the emf", they allow the current through the coil they are connected across to (temporarily) continue flowing when power is disconnected, preventing a large emf from being produced across them in the first place.
I'm still wondering when the flyback diodes circulate around the current until it disappear, is the energy converted into heat or what ?
@@flickmew99 Yes, the energy stored in the magnetic field of the coil (because of its inductance) is dissipated as heat due to the resistance of the coil and diode themselves (because they are non-ideal), and the resistance of the traces which connect them.
Amazing
Nice video...
I am working on a project of mutual induction using two coils. The source is a signal generator. am trying to figure out how to control the switching on and off of the primary coil using arduino uno. Which device might work well in this situation?
Very well done. I was would like to see a video on using Zero Crossing SSR. How would you use one of these devices using a microcontroller. With Zero Crossing SSR you can use to control the brightness of lights such as LEDs or incandescent lights.
Bill, thank you for this wonderful video! You did a great job covering safety and interfacing. Now you need to show a project working with tubes! LOL! Of course, if you could do that and show how to to it _safely_, it could be quite interesting.
Thank you for making such interesting & educational videos. (Just curious: Will you be returning to your robot project in the future? Or drones?)
Hi sir, I am doing a bachelor's in a technical university, and for a project we decided to make a microcontroller-controlled heater. This video was crucial in the project, thanks for the safety tips and attention to detail.
The lamp is rather ugly, but your tutorial is beautiful. Thank you Mr from the DroneBot Workshop. I wish you a happy and long life.
Hi!
Thank you so much for a very nice video! I was woundering if you know any websites I can buy an IoT control relay which is certified in Europe? I don´t find any which is similar to the one you show on the video.
Thanks!
Thanks
Just a heads up when buying solid state relays, stay away from the Fotek brand.
I had a 40 amp Fotek hooked to an electric heater for period of a few months. One day I could smell plastic burning, It was the Fotek, It was melted.
Luckily it was in a proper aluminum enclosure and no harm was done. This was only a 10 amp load with a good heatsink with thermal compound.
I took the relay apart and found it had only a 12 amp triac inside. I guess the Chinese have counter-fitted some of these Fotek relays, If you do get a Fotek
make sure it is made in Tiawan and not China. I personally replaced the faulty relay with an American made Opto22 25 amp relay that does not get hot at all.
It is also wise to de-rate any solid state relay by 50% or more for a more reliable unit. As Bill says "BE SAFE".
Lots of fakes around... use at a current much lower than specified (50-60%)
my first semester. got my first DMM connect to main directly without setting proper range and BOOM meter dead
You are great
Super!!!
I have a question regarding solid-state relays, some background first, where I live the power supply is 320-340V AC / Ex Euro nation - Anyways, when using a solid-state relay with any LED bulb the bulb either flickers or stays on whilst the relay is in "off" mode, in on mode there are no problems, the same effect almost with a short 240V red LED strip I put through the relay when I turn on the relay channel for the LED strip the strip goes on but is super super dim like the relay is sucking the power.
Csn you explain the process how you make your wonderful videos - what editing software you use, process.....
Awesome
I sub because of a ton of good info. I can't find the episode for DC devices controlled by Arduino and solid state relays.
Same here. Can anyone help us find the DC version of this AC lesson? Many thanks in advance. 👍🏻
Wii you be going back the the DB1 build at any time soon. Can you tale us want
Can you make a video to make a video to make SSR? Or a circuit board using TRIAC to be controlled via ESP32/Arduino.
Working on a SSR ATS Arduino driven. Having problem with grid and inverter connecting and blowing up inverter. Either my code or cheap SSRs or both. Need a better explanation on Zero Cross.
I luv that "ugly lamp"..🤣
Can i use this relay to control 12 volt dc?
Nice
About the isolation transformer at 12 minutes: bathrooms no longer have those. That was like 1970s and earlier. Modern ones have the full 15A in a bathroom but the circuit must be GFCI protected.
Hello Sir, I'm using similar circuitry with yours, a push button assigned to an interrupt, a de-bounce timer, and an output pin to drive electric school bells on 220v mains, for few seconds, using a 1 channel optocoupled relay, on a test bench, i connect the relay to drive a 12v buzzer, and it was working perfect.. but on implementation, every time i connect the common relay leg with 220v mains, sometimes the interupt trigered without touching the input button, and when running sometimes the arduino resets, i even tried using secondary power supply for the relay, activated internal pulls up resistor on pin, do you ever have any experience on this kind of problem or maybe solutions ? thanks in advance