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

Sdílet
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

Komentáře • 233

  • @n0madfernan257
    @n0madfernan257 Před 3 lety +39

    liked that "we are in an 'alternating' universe now" intro.

  • @moriambar6533
    @moriambar6533 Před 3 lety +13

    the multiple reminder about "safety first" deserves many thumbs up

  • @KeithBofaptos
    @KeithBofaptos Před 3 lety +5

    I'm so ready to learn the AC dimming. Love your vids!

  • @gpTeacher
    @gpTeacher Před 3 lety +5

    Fantastic video! Incredibly well structured and informative. Thank you very much!

  • @paultakoy7091
    @paultakoy7091 Před rokem +3

    Great video as always, Bill. Exactly what I was looking for. Thank you!

  •  Před 3 lety +2

    I love the way you explain things. It's very clear and comprehensive.

  • @johnpaulpineda9821
    @johnpaulpineda9821 Před 3 lety +5

    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 :)

  • @abegafouda9136
    @abegafouda9136 Před 3 lety +27

    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.

  • @intellisound
    @intellisound Před 3 lety +16

    “The blink sketch on steroids...” LOL!
    Your videos are simply the best.

  • @rc.9764
    @rc.9764 Před 3 lety

    Thank you for all your effort! Very informative. I don't miss any of your video

  • @Danielddiniz
    @Danielddiniz Před 3 lety +2

    Bill what I’ve really appreciated was you calling us your Friends!! Really felt like I’m your friend!

  • @TheDanyBelanger
    @TheDanyBelanger Před 3 lety

    Thank you so much for this. Very good video as usual. Can’t wait for the dimming part :)

  • @justbeeeb2061
    @justbeeeb2061 Před 3 lety +3

    Thank You! You have been bringing joy to my life with your videos consistently. 👍🏻💅🏻💅🏻💅🏻💅🏻💅🏻💅🏻💅🏻💅🏻💅🏻

  • @stevenlightfoot6479
    @stevenlightfoot6479 Před 7 měsíci

    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.

  • @Mippi12
    @Mippi12 Před 3 lety +1

    This is exactly what I needed .
    Thank You !

  • @horus2369
    @horus2369 Před 3 lety +1

    Top notch education!!! Your teaching style reminds me of attending ITT

  • @JonathanDeWitt1988
    @JonathanDeWitt1988 Před 3 lety +1

    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.

  • @0ptixs
    @0ptixs Před rokem

    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

  • @WildLifeBackyardCamera
    @WildLifeBackyardCamera Před 3 lety +1

    thanks you so much for all the work you put into making such an awesome video !! Its really appreciated :)

  • @Leroys_Stuff
    @Leroys_Stuff Před 3 lety

    Great video as always Bill.

  • @sbsarkar5659
    @sbsarkar5659 Před 3 lety +1

    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

    • @subbielover9374
      @subbielover9374 Před 3 lety

      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.

  • @deankq4adj125
    @deankq4adj125 Před 3 lety +1

    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.

  • @jimthannum7151
    @jimthannum7151 Před 3 lety +1

    Excellent tutorial!!

  • @ericmwiggins
    @ericmwiggins Před 3 lety +1

    I enjoy learning from you and watching your FANTASTIC videos. I wish I had you as a teacher in college. A++

  • @electronic7979
    @electronic7979 Před 3 lety +2

    Helpful video. I liked it

  • @francoisrochefort5759
    @francoisrochefort5759 Před 3 lety

    I wondering for so long! Nice video tx

  • @MmMm-tg5mq
    @MmMm-tg5mq Před 3 lety

    Very very helpful video. Your way in explaining is great . Keep going...

  • @shaunogrady6887
    @shaunogrady6887 Před rokem +1

    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

  • @camplays487
    @camplays487 Před 3 lety

    Thank you, you somehow guess what Arduino projects i want to learn about and now I have great reference information and tutorials now.

  • @Steven-zv4kd
    @Steven-zv4kd Před rokem

    I can't believe I've only just discovered your channel. This is top-notch material.
    Like & Sub well earned

  • @caffeinatedinsanity2324
    @caffeinatedinsanity2324 Před 3 lety +3

    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.

  • @thearchetype9829
    @thearchetype9829 Před 3 lety

    You can watch this is just awesome @DroneBot Workshop

  • @AreebAmir
    @AreebAmir Před 3 lety +1

    Very nice video,great professor

  • @hadireg
    @hadireg Před 3 lety

    great video as always! Thanks a million!

  • @MsThekiller02
    @MsThekiller02 Před 2 lety

    Excellent video, thank you for all the useful information.

  • @miguelraulgonzalez7744

    Excellent safety tips!! Thank you!!

  • @henrybartlett1986
    @henrybartlett1986 Před rokem

    These are wonderful presentations. Many thanks.

  • @decem_unosquattro9538
    @decem_unosquattro9538 Před 2 lety

    Ahh very good explanation of how to connect Arduino safely! Thanks Bill. 👍

  • @davelewis3963
    @davelewis3963 Před 2 lety

    Another great video. Thanks!

  • @kuravani1963
    @kuravani1963 Před 3 lety

    Good explanation. Thanks for the video

  • @bybecker
    @bybecker Před 2 lety

    Excellent video. Thank you very much for your information. You know how to explain very well. Congratulations.

  • @carlos2004
    @carlos2004 Před 3 lety

    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.

  • @crossbound
    @crossbound Před 2 lety

    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.

    • @MsThekiller02
      @MsThekiller02 Před 2 lety

      Wow! This is exactly my usecase too! I watched this video entirely for that purpose!

  • @andrewlee2344
    @andrewlee2344 Před 2 lety

    Thank you for the great video more inspiration for home projects

  • @cuper4295
    @cuper4295 Před 2 lety +1

    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.

  • @toolooselowtrek7523
    @toolooselowtrek7523 Před 3 měsíci

    Emphasis on safety much appreciated!

  • @edac1078
    @edac1078 Před 3 lety

    Thanks, that was fun!

  • @vectorsigma9903
    @vectorsigma9903 Před 2 lety

    Awesome video. Thank you!

  • @kennethbeal
    @kennethbeal Před rokem

    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. :)

  • @hanzotv3
    @hanzotv3 Před 9 měsíci

    Your voice is soothing as a learning narrator... So I subscribe. 😅

  • @lollllloro
    @lollllloro Před rokem

    "...and as the Arduino is a microcontroller, we're going to use it to control things."
    This made my day : )

  • @sergeiziuzev7049
    @sergeiziuzev7049 Před 3 lety

    It’s great what you are raise topic of safety of AC voltage.

  • @hthharrison7764
    @hthharrison7764 Před 2 lety

    Great information, thank you 👍

  • @willozfam
    @willozfam Před 5 měsíci

    Just stumbled on your channel. Love your emphasis on safety. "a very ugly lamp" cracked me up. 😂

  • @Danteelias08
    @Danteelias08 Před 2 lety

    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.

  • @rbpassos77
    @rbpassos77 Před 3 lety +1

    Great vídeo. Excelente chanel. from Brazil , thanks a lot

  • @axelBr1
    @axelBr1 Před 3 lety +15

    Signs often placed near high voltage installations, "Not only will this kill you, it will hurt the whole time you are dying"

    • @bradandsusan96
      @bradandsusan96 Před 2 lety

      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

    • @axelBr1
      @axelBr1 Před 2 lety

      @@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.

  • @chrisreynolds6331
    @chrisreynolds6331 Před 2 lety

    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.

  • @michaelnierer8503
    @michaelnierer8503 Před 3 lety

    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.

  • @rondlh20
    @rondlh20 Před 3 lety

    Great job again, amazing tutorial... there could be feedback in the light-controlled light, it could start flashing

  • @arduinomerkaba6135
    @arduinomerkaba6135 Před 2 lety

    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?

  • @frendoify
    @frendoify Před rokem

    very good proyect

  • @keiththomas3352
    @keiththomas3352 Před 2 lety +1

    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.

  • @elareau1
    @elareau1 Před 2 lety +1

    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??

  • @stuffoflardohfortheloveof

    Very good! 🙂👍🏴󠁧󠁢󠁷󠁬󠁳󠁿

  • @kabandajamir9844
    @kabandajamir9844 Před rokem +1

    So nice

  • @stephenloto8984
    @stephenloto8984 Před 2 lety

    Good lecture, I want to know how to connect my electric motor with the relay and using rf to control it. Thank you.

  • @jstro-hobbytech
    @jstro-hobbytech Před 3 lety

    I love your content and the dry humor hahaha

  • @electronical100
    @electronical100 Před 2 lety

    thank you so much.

  • @stevenlightfoot6479
    @stevenlightfoot6479 Před 7 měsíci

    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

  • @splyit
    @splyit Před 3 lety

    as alwayz. great vidéo

  • @lalitac
    @lalitac Před 3 lety +2

    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.😀

    • @michaelgraff6978
      @michaelgraff6978 Před 3 lety +1

      It’s also about trace isolation including PCB cutouts.

    • @lalitac
      @lalitac Před 3 lety +1

      @@michaelgraff6978 Yup!

  • @petermenningen338
    @petermenningen338 Před 2 lety

    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

  • @Peterkringle
    @Peterkringle Před rokem

    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 :)

  • @LittLe_PunK
    @LittLe_PunK Před 8 měsíci

    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

  • @keeleyhoek
    @keeleyhoek Před 3 lety +2

    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.

    • @flickmew99
      @flickmew99 Před 2 lety

      I'm still wondering when the flyback diodes circulate around the current until it disappear, is the energy converted into heat or what ?

    • @keeleyhoek
      @keeleyhoek Před 2 lety

      @@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.

  • @hemeshchadalavada3430
    @hemeshchadalavada3430 Před 3 lety +2

    Amazing

  • @bonfacemusyoka2337
    @bonfacemusyoka2337 Před rokem

    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?

  • @dzee9481
    @dzee9481 Před 3 lety

    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.

  • @bobvines00
    @bobvines00 Před 3 lety +2

    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?)

  • @alexsere3061
    @alexsere3061 Před rokem +2

    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.

  • @joaopedrokorzeniewski6530

    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.

  • @andreasbuervase3772
    @andreasbuervase3772 Před 2 lety

    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!

  • @romaric3545
    @romaric3545 Před 3 lety

    Thanks

  • @MrJohnnaz
    @MrJohnnaz Před 3 lety +7

    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".

    • @rondlh20
      @rondlh20 Před 3 lety

      Lots of fakes around... use at a current much lower than specified (50-60%)

  • @inferno6012
    @inferno6012 Před 3 lety

    my first semester. got my first DMM connect to main directly without setting proper range and BOOM meter dead

  • @emadabuhagag222
    @emadabuhagag222 Před 3 lety

    You are great

  • @claudioveronese4863
    @claudioveronese4863 Před rokem

    Super!!!

  • @ThinkleTink
    @ThinkleTink Před 3 lety

    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.

  • @oriyogi
    @oriyogi Před 3 lety +1

    Csn you explain the process how you make your wonderful videos - what editing software you use, process.....

  • @siddharthgholap3725
    @siddharthgholap3725 Před 3 lety

    Awesome

  • @neliosamch3195
    @neliosamch3195 Před 3 lety

    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.

    • @steve91311
      @steve91311 Před 3 lety

      Same here. Can anyone help us find the DC version of this AC lesson? Many thanks in advance. 👍🏻

  • @lg_pa_62wall24
    @lg_pa_62wall24 Před 3 lety +1

    Wii you be going back the the DB1 build at any time soon. Can you tale us want

  • @HARSH9909
    @HARSH9909 Před 3 lety +1

    Can you make a video to make a video to make SSR? Or a circuit board using TRIAC to be controlled via ESP32/Arduino.

  • @rancillinmontgomery2480

    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.

  • @blackmegas2401
    @blackmegas2401 Před rokem

    I luv that "ugly lamp"..🤣

  • @PakiNewsNetwork
    @PakiNewsNetwork Před 2 lety

    Can i use this relay to control 12 volt dc?

  • @CodingScientist
    @CodingScientist Před 3 lety

    Nice

  • @shawn576
    @shawn576 Před 3 lety

    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.

  • @dhiasmemyself
    @dhiasmemyself Před rokem

    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