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.
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.
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!
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 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.
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.
@@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
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. :)
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
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
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.
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)?
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.
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.
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.
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
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.
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
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?
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
@@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
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?
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.
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?
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.
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?
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
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.
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.
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. ;
@@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.
@@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.
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.
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)?
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.
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.
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.
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.
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.
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!
Glad it was helpful!
Thank robojax; your code helped me immensely
I just used mcp23017. Now i try to use hc4067. I hope that it's work. Thanks for sharing
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.
Yes. this is the nature of multiplexer. One INPUT/OUTPUT is connected at a time.
@@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.
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.
@@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
@@robojax learn how to control all Mux together at the time @notes and volts
I'm watching from Brazil
Thanks from Canada ❤️
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. :)
Yes. indeed.
Hello i need to control 1500 relay individual can i use multiplexor in multiplexor ? If i can can you explain to me?
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
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
This is very supportive channel guys.. i love it.. keep on supporting this useful channel by do not skip ads.
Love from Malaysia.
#antiskipads
Thank you very much. I appreciate it. Ahmad from Canada.
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.
I've just seen the answer in a question below, thanks ! :)
You are welcome.
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)?
Yes you can read pins and yes you should change the pin as input as you said.
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 ?
If you use 3 bits, then modify the array holding the values for each buy. I have explained it.
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.
Great video, nice job!
Thank you.
Please make video on controlling these 16 relays with arduino with push buttons and display which relay is ON on lcd display
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.
Cual es la diferencia entre usar un pin digital como tu estas usando y uno analógico para SIG ?
Revisé el video y la página de códigos. se ha explicado en el código.
Is there any module which can control all relays in parallel? Apart from using arduino mega or any other microcontroller
You can connect your own push button at the input connected to 5v you can control them without any microcontroller.
@@robojax automation has left the building
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.
at the beginning I said how multiplexer work. only one at a time.
Nice video
Here is $200 Arduino course for free Arduino Step by Step Course (over 100 lectures) Starts here robojax.com/L/?id=338
Very helpful indeed, liked and subbed thank you Ahmad. Gary from UK.
You are welcome. Thank you very much.
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.
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
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.
in case if we have 2 multiplexer how that will be changed in the code ?
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.
So if you put 0 delay, will they run seemingly all at once? Thank you!
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
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?
Hello, The we would need expander module amzn.to/3xRdqoa for each relay module
Sorry, I found it here s.click.aliexpress.com/e/_Dn4ybH5 you can get 16 input/ouput by using just two wires.
@@robojax this is also what I needed. thanks.
Can I use this to send analog signal will I get same signal at the out as jnput
which output? the multiplexer is digital and it HAS to be digital. The relay can control anything you want.
I built the system you are showing here. The only problem I found was how to switch off one relay without switching on another?
I found the solution - Turn ENABLE pin HIGH. Thanks anyway.
You are welcome. good to hear you resolved it.
@@luismiguelcosta5515 Thanks Luis, i was wondering exactly that :)
Can we use this channel as input and signal pin as single output pin
Can I take ADC value from channel to single out
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
@@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
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?
then here is the video for that ua-cam.com/video/Q9aBI4ELKC4/v-deo.html
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?
很棒!本人非常喜欢这种风格的视频教程。
谢谢。 我很高兴你喜欢。 艾哈迈德来自加拿大。
10-th relay LED does not work?
Check the working. Software has no issue. Either wiring or the LED is bad.
@@robojax in your video at 18:36 LED at Relais 10 do not work.
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.
Actually I made this video to answer your question. Please watch it again and do not escape.
Salam, do I get a motor reversed with it? Would like to swap two wires with a signal from a 3 pin Bldc.
walaikum salaam, please watch this video ua-cam.com/video/JMBgGO07YLM/v-deo.html
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?
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.
@@robojax Thanks for the answer, but will you show me how to do it with a video?
Will analog reading work in this method?
sorry did not understand your question. you mean if connected to Analog input? yes. All analog pins are capable to work as digital pins.
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?
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
@@robojax thanks for the reply... I scroll over your videos but can't find one..... It Would be great if you share here...
I made that video so you can find . Watch the video please so you know how find
I have 590 videos you can’t find it by scrolling. Search my friend search
@@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.
Can you make a video using this multiplexer controlling a bunch of 7 segment displays?
Did you search for it? I already have it. I just searched for the word "seven" ua-cam.com/users/robojaxTVsearch?query=seven
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.
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.
Can share code for staircase lighting
what is staircase lighting?
1. How to control four of these modules? To cascade multiplexers somehow?
2. How to turn on more than one relay at one time?
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. ;
@@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.
@@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.
Thanks!
You are welcome. خوشحالم که مفید واقع شده. احمد خراسانی
any coding for this project?
in the first 40 seconds I mentioned it.
All my videos have code and separate web page on my website. It would be useless to just make video.
Hi, can we control this system with "Teleduino" ? Thank you...
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.
i cant get the code
up to you if you want to get it or not. but it is there. I just checked it.
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)?
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.
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.
👌👌👌👍
20:48 music these days keep getting weirder
LOL
Stopped watching after the sixth commercial interruption...what a pain - never watched a channel with soooooo many interruption.
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.