Arduino relay basics - how it works and how to use it

Поділитися
Вставка
  • Опубліковано 1 сер 2024
  • This video is sponsored by Altium Designer. Get your Altium free trial at: www.altium.com/yt/taste_the_code
    -----------------------------------------------
    The giveaway was open until the end of the day on Wednesday, 17th of November, 2021!
    It is now closed!
    -----------------------------------------------
    To be able to control AC loads with Arduino, a relay is always required for the switching so the high voltage can be separated from the low control voltage of the Arduino.
    These relays come in many shapes and sizes, and each relay holds a different load rating so it is important to understand how they work and how we can safely use them in our projects.
    In this video, I'm going through the basics of what a relay is, how it works, and how it can be controlled with Arduino so you can then incorporate them into your projects.
    Check the project Instructable for a written version of this video. You can also find the Arduino code used in the video there.
    www.instructables.com/Arduino...
    Tools and materials used in this video:
    Arduino Unoi - s.click.aliexpress.com/e/_9HbRep
    Arduino Nano - s.click.aliexpress.com/e/_9uMmsh
    5V relay board (not isolated) - s.click.aliexpress.com/e/_A3UQ0p
    5V relay board (isolated) - s.click.aliexpress.com/e/_AZa5Ip
    12v relay module (not isolated) - s.click.aliexpress.com/e/_AthV9P
    12 v relay module (isolated) - s.click.aliexpress.com/e/_AgaB9X
    4 channel relay module - s.click.aliexpress.com/e/_9h4k3r
    Digital multimeter - s.click.aliexpress.com/e/_A6CcIz
    Male to Female dupont jumper wire - s.click.aliexpress.com/e/_AfVOct
    Mini breadboard - s.click.aliexpress.com/e/_9ihnNr
    Sonoff Basic module - s.click.aliexpress.com/e/_ATsQtF
    Temperature controller - s.click.aliexpress.com/e/_AK2HSZ
    Support my work on Patreon so I can continue producing free content and tutorials!
    / taste_the_code
    My recording gear:
    GT10 Pro 5G Android Phone - s.click.aliexpress.com/e/_oDn...
    Dragon Touch 4K Action Camera - s.click.aliexpress.com/e/_mrc...
    USB Condenser Microphone - s.click.aliexpress.com/e/_mq5...
    Tripod - s.click.aliexpress.com/e/_ooa...
    Phone tripod mount - s.click.aliexpress.com/e/_s9WaiJ
    Arduino relay basics - how it works and how to use it (+ giveaway!)
    #arduino #relay #electronics #circuit #tastethecode
    Main Site and blog: www.tastethecode.com
    Facebook: / tastethecode
    Instagram: / taste_the_code
    Twitter: / taste_the_code
    Get exclusive Taste The Code t-shirts and merch at
    teespring.com/taste-the-code
    Click on the link below to get two months of free premium access to Skillshare and start learning today!
    skl.sh/37LnRua
    Get $50 off your order on hosting for all of your website needs and learning projects on Dreamhost!
    www.dreamhost.com/r.cgi?24057...
  • Наука та технологія

КОМЕНТАРІ • 21

  • @davidjobe9876
    @davidjobe9876 2 роки тому +2

    That was a good tutorial ;)
    How to use a relay.
    I have both relays, the normal one and the SSR, which was bought together with a PID controller.

    • @TasteTheCode
      @TasteTheCode  2 роки тому

      Thanks! Any plans to use them on a project?

    • @davidjobe9876
      @davidjobe9876 2 роки тому +1

      @@TasteTheCode I once made a slow cooker with that SSR.
      With that regular 4 way module relay, maybe I would make a terrarium for my carnivorous plants that controls my light, humidifier and water pump ;)

    • @TasteTheCode
      @TasteTheCode  2 роки тому +1

      Hey David, congratulations on winning the relay module!

    • @davidjobe9876
      @davidjobe9876 2 роки тому

      @@TasteTheCode Thank you very much ;)

  • @paulomorgado4967
    @paulomorgado4967 28 днів тому

    Thanks a lot for the tutorial! Would it be possible to code it so two relays activate and deactivate out of phase? I need my code such that one of the relays activate each 1000ms and the other one 1500ms.

    • @TasteTheCode
      @TasteTheCode  27 днів тому

      Yes, you can. You just need two variables to compare the elapsed time.

  • @faturahmanf3024
    @faturahmanf3024 2 роки тому

    Can you help me with my project? I use 2 relay to control my DC motor for forward and reverse the motors rotation, but when i control it using my arduino, my arduino program was crash and error, and i had to reset it again so it can run again, i already use an external power supply for my relay 4 channel modul, but it just the same, can you help me with please

    • @TasteTheCode
      @TasteTheCode  2 роки тому +1

      Does your module have EMF protection diodes? Motors know to create a lot of electrical noise when stopping so that might be interfering with the electronics. Check if the code runs with just the relays, without the motors, so you can isolate if the problem is coming from the relay board or the motors. Additionally, it is recommended that you use two separate power supplies, one for the controller and one for the motors.

    • @faturahmanf3024
      @faturahmanf3024 2 роки тому

      @@TasteTheCode im using 4channel relay just like in your video, i thought that kind relay had a zener diode that protect the relay give a current feedback is it?

    • @faturahmanf3024
      @faturahmanf3024 2 роки тому

      @@TasteTheCodeexcuse me i want to send you the video of my project, if it doesnt bother you, can i send it via your facebook page or instagram

    • @TasteTheCode
      @TasteTheCode  2 роки тому +1

      Video will not help a lot as it might be difficult to identify what is going on bu send it if you want.

    • @faturahmanf3024
      @faturahmanf3024 2 роки тому

      @@TasteTheCode thank you for your advice, i appreciate it👍