Home Automation: Control 16 channel relay with CD74HC4067 Multiplexer and Arduino with 6 wires

Поділитися
Вставка
  • Опубліковано 25 лип 2024
  • Learn Arduino in 30 Minutes (video): robojax.com/L/?id=135
    this video shows you how to control ONE of 16 relay using the CD74HC4067 multiplexer chip with Arduino
    The best thank you for me is to not to skip ads and Subscribe 🔔 to my channel, like 👍 the video It is greatly appreciated. 🔔 😊.
    I will reply to all Subscriber's 🔔 questions. So make sure to Subscribe and enable the bell 🔔.😊
    **** Purchase CD74HC4067 relay module from Affiliated Stores **
    Amazon USA: amzn.to/3kTlltr
    Amazon Canada: amzn.to/35JhaK5
    Amazon all European countries: amzn.to/2HPe7rM
    Purchase 16 channel relay module:
    Amazon USA: amzn.to/3kKxxwk
    Amazon Canada: amzn.to/34DCbXb
    Amazon all European countries: amzn.to/3oEL2Ac
    Jump to different section of this video:
    00:00 Start
    00:27 Introduction
    02:08 Hardware Explained
    04:54 Wiring explained
    09:05 Code explained
    16:58 Demonstration
    Get code for this video: bit.ly/2BLvO65
    Watch how to control 16 Channel Relay with Arduino:
    • Lesson 68, Home Automa...
    Watch: 5V regulated voltage of 16 channel relay issue resolved:
    • 16 Channel Relay modul...
    Get schematic diagram for this module:
    bit.ly/16chRelay-Schematic
    Learn Arduino in 30 Minutes (video): robojax.com/L/?id=135
    If you found this tutorial helpful, please support me so I can continue creating content like this. You can support me via PayPal: bit.ly/rj-paypal
    How to use a breadboard (video) : robojax.com/L/?id=121
    Tutorial by Ahmad Shamshiri form Canada
    Subscribe To my channel now bit.ly/rj-subscribe
    ****************************
    Arduino Step by Step Course (over 150 lectures) Starts here • Lesson 00 What is Ardu...
    ****************************
    If you found this tutorial helpful, please support me so I can continue creating contents like this. Here is PayPal link paypal.me/robojaxTV
    Follow me on Facebook robojaxTV
    Follow me on Twitter: / robojaxtv
    Follow me on Instagram: / robojax
    Robojax on Ticktok: / robojaxtv
    Tutorial by Robojax.com
    Get other projects code and learn Arduino
    robojax.com/learn/arduino
    *** AFFILIATE PROGRAM ***
    We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.
    #robojax #robojaxArduinoCourse #robojax16Channel
  • Наука та технологія

КОМЕНТАРІ • 119

  • @robertrobert5583
    @robertrobert5583 4 роки тому +2

    Another really clear video - thank you. I've been trying to get my head around MUX and watched several videos but yours was the best. I finally understand!

    • @robojax
      @robojax  4 роки тому

      Glad it was helpful!

  • @spare-parts-iii
    @spare-parts-iii Рік тому +1

    Thank robojax; your code helped me immensely

  • @RETRODISTORT
    @RETRODISTORT 5 років тому +3

    Great video, nice job!

  • @GaryMcKinnonUFO
    @GaryMcKinnonUFO 4 роки тому

    Very helpful indeed, liked and subbed thank you Ahmad. Gary from UK.

    • @robojax
      @robojax  4 роки тому

      You are welcome. Thank you very much.

  • @voltronicsautomation
    @voltronicsautomation 4 роки тому

    This is very supportive channel guys.. i love it.. keep on supporting this useful channel by do not skip ads.
    Love from Malaysia.
    #antiskipads

    • @robojax
      @robojax  4 роки тому +1

      Thank you very much. I appreciate it. Ahmad from Canada.

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

    I just used mcp23017. Now i try to use hc4067. I hope that it's work. Thanks for sharing

  • @peachville4383
    @peachville4383 4 роки тому +1

    I2C is a great tool and your video, as usual, explains every detail superbly! I'd like to add that I2C allows one to extend control to even more relay banks from one Arduino. Just recently I developed a non-I2C method to easily access hundreds of relays without MUX tables on a single Nano. :)

  • @aqak4772
    @aqak4772 5 років тому +1

    很棒!本人非常喜欢这种风格的视频教程。

    • @robojax
      @robojax  5 років тому

      谢谢。 我很高兴你喜欢。 艾哈迈德来自加拿大。

  • @elmirabagherzadeh9613
    @elmirabagherzadeh9613 4 роки тому

    Thanks!

    • @robojax
      @robojax  4 роки тому

      You are welcome. خوشحالم که مفید واقع شده. احمد خراسانی

  • @alirezamirghasemi
    @alirezamirghasemi 3 роки тому +2

    Thank you for this tutorial. In my project, using this multiplexers is challenging. it is the fact that you can only open one switch at a time. in real application you may need to open multiple doors at a time. therefore I also need a latching mechanism.

    • @jefmao
      @jefmao Рік тому +1

      Thanks for proposing this great question. When you say "open multi doors ***at a time***," do you mean "the loop iterates very fast hence the multiple door locks can be released one by one in a very short time?" Or, there could be another level problem that, "the 1st door lock solenoid (fired to unlock) is fired and kept fired even if the demultiplexer is firing the second solenoid." If the need is the later, a hardware/software latching could be a solution.

  • @michel.galvao
    @michel.galvao 4 роки тому +1

    I'm watching from Brazil

    • @robojax
      @robojax  4 роки тому

      Thanks from Canada ❤️

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

    I just want to know if we need to use 16 as an ac switch not individual blinking
    Can we use the multiplexer as well to control 16 relays as well? The highest number of pins available is 9 for such a job.
    Make it some useful 👍 to every use.

  • @rafikkhan4617
    @rafikkhan4617 3 роки тому

    👌👌👌👍

  • @bogdy704
    @bogdy704 Рік тому

    Hello i need to control 1500 relay individual can i use multiplexor in multiplexor ? If i can can you explain to me?

  • @QuickMind
    @QuickMind 5 років тому +2

    Loving your videos! I will try to do this but i want to use in my car (12v ) ... how can i do this? ardunino is 5v but the relays board i need 12v right?
    also, i need to control the relays and also a way to control 180 degree servo and 90 rectracts.. any idea? Thanks

    • @robojax
      @robojax  5 років тому

      You are welcome. I am glad you found them useful.
      the 16 channel module has voltage regulator that converts up to 16V to 5V. So watch the main video on this module ua-cam.com/users/robojaxTVsearch?query=16+channel+relay and I have other relay videos ua-cam.com/users/robojaxTVsearch?query=relay
      for servo pleas check my videos on servo ua-cam.com/users/robojaxTVsearch?query=servo

  • @Detroit_Playa
    @Detroit_Playa 3 роки тому +1

    Nice video

    • @robojax
      @robojax  3 роки тому

      Here is $200 Arduino course for free Arduino Step by Step Course (over 100 lectures) Starts here robojax.com/L/?id=338

  • @EnergySeeker
    @EnergySeeker 3 роки тому

    nice video , if i use the multiplixer with only s0 , s 1 and s2 then will it control 12 output ? but how the binary will be in this case ?

    • @robojax
      @robojax  3 роки тому +1

      If you use 3 bits, then modify the array holding the values for each buy. I have explained it.

  • @jefmao
    @jefmao Рік тому

    Thank you for your great demonstration. In addition, may I know that, does the de-multiplexer "holds" the value previously specified onto each channel when it leaves and loses control of that channel? (For ex., given C11=HIGH at time=0ms. I switch to and stay at C12 at 1ms~1000ms. What will happen to C11 during 1ms~1000ms?) Thank you in advance.

    • @jefmao
      @jefmao Рік тому

      Found the answer and a possible solution (not tested myself). Just FYI: electronics.stackexchange.com/questions/604406/finding-a-pass-through-demultiplexer-with-latch-register-on-output

    • @robojax
      @robojax  Рік тому +1

      You are welcome. I have demonstrated it where it shows if a relay is ON, holding or not. I don't have the circuit to check it. it is in the video.

  • @regal_7877
    @regal_7877 3 роки тому +2

    The problem with using a multiplexer/demultiplexer is that you can only control one output at a time based on what you input at the select lines. When you switch to a different channel, the previous one is cut off. For applications like these, it's better to use a SIPO shift register so it can hold the states of all the relays at once. Pair that with a 16 channel multiplexer and you get 16 complete relay modules.

    • @robojax
      @robojax  3 роки тому

      Yes. this is the nature of multiplexer. One INPUT/OUTPUT is connected at a time.

    • @regal_7877
      @regal_7877 3 роки тому

      @@robojax I have a question. What is the state of the pins that are not selected? For example, if I select the first channel of the multiplexer, what are the states of the other channels, are they high (source), low (sink) or hi-z? I want to feed the output of multiplexer to a D-latch.

    • @robojax
      @robojax  3 роки тому

      Here in page 1 www.ti.com/lit/ds/symlink/cd74hc4067.pdf?ts=1604525574083&ref_url=https%253A%252F%252Fwww.google.com%252F it say: In addition, these devices have an enable control which when high will disable all switches to their “off” state.

    • @regal_7877
      @regal_7877 3 роки тому

      @@robojax Oh yeah I read the datasheet, but I can't understand what happens to all other switches when the enable pin is low and only selecting one of the switches. I think I have to try it out to know

    • @Anssam-Shidon
      @Anssam-Shidon Рік тому

      @@robojax learn how to control all Mux together at the time @notes and volts

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

    Excellent video! If you wanted to have 4 of the 16 channel relay boards connected to 4 multiplexers, is that possible or do you run out of pins on the Arduino? Is there a different way to handle that scenario?

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

      Hello, The we would need expander module amzn.to/3xRdqoa for each relay module

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

      Sorry, I found it here s.click.aliexpress.com/e/_Dn4ybH5 you can get 16 input/ouput by using just two wires.

    • @Felipera_
      @Felipera_ Рік тому

      @@robojax this is also what I needed. thanks.

  • @Victor_Marius
    @Victor_Marius 3 роки тому

    In short, the 4 binary pins (s0 ... s3) selects the channel to do IO operations on it, EN pin has to be LOW all the time and SIG pin is used to send data to the selected channel. Can SIG pin be used to read data and do you have to do pinMode(controlPin[i], INPUT) and pinMode(SIG, INPUT)?

    • @robojax
      @robojax  3 роки тому

      Yes you can read pins and yes you should change the pin as input as you said.

  • @DaBuzz92
    @DaBuzz92 5 років тому

    Is there possibility to select more than one relay to turn on in one Time? For example, i want turn on relay 1,3,7,10,11. I Wonder if mux switch Time Will be fast enough to prevent relays from clicking.

    • @robojax
      @robojax  4 роки тому

      Actually I made this video to answer your question. Please watch it again and do not escape.

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

    Hi, thanks for the video, very useful. How can you connect more cd74hc4067 in chain, to explain better I would like to use a cd74hc4067 where I would attach the other cd74hc4067 is it possible to do it?

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

      Hi, yes I believe you can. Just use 4 other pins from Arduino connected to another module. Make sure when counter reaches to last digit which is 15, then start the other module. I needs some work but doable.

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

      @@robojax Thanks for the answer, but will you show me how to do it with a video?

  • @GaryMcKinnonUFO
    @GaryMcKinnonUFO 4 роки тому

    Hi Ahmad, i understand how you pass the channel address to the controlpin from the muxtable, i need to turn pumps on and off but i don't see how to turn an individual channel on then off again. Any help greatly appreciated if you have the time, thank you.

    • @GaryMcKinnonUFO
      @GaryMcKinnonUFO 4 роки тому

      I've just seen the answer in a question below, thanks ! :)

    • @robojax
      @robojax  4 роки тому

      You are welcome.

  • @MAX-ox3xh
    @MAX-ox3xh 3 роки тому

    So if you put 0 delay, will they run seemingly all at once? Thank you!

    • @robojax
      @robojax  3 роки тому +1

      don't forget this is mechanical device that turns ON/OFF. so it always takes time. if yo want all of them to work use it with this ua-cam.com/video/Q9aBI4ELKC4/v-deo.html or use Arduino Mega

  • @dannyk5084
    @dannyk5084 4 роки тому

    Can you make a video using this multiplexer controlling a bunch of 7 segment displays?

    • @robojax
      @robojax  4 роки тому

      Did you search for it? I already have it. I just searched for the word "seven" ua-cam.com/users/robojaxTVsearch?query=seven

  • @kartechindustries3069
    @kartechindustries3069 4 роки тому

    Can I use this to send analog signal will I get same signal at the out as jnput

    • @robojax
      @robojax  4 роки тому

      which output? the multiplexer is digital and it HAS to be digital. The relay can control anything you want.

  • @RD-ni7qe
    @RD-ni7qe 3 роки тому

    What if you wanted to switch on Relay #2 and Relay #7 at the same time? I don't think the multiplexer would allow for this.

    • @robojax
      @robojax  3 роки тому

      at the beginning I said how multiplexer work. only one at a time.

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

    Please make video on controlling these 16 relays with arduino with push buttons and display which relay is ON on lcd display

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

      wow. replay, push button, diplay. threee-in-one. No one will need it . you gotta pay someone to do it. You can hire me for $100/hour. Contact me via robojax.com contact page.

  • @OoohhhGeeeee
    @OoohhhGeeeee 3 роки тому

    Salam, do I get a motor reversed with it? Would like to swap two wires with a signal from a 3 pin Bldc.

    • @robojax
      @robojax  3 роки тому

      walaikum salaam, please watch this video ua-cam.com/video/JMBgGO07YLM/v-deo.html

  • @StoneTL
    @StoneTL 4 роки тому

    Will analog reading work in this method?

    • @robojax
      @robojax  4 роки тому +1

      sorry did not understand your question. you mean if connected to Analog input? yes. All analog pins are capable to work as digital pins.

  • @ManuelCastillo-kq3xy
    @ManuelCastillo-kq3xy 5 років тому

    OMG!!!! Thanks for the video. This is equal if I use 8 reley (SSD)? I can use left pins with other sensors (like DTH22 or HC-SR04 or DS18B20 or other)?

    • @robojax
      @robojax  5 років тому +1

      Yes of course you can. But I have mentioned that you can't control 2 relay at the same time. Only ONE relay at a time. And yes you can use SSD as well.

    • @ManuelCastillo-kq3xy
      @ManuelCastillo-kq3xy 5 років тому

      Robojax I can’t control 2 reley at some time? I can control reley1 for cooler and reley2 for heater. One off and other on, based in temp sensor, for example.

  • @luismiguelcosta5515
    @luismiguelcosta5515 5 років тому +1

    I built the system you are showing here. The only problem I found was how to switch off one relay without switching on another?

    • @luismiguelcosta5515
      @luismiguelcosta5515 5 років тому +1

      I found the solution - Turn ENABLE pin HIGH. Thanks anyway.

    • @robojax
      @robojax  5 років тому

      You are welcome. good to hear you resolved it.

    • @GaryMcKinnonUFO
      @GaryMcKinnonUFO 4 роки тому

      @@luismiguelcosta5515 Thanks Luis, i was wondering exactly that :)

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

    Cual es la diferencia entre usar un pin digital como tu estas usando y uno analógico para SIG ?

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

      Revisé el video y la página de códigos. se ha explicado en el código.

  • @boopeshkumarprabhakaran
    @boopeshkumarprabhakaran 3 роки тому

    Hi... Thanks for this video... As yu said multiplexer can't control more than 1 relay at a time... Is thier any alternative to make use of less pins in arduino and also control 2 or more relays at same time?

    • @robojax
      @robojax  3 роки тому +1

      Hi, yes you can and I have tones of videos on that. Here is how you can find a video in UA-cam channel in case of you didn’t know ua-cam.com/video/OhkUceBWcHs/v-deo.html

    • @boopeshkumarprabhakaran
      @boopeshkumarprabhakaran 3 роки тому

      @@robojax thanks for the reply... I scroll over your videos but can't find one..... It Would be great if you share here...

    • @robojax
      @robojax  3 роки тому +1

      I made that video so you can find . Watch the video please so you know how find

    • @robojax
      @robojax  3 роки тому +1

      I have 590 videos you can’t find it by scrolling. Search my friend search

    • @boopeshkumarprabhakaran
      @boopeshkumarprabhakaran 3 роки тому +1

      @@robojax lol... It would be great if you tell me what keywords to search for. Your are pro in it.. But I'm a newbe to arduino.

  • @shubham9672
    @shubham9672 3 роки тому

    Can we use this channel as input and signal pin as single output pin
    Can I take ADC value from channel to single out

    • @robojax
      @robojax  3 роки тому

      I used multiplexer. and it can be used for multiplexing and demultiplexing . if you set the EN pin in the code to HIGH it will act as demultiplexer meaning all outputs will be input. See the datasheet for further information www.ti.com/lit/ds/symlink/cd74hc4067.pdf

    • @shubham9672
      @shubham9672 3 роки тому

      @@robojax
      Thank you
      If I give EN logic high
      Then all pin will input
      So my question is which type of output I will get
      Can I join 14 analog sensors and get analog output from single pin of ic

  • @JunaidRahman2001
    @JunaidRahman2001 3 місяці тому

    Is there any module which can control all relays in parallel? Apart from using arduino mega or any other microcontroller

    • @robojax
      @robojax  3 місяці тому

      You can connect your own push button at the input connected to 5v you can control them without any microcontroller.

    • @JunaidRahman2001
      @JunaidRahman2001 3 місяці тому

      @@robojax automation has left the building

  • @EnergySeeker
    @EnergySeeker 3 роки тому

    in case if we have 2 multiplexer how that will be changed in the code ?

    • @robojax
      @robojax  3 роки тому +1

      just define all variables for 2nd module and use exact code. I just watched code section making sure I have explained it which indeed I did. so if you pay attention, you will learn how it works. if needed watch it 2 3 or 4 times and that is what I do if I don't learn something first time.

  • @funnyvlog9331
    @funnyvlog9331 Рік тому

    Hi sir, good day, can you give me an idea how to make 16 relay ON one by one, and off one time, then start again to one by one, and repeat over and over again. Thank you very much sir. I hoping for your reply.

    • @funnyvlog9331
      @funnyvlog9331 Рік тому

      Because sir I'm using 8 channel relay, my sequence is one by one ON from channel 1 up to 8,and How to off one time, then start again to one by one, and off one time again, repeatedly. Thank you sir.

  • @melickon
    @melickon 5 років тому +3

    10-th relay LED does not work?

    • @robojax
      @robojax  5 років тому +2

      Check the working. Software has no issue. Either wiring or the LED is bad.

    • @immenfreund1143
      @immenfreund1143 5 років тому +1

      @@robojax in your video at 18:36 LED at Relais 10 do not work.

  • @Omarbg95
    @Omarbg95 4 роки тому +2

    so the thing is that you can only turn one of the 16 Ch On? what if i want 2 or more at the same time? i need another component?

    • @robojax
      @robojax  4 роки тому

      then here is the video for that ua-cam.com/video/Q9aBI4ELKC4/v-deo.html

    • @veereshy5444
      @veereshy5444 4 роки тому

      Thank you for video. In case of ESP8266 this approach is not possible as there are very few GPIO pins. Do I have any option to expand the GPIO pins of ESP with mux so that I can individually control each relay?

  • @DrTRonik
    @DrTRonik 5 років тому

    Hi, can we control this system with "Teleduino" ? Thank you...

    • @robojax
      @robojax  5 років тому

      Never heard the "Teleduino" and just checked it. It is just web version of Arduino software and it should work exactly the same except instead of uploading the code from IDE you will use a web browser. There are more than 1 web base arduino has poped up recently.

  • @melickon
    @melickon 5 років тому

    1. How to control four of these modules? To cascade multiplexers somehow?
    2. How to turn on more than one relay at one time?

    • @robojax
      @robojax  5 років тому

      1-is possible, I have to write code for it
      2- is not possible with the multiplexer. multiplex mean connect multiple path or item to ONE. so only one can go through at a time. ;

    • @melickon
      @melickon 5 років тому

      ​@@robojax Thanks you for your answer!
      I have an idea of project, where I need to control 50 bulbs on one side and 50 buttons on other side (radio connected). For side with bulbs, I assume I need four of these modules, but I have not clue how to control them.

    • @SimpleEnough2k9
      @SimpleEnough2k9 5 років тому

      @@melickon Instead of the CD74HC4067 Multiplexers I'd go for some 74HC595 shift registers which would allow to have any combination of relays at will, with the proper programming and interfacing naturally. For the radio part, then nRF24L01 transceiver could be a good candidate. Globally, you would have one side controlled by an Arduino that will check which buttons are on or off, create some sort of control string, send it to the other arduino which in turns will process the received information and turn on the desired relays. At first glance I would think this is possible.

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

    Can share code for staircase lighting

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

      what is staircase lighting?

  • @_DanielSatria
    @_DanielSatria 3 роки тому

    any coding for this project?

    • @robojax
      @robojax  3 роки тому

      in the first 40 seconds I mentioned it.

    • @robojax
      @robojax  3 роки тому

      All my videos have code and separate web page on my website. It would be useless to just make video.

  • @shubhamjain4974
    @shubhamjain4974 3 роки тому

    i cant get the code

    • @robojax
      @robojax  3 роки тому

      up to you if you want to get it or not. but it is there. I just checked it.

  • @Felipera_
    @Felipera_ Рік тому

    20:48 music these days keep getting weirder

  • @melvingozo
    @melvingozo 4 роки тому

    Stopped watching after the sixth commercial interruption...what a pain - never watched a channel with soooooo many interruption.

    • @robojax
      @robojax  4 роки тому

      everything you get in life, you pay for it and when it come this, it becomes hard. why? I have spent hours (believe me more than a day) to wrote the code, test it find tune it so you use you get for FREE and use it. This is the least you can do for someone who has done something for you. I am sorry that people think the way you think. If you don't want interruption, then purchase my Arduino course the link is in the description.