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

  Рет қаралды 57,486

Robojax

Robojax

Күн бұрын

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 жыл бұрын
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 Жыл бұрын
Thank robojax; your code helped me immensely
@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.
@RETRODISTORT
@RETRODISTORT 5 жыл бұрын
Great video, nice job!
@robojax
@robojax 5 жыл бұрын
Thank you.
@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 жыл бұрын
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
@alirezamirghasemi
@alirezamirghasemi 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 Жыл бұрын
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.
@aqak4772
@aqak4772 5 жыл бұрын
很棒!本人非常喜欢这种风格的视频教程。
@robojax
@robojax 5 жыл бұрын
谢谢。 我很高兴你喜欢。 艾哈迈德来自加拿大。
@peachville4383
@peachville4383 4 жыл бұрын
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. :)
@robojax
@robojax 4 жыл бұрын
Yes. indeed.
@elmirabagherzadeh9613
@elmirabagherzadeh9613 4 жыл бұрын
Thanks!
@robojax
@robojax 4 жыл бұрын
You are welcome. خوشحالم که مفید واقع شده. احمد خراسانی
@michel.galvao
@michel.galvao 3 жыл бұрын
I'm watching from Brazil
@robojax
@robojax 3 жыл бұрын
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.
@Detroit_Playa
@Detroit_Playa 3 жыл бұрын
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
@QuickMind
@QuickMind 5 жыл бұрын
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 kzfaq.infosearch?query=16+channel+relay and I have other relay videos kzfaq.infosearch?query=relay for servo pleas check my videos on servo kzfaq.infosearch?query=servo
@bogdy704
@bogdy704 Жыл бұрын
Hello i need to control 1500 relay individual can i use multiplexor in multiplexor ? If i can can you explain to me?
@regal_7877
@regal_7877 3 жыл бұрын
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
@rafikkhan4617
@rafikkhan4617 3 жыл бұрын
👌👌👌👍
@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 жыл бұрын
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 Жыл бұрын
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.
@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.
@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.
@DaBuzz92
@DaBuzz92 4 жыл бұрын
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.
@neelranade6322
@neelranade6322 2 жыл бұрын
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.
@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.
@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.
@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?
@MAX-ox3xh
@MAX-ox3xh 3 жыл бұрын
So if you put 0 delay, will they run seemingly all at once? Thank you!
@robojax
@robojax 3 жыл бұрын
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 kzfaq.info/get/bejne/h5-RdaxlqrKvc2g.html or use Arduino Mega
@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.
@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 kzfaq.info/get/bejne/gLNymqqAlZ29fIE.html
@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" kzfaq.infosearch?query=seven
@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 жыл бұрын
Revisé el video y la página de códigos. se ha explicado en el código.
@StoneTL
@StoneTL 4 жыл бұрын
Will analog reading work in this method?
@robojax
@robojax 4 жыл бұрын
sorry did not understand your question. you mean if connected to Analog input? yes. All analog pins are capable to work as digital pins.
@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
@luismiguelcosta5515
@luismiguelcosta5515 5 жыл бұрын
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 жыл бұрын
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 :)
@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
@EnergySeeker
@EnergySeeker 3 жыл бұрын
in case if we have 2 multiplexer how that will be changed in the code ?
@robojax
@robojax 3 жыл бұрын
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.
@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 жыл бұрын
Hi, yes you can and I have tones of videos on that. Here is how you can find a video in KZfaq channel in case of you didn’t know kzfaq.info/get/bejne/hc6biMaWp73HeKc.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 жыл бұрын
I made that video so you can find . Watch the video please so you know how find
@robojax
@robojax 3 жыл бұрын
I have 590 videos you can’t find it by scrolling. Search my friend search
@boopeshkumarprabhakaran
@boopeshkumarprabhakaran 3 жыл бұрын
@@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.
@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 жыл бұрын
10-th relay LED does not work?
@robojax
@robojax 5 жыл бұрын
Check the working. Software has no issue. Either wiring or the LED is bad.
@immenfreund1143
@immenfreund1143 5 жыл бұрын
@@robojax in your video at 18:36 LED at Relais 10 do not work.
@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 жыл бұрын
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.
@faiyyazmulla9883
@faiyyazmulla9883 2 жыл бұрын
Can share code for staircase lighting
@robojax
@robojax 2 жыл бұрын
what is staircase lighting?
@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.
@Omarbg95
@Omarbg95 4 жыл бұрын
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 kzfaq.info/get/bejne/h5-RdaxlqrKvc2g.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.
@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.
@_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.
@Felipera_
@Felipera_ Жыл бұрын
20:48 music these days keep getting weirder
@robojax
@robojax Жыл бұрын
LOL
@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.
How many relays can I connect to one Arduino?
9:38
AnotherMaker
Рет қаралды 49 М.
Жайдарман | Туған күн 2024 | Алматы
2:22:55
Jaidarman OFFICIAL / JCI
Рет қаралды 1,8 МЛН
Does size matter? BEACH EDITION
00:32
Mini Katana
Рет қаралды 18 МЛН
MCP23017 Port Expander and ESPHome: Add More I/O Pins to Your Project
20:39
Solving I2C Address Conflicts - TCA9548A I2C Multiplexer
24:29
DroneBot Workshop
Рет қаралды 100 М.
Using Shift Registers to Get UNLIMITED GPIOs for our project !!
12:40
Multiplexing Arduino Inputs: 16 Analogue Sensors on 2 Analogue Pins!
14:49
Charis Cat // Child of an Android
Рет қаралды 13 М.
MegaMUX - 32 Channel Multiplexer Board and Tutorial
9:54
SeanHodgins
Рет қаралды 32 М.
Arduino relay basics - how it works and how to use it
7:19
Taste The Code
Рет қаралды 10 М.
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 8 МЛН
После ввода кода - протирайте панель
0:18
Up Your Brains
Рет қаралды 1,3 МЛН
Hisense Official Flagship Store Hisense is the champion What is going on?
0:11
Special Effects Funny 44
Рет қаралды 3,1 МЛН