How to use 4 channel Arduino Relay Shield (with code)

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ธ.ค. 2017
  • In this video you will learn how to use 4 channel Arduino Relay Shield (with code)
    Download the code for this video:
    goo.gl/EkjbLZ
    Get early access to my videos via Patreon and have your name mentioned at end of very videos I publish on TH-cam : robojax.com/L/?id=97
    Tutorial by Robojax.
    Get other projects code and learn Aduino
    robojax.com/learn/arduino
    20190318-AD
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 56

  • @iam144
    @iam144 5 ปีที่แล้ว

    I just got my 4 channel shield yesterday, thanks for the video, it explained much. However, even though I trimmed the pins for relay #3 as described, the shield still did not sit far enough down on my Arduino/Genuino Megas 2560. I had to use the Prototype Expansion Board from the Starter Kit to get the relays to work. The explanation of the pins might be helpful when I put this on a board.

  • @akobenadinkrahene2153
    @akobenadinkrahene2153 6 ปีที่แล้ว +3

    Great how to! Thanks for all the (web-site included) information.

    • @robojax
      @robojax  6 ปีที่แล้ว

      you are welcome.

  • @alejoms
    @alejoms 3 ปีที่แล้ว +1

    Awesome Video, it helped me a lot, as it is usual with your videos.!! Keep up the good work.!! We really appreciate it.! Greetings from Guatemala.!

    • @robojax
      @robojax  3 ปีที่แล้ว +1

      Glad to hear that! Please subscribe and share. I appreciate it.

    • @alejoms
      @alejoms 3 ปีที่แล้ว +1

      @@robojax I’m already subscribed.!! :)

    • @robojax
      @robojax  3 ปีที่แล้ว

      Thank you very much.

  • @JPG23
    @JPG23 3 ปีที่แล้ว +1

    Great video, thanks for posting

  • @Kapalek84
    @Kapalek84 3 ปีที่แล้ว

    Nice presentation. Thank you.

  • @tsbimbra
    @tsbimbra 4 ปีที่แล้ว +1

    Hi sir I thank you for putting effort to provide this video . appreciate your work

    • @robojax
      @robojax  4 ปีที่แล้ว

      Hi tsbimbra, you are welcome. Thank you for not skipping the ads and keep watching them. This will help me a lot.

  • @unglaubichuberlieber8048
    @unglaubichuberlieber8048 ปีที่แล้ว

    thank you very much for this demo !!! permit me one question, if i run 4 dc motors( each with its power supply) would 9v (680mA) battery be enough to run all 4 relays ??? thanks in advance for your video + time !!!

    • @robojax
      @robojax  ปีที่แล้ว

      You are welcome. The amount of current depends on how much current your motor consumes. Maximum should be written as 10A and I have shown it. Your motor voltage can be independent of relay module.

  • @spunkywoods8659
    @spunkywoods8659 4 ปีที่แล้ว +1

    thanks on the pin assignments to relay

    • @robojax
      @robojax  4 ปีที่แล้ว

      You are welcome.

  • @davewalters41
    @davewalters41 6 ปีที่แล้ว

    Divide the voltage or switch voltage from A to B? I need the 12v to be switched over to the second line.

    • @robojax
      @robojax  6 ปีที่แล้ว

      It took me a while to find out what is A and B. You should have used reply to previous comments.
      Your question was related to 8.2V and 16V and that's why I offered solution.
      Now 12V. I did not understand what actually want to do. We have got 4 relays which work with 5V from Arduino. What do you want to do?

  • @buildthis2324
    @buildthis2324 3 ปีที่แล้ว

    Thank you. Was wondering what pins were being used.

    • @robojax
      @robojax  3 ปีที่แล้ว

      If you want help it fully, you should see it. The tutorial would be useless if I did not define and use pins. It won’t work.

  • @eugeneeuber7057
    @eugeneeuber7057 4 ปีที่แล้ว

    this is great to turn the relay on/off
    I would like to do this in an arcade cabinet with a pir motion sensor,and not with the delay code.
    im new to this and not really sure how to edit the code to do this.
    so my question to you would be.
    Can you provide a code with the pir sensor connected to pin3 which would turn on any one of the 4 relays by walking up to the cabinet,then turning off when no motion is detected.
    being new to this is like learning to walk for the first time lol
    your help with this code would be appreciated so much..
    signed
    old dog tryin to learn new tricks

    • @robojax
      @robojax  4 ปีที่แล้ว

      Hi, your project needs multiple components to be put together. You should be able to understand the sensor that detects when cabinet is opened. Then how you will open the door? does it already have motor with component to open/close if not you would have to make that. Then you can put them all together. So
      1-Learn how to use the sensor to detect motion. There are lots of ways to do it. One cheap would be ultrasonic sensor sensor to measure the distance. You wold install it inside cabinet and continuously measure the distance up to 180cm. So if obstacle gets closer to the door for example 50cm, you can turn on the motor to open the door.
      Here is coupon (expires in 4 days) for my Arduino Course on Udemy where you can learn Arduino step by step: www.udemy.com/course/robojax-arduino/?couponCode=9F68A2CA54235660FB69

    • @eugeneeuber7057
      @eugeneeuber7057 4 ปีที่แล้ว

      @@robojax im not trying to open a door.
      its like turning on a lamp using the 4 chn relay shield,stacked on the Arduino uno. with a motion sensor(PIR)
      just needed the code for when the pir detects motion..lamp comes on then
      no motion lamp goes off.

  • @adamelkoumy5141
    @adamelkoumy5141 6 ปีที่แล้ว

    Great video :)

    • @robojax
      @robojax  6 ปีที่แล้ว

      Thank you. :-)

  • @Hackenbaker
    @Hackenbaker 4 ปีที่แล้ว

    Excelent!!! Thanks a lot.

    • @robojax
      @robojax  4 ปีที่แล้ว

      You are welcome.

  • @davewalters41
    @davewalters41 6 ปีที่แล้ว

    Can the relay sense voltage for On @ 8.2v then Off @ 16.0v then switch to channel 2 ?

    • @robojax
      @robojax  6 ปีที่แล้ว +1

      The shield can't do that itself. For each channel, you need 2 resistors (with right values) to make voltage divider and connect it the input of each channel. this can be done.
      Here is voltage divider bit.ly/v-divider-1 and here is the formula for calculating V out which is your desired voltage. You can calculate R1 and R2 bit.ly/v-divider-2
      I hope I understood your question.

  • @santhakumarrajendran2599
    @santhakumarrajendran2599 3 ปีที่แล้ว

    Hi, Robojax, I am using the Motor Shield that you have and i was trying power a DC Motor with that and when i Upload the code, the Arduino and relay shield were glitching and the DC Motor was not moving. I checked the hardware to see is if there was any problem and it seemed to be fine. I also checked the code and even tried your sample code but still glitches. Do recommend any check to be done?

    • @robojax
      @robojax  3 ปีที่แล้ว

      Hello, if don't know if you watched the video fully. if not, watch it without skipping. I have explained things about the module so you learn and if your shield is different you can fix it.

    • @santhakumarrajendran2599
      @santhakumarrajendran2599 3 ปีที่แล้ว

      Robojax
      I have seen the video fully, it was really helpful and we are working for a small project for my son’s project
      We used 2 power source, one for Arduino and another for the Relay module common to drive the outputs, thanks for replying

    • @santhakumarrajendran2599
      @santhakumarrajendran2599 3 ปีที่แล้ว

      Robojax
      After using the two different power sources, the glitching problem was fixed

  • @declanphillips1567
    @declanphillips1567 2 หลายเดือนก่อน

    Hi robojax, currently I am trying to turn on a solenoid valve on and off for testing and nothing is working. I have copied your code and I have watched the video multiple times. I have the same relay Shiels, does it power a 12v solenoid valve ?

    • @robojax
      @robojax  2 หลายเดือนก่อน

      Hi, do you hear relay clicks? if not, check code and shield. if you you hear clicks then it should work.

    • @declanphillips1567
      @declanphillips1567 2 หลายเดือนก่อน

      @@robojax I hear clicks, I think I found my problem I’m trying to power a 12v solenoid and I think the relay sheild is 5v, thanks for responding

  • @mashagreen-zv4qg
    @mashagreen-zv4qg 6 หลายเดือนก่อน

    thanks

  • @akobenadinkrahene2153
    @akobenadinkrahene2153 6 ปีที่แล้ว

    I don't know if you notice but the link on your site for Arduino code and video for 4 channel Relay Shield, is incorrectly linked to Arduino code for HC-SR501 Motion Sensor

    • @robojax
      @robojax  6 ปีที่แล้ว

      Thank you for letting me know. The link has been corrected : goo.gl/EkjbLZ

    • @akobenadinkrahene2153
      @akobenadinkrahene2153 6 ปีที่แล้ว

      Your very welcome!

  • @vijayalaxmipotdar4005
    @vijayalaxmipotdar4005 ปีที่แล้ว

    Hi Robojax
    I am trying to run 12V DC motor with 4 Channel Relay shield. I followed your video and tried connecting the same. I am using Relay 1 and 2 for forward and reverse direction. I am really struggling with this and not able to achieve the same any help would be appreciated. Thanks in advance.

    • @robojax
      @robojax  ปีที่แล้ว

      Hi, the. Watch the video 2, 3 or 4 time so you learn it. This is how I do it. I can’t type what I said in the video.

    • @vijayalaxmipotdar4005
      @vijayalaxmipotdar4005 ปีที่แล้ว

      Hey Robojax,
      Thanks for your reply. I did not mention on the post that I want to operate my relay using joystick. Is this possible? Even if I connect my joystick and write a program for the same ……Relay operates on it’s own w/o taking input from joystick. Same program works with single relay.
      Thanks

  • @ManuelCastillo-kq3xy
    @ManuelCastillo-kq3xy 5 ปีที่แล้ว

    What do you put for isolation USB port???

    • @robojax
      @robojax  5 ปีที่แล้ว +1

      when you connect wire to relay, they are isolated from DC circuit. Other than you can't do anything else.

  • @eddieed9684
    @eddieed9684 5 ปีที่แล้ว

    What about wifi connection? Can i use this shield with arduino wemos r1?

    • @robojax
      @robojax  5 ปีที่แล้ว

      I am not sue about the wemos sorry.

  • @Bluelagoonstudios
    @Bluelagoonstudios 2 หลายเดือนก่อน

    I'm going to buy this one and a Arduino Rev2 WIFI/ Bluetooth, and they will be used in a PC, to turn on, off groups of Led strings. Via WIFI or my smartphone. These are forseen with only Molex connectors, which are too big for building such a system.

  • @ManuelCastillo-kq3xy
    @ManuelCastillo-kq3xy 5 ปีที่แล้ว

    I need use 2 of this shield.... It's possible? How's the code this?

    • @robojax
      @robojax  5 ปีที่แล้ว +1

      no you can't because the pins ca't be changed.

    • @ManuelCastillo-kq3xy
      @ManuelCastillo-kq3xy 5 ปีที่แล้ว

      Robojax I’m so sad

    • @robojax
      @robojax  5 ปีที่แล้ว

      don't be. Here is 4 to 8 channel relay you can use th-cam.com/video/Wbm3MCMgM_s/w-d-xo.html

    • @terrylove3247
      @terrylove3247 3 ปีที่แล้ว

      @@robojax Can you cut the pins off 4 5 6 & 7 of the second shield and jumper from other pins to 4 5 6 & 7?

  • @davewalters41
    @davewalters41 6 ปีที่แล้ว

    Sorry for not explaining - my goal is to turn on 12v / 1amp light bulb 1 for 30 minutes then Off ; then turn on light bulb 2 for 30 minutes ; then back to light bulb 1 and so on repeating .....

    • @robojax
      @robojax  6 ปีที่แล้ว

      yes you can. this is what relay is for. Each relay can be controlled. I have written code for you here codeshare.io/a3pJAB