This is very well done and super clear. The application I have experimented with that led me to your video is creating a multi-cell battery discharge tester. I would like to use the multiple analog inputs measure the voltages of a number of 18650 lithium cells (recycled from a laptop, e.g.) under load over time, all at once. The challenge with these old cells for ebike and electric vehicles is getting batteries of equal capacity. There are easy ways to measure the capacity of single cells but not many cells at once. A multiplexer solution would allow testing of the many cells needed in a shorter time frame. Thanks for the excellent video.
I could see where I could use this to control a relay board - each relay controls a high power motor or other device. Also, to control camera by selecting one camera at a time - but you can use many cameras around your property with only one Screen output. Love this video !!
This is a really good example of usage of a multiplexer. A lot of times when this is introduced its just introduced vaguely as "here is a multiplexer it has select lines and one output" instead of being given different applications like using it for driving LCD monitors, having multiple sensors etc. You can really appreciate the multiplexer in combination with microcontrollers.
I know this is not what you do anymore and that you are somewhere else on your path But daym!! You have the best walkthrough-how to-show and tell videos out there for someone learning this stuff. I wish I had found your channel years ago M8 🙂. Btw: Usecase. Monitoring a plethora of temperature and pressure sensors in a air to water heat pump system.
Hey Klaus, thank you for the comment. I've actually started a new channel that's more in line with what I do now: industrial automation. I guess all those years spent in embedded systems paid off. Really appreciate the kind comments.
Great stuff for an Arduino beginner such as me. I plan to use Multiplexing for a project where I want to re create a track control panel for a model railroad.
Nice! Comes in really useful when you want to measure slower signals. From looking at the datasheet, the atmega328p can sample 15000 times per second at max 10 bit ADC resolution which can measure 1 x 7.5 KHz signal (good old Nyquist...should apparently sample slower than this to avoid aliasing but whatever.). Using your setup you can now instead measure 2 x 3.75 kHz signals, 3 x 2.5 KHz signals etc using only one pin! I would use this setup for a temperature measurement systems where you want to map the temperature at hundreds of different locations, for example to find where the heat is distributed in my apartment and find out where the heat is leaking out in winter :)
+Michael Segev very good point mike! I haven't really gone through the drawbacks of this setup, but you can't have "everything". This would be adequate for 90% of analog applications; not for high speed ones.
Thanks for this interesting tutorial. If you please I just want to know what happens if two or more buttons are pressed simultaneously ? does it still reads the values or not ??
very informative keep it up .me as a beginner I see a solution looking for a problem😆 I wish if you could make more examples of where to use such a chip thanks
nice clear tutorial! would there be any electrical implications if I use two back to back to achieve routing from multiple inputs to multiple output? like increase in resistance, a decrease in the signals amplitude or maybe a delay?
Thank you for this video, it is really helpful. Just a question, can I see the value of analogue inputs at the same time, for example, if I press two bottoms simultaneously, will i see two values in the array?
Yes, each loop the code cycles through all 8 addresses in the multiplexer and grabs the current value so at the end/beginning of the loop you have an array with all of the values, so you will see a value for every button/input in the array
Very cool explanation. You mentioned flow in terms of sensing and analog input. So if I had an array of flow sensors how would this count each pulse and increment a flow value?
+Clayton Allen If you have an array of analog sensors, you would get a reading from each one of them into the array. After that, you can use any of the values stored there for any purpose in your program.
I was wondering. Can you use many resistive inputs on an arduino pin like for example for controlling the indicator function including left right and hazards on a vehicle?
@@SolisPLC Since he mentioned it near the end of his video, I was referring to using it for analog outputs, not inputs. If you're driving the analog device, you're only driving it momentarily.
Great tutorial! Thanks so much! I have used the 74HC595N before for a series of digital outputs. With limited understanding of how they actually work. :D For a new project a need to read a series of analog inputs (where the 74HC4051 might come in handy). And also control a series of analog outputs (or digital with PWM). I am still struggling with the difference between mulitplexers like this and shift registers. How specific is their use? Could I use another one instead? Could I use this one for analog outputs, too? Or could I just the 74HC595N I already have for this job? Would be super greatful for any hints. THANKS!!!!
I see a number of pins are used to address which input is being read at which time. I am looking into a project that may need many analog inputs (basically 10+ temp sensors). Obviously the way this system works won't scale well as more and more pins will be consumed to specify input addresses. I was thinking that combining multiplexers with shift registers, where the shift registers will specify which analog address you are wanting to read would massively reduce the number of pins needed. What are your thoughts on this? I was hoping to avoid having to use multiple controllers having to talk to each other to get a bunch more analog inputs.
If you are using push buttons you could also tie one side of each button to ground with a different value resistor. That way each button will have a different analog read value so you can diferenciate them. And only uses one pin
Just a quick question: I want to use the multiplexed for several moisture sensors, if I understand, the moisture sensors should be connected to the Y0-Y7, while S0-S3 to a digital pin each, Z to an Analog pin, and VCC to 5V pin?
how much minimum voltage can be read ? what is the resistance between input and output ( e.g Z and y0). why I asking this is as I want to interface multiple sensor to be read.
I wander if you can tell me how can you make this counter to count 0 to 15 with 15 dip switches . Let say dip switch 1 dual led shows 01 then add dip switch 2 and show 02 and so on. Every time add on dip switch so to read 15 all 15 dip switches must be on. Please help.
4052 has two banks of four inputs going to two output pins. (Or vice versa since the ins and outs are bidirectional.) You could read 8 values using two analog pins on the mC but that would require some wiring and code changes. While you would need two analog pins for input, it would require only two output pins for channel selection.
Good day, I came across your video, and thank you for the information, I am new to Arduino had done one or two projects but mostly learn as I go. I would like to ask if it is possible that you could explain how the binary bit of the code works, I understand the incrementale part of the binary sets, what I am wondering is how are you writing the correct addresses for each input? Are you just cycling through the bits and the chip only responds to the correct addresses or is there another thing going on that the addressing is precise? I hope this makes sense? Kind regards.
Great Video. Is there any way to add LEDs to the circuit and the code so that when the buttons are pressed the LEDs will light up. Also is possible to add a toggle to the code so that each time you press a button it alternates between 0 and 1023? thanks
You would probably want to add a second multiplexer in output mode, though if you use a compatible multiplexer you can connect the address pins to the same address pins as the first multiplexer so that you only need one additional pin. Yes, there are examples of toggle buttons in code but it is just a matter of toggling a bool value when the button is just pressed
Great stuff, this just took me from 2 megas down to one, with a bit more PCB work. Next step for me is to figure out how to read 0-120v via an analog pin, once I can do that my project will be a go.
I believe a normal voltage divider would suffice if you are only measuring the voltage (The power draw is basically voidable). With 2 resistors, 120v to 5 volt would be divided with 1 resistor being 24 times higher than the 2nd ( 120 / 5 = 24 ). Using www.ohmslawcalculator.com/voltage-divider-calculator 2 resistors with values 27 Ohm ( Closest to 24 and under 5v ) and 1 Ohm would give a reference voltage of 4.286V between the 2 resistors. This output would be linear to the input!
Same MUX used on Akai Apc40 and my master fader is not working (only one). Try to find why is it so, cause a numbers of pots are connected to same mux that fader attached to..
I am building a ckt to read and report various states (24VAC or 0) in a heat pump to an esp8266. Interesting chip. I am going to see what it's max input is. Maybe I can just rectify the single out to the esp.
awesome job!...do you know of a way to use an arduino mega as a game controller? I didn't know enough and bought one not realizing they're not preprogrammed to emulate a controller like the teensy or the leonardo.
i am going to read 4 sensor analog values into pin A0 for web interface its should read 4 analog sensor values one after another ......i need know what's the method for this and what are the changes i need to make in Coding
With multible 16 channel multiplexer what is the maximum input (ie. Buttons) you can get on a audino board? Also do you need to consider extra power sources?
hi nice tutorial is it possible to read analog values and put them seprately in a variable for uploading it to a iot cloud i am asking it for nodemcu cause it have just one analog pin
can i read the value indivisuali from each pin ? i want to use multiple analog sensor but i have only 1 analoginput (Nodemcu esp8266).....want to extend ......................so thanks alot . can u make another tutorial on above topic ..............BIG HELLP if you do.
you look at "i" in binary form. for example if i=5 in the loop then it will be: [1]*2^2 + [0]*2^1 + [1]*2^0 which is represented as 101 or B00000101 in binary. So the goal is to activate the 6th (0..7) analoug in order to get it's value and the way to do it is by sending the S0,S1,S2=HIGH,0,HIGH to the multiplexer. The code resolves the logical statements: 1) B00000101 & B00000001 = B00000001, 2) B00000101 & B00000010 = B00000000, 3) B00000101 & B00000101 & B00000100 = B00000100. HIGH is actually the boolean True (or integer other than zero) and LOW is the boolean False (or zero) so HIGH && B00000001 is actually HIGH\True\"Integer other than zero" and HIGH && B00000000 is LOW\False\zero
i did something wrong because my pins never read 0 even with a pulldown/up resistor. my wiring is probably wrong, i'll redo it. as to functionality and/or code, all working great. thank you!
this tells the 74HC4051 which channel you want to listen to. In this example its channel 1. Then the 74HC4051 sends the value for channel 1 to the arduino
you look at "i" in binary form. for example if i=5 in the loop then it will be: [1]*2^2 + [0]*2^1 + [1]*2^0 which is represented as 101 or B00000101 in binary. So the goal is to activate the 6th (0..7) analoug in order to get it's value and the way to do it is by sending the S0,S1,S2=HIGH,0,HIGH to the multiplexer. The code resolves the logical statements: 1) B00000101 & B00000001 = B00000001, 2) B00000101 & B00000010 = B00000000, 3) B00000101 & B00000101 & B00000100 = B00000100. HIGH is actually the boolean True (or integer other than zero) and LOW is the boolean False (or zero) so HIGH && B00000001 is actually HIGH\True\"Integer other than zero" and HIGH && B00000000 is LOW\False\zero
I have a real world use for this circuit. I have about 15 strawberry planters that will freeze this winter on my balcony if I don't do something. Bringing them inside is not a good option. I want to measure the temp of all my planters with an LM35 and I want to use some resistors to give them just enough heat so as not to freeze. It will get down to -10'F. So if I can use perhaps 5 watts worth of 1/2 watt resistors and keep the temp to about 37'F. I should be okay. In summary I need to Mux 15 Analog inputs and 15 digital outputs to the tune of perhaps 5 watts.
NISHIT MISTRY this would be a very interesting and potentially confusing block of code, I would imagine. Do you think it would require nesting multiple "for" loops to read the pins within series of mux?
hello, great video,very inspiring, ...it gave me an idea. how can i control 8 Fotorezistors and log the lighting conditions over from each individual Fotorezistor(placed in different areas) using just arduino or just one raspberry pi ? basicaly i want to place 8 sensors around a small room and log the light intensity throughout a day. i'm thinking that neither arduino or raspberry pi has enough gpio pins... please help me understand how i could log data from 8 Fotorezistors at the same time placed in different areas.
What happens when you push multiple buttons at the same time? Do you get a reading on multiple channels or just one?(whichever button was pushed first, last, etc)
Hi, nice project and smooth presentation. Not sure you're still monitoring the comments on this video, but I try it anyway 🙂 What happens if you press 2 , 3, 4 buttons at the same time? if this works, what would be the maximum voltage you can receive? Thanks in advance for your answer
Hi Alexandre, it's me - Vlad! I'm onto a different channel that involved industrial automation instead of the hobbyist stuff I used to do. Pressing multiple buttons works, the drawback of this implementation is latency. In other words, you only read one sensor at a time, but you read them in sequence. So it's slower, but only uses a single pin on the Arduino. The voltage is 5VDC based on the Arduino, but I'm sure you can scale that if necessary.
@@SolisPLC Hi, thank you for your answer, I'll have a look at your other channel. I found some videos where the guys use registers shift modules, which allow for interesting multiplexing functions (ua-cam.com/video/nXl4fb_LbcI/v-deo.html from Kevin Darrah). In my project, I'm looking for a solution to read the multiple voltages of a battery pack made of several 18650 cells. The challenge is to stay below that 5V limit.
hi all. new to this. can i ask if this will be better for back ground noise or worse. and if its one pin will this work on atTiny 8 pin. Thanks in advance, great vid,
how about reading 9 analog sensors if the 3 of them are voltage divider and the rest are acs712? as i know the voltage divider and acs712 have different codes in callibration? sorry, i'm just a beginner
Great job, i looking for video for combing many temperature sensors with this IC chip, can you help me to get the codes and connections. any help will be appreciated
Nice .. 👍😎 How can i use this with 74HC595 ... With 16x outputs LEDs ... 16 Switchs... 16x input and 16x outputs. How can i turn off and on each Led ... I have 2 x. 74HC595. With 16x Running leds and 10x different FX. Can i use this to control each FX ? And Each LED.. ? Thank you.. In Advance..
I have a similar-ish setup, but I try to read really fast (38 KHz) and I’ve run into the problem that when I switch the input the first three to 8 readings (depenging on the impedance, using an impedence) becomes inaccurate (High spikes when switching). The strange thing is that it’s the first three readings no matter the read speed (9kHz up to 64 kHz) so I find it hard to believe that it’s the adc which needs time for charges to settle (since then it would take a fixed amount of time, not reads). Do you have any ideas what’s going on here?
This is very well done and super clear. The application I have experimented with that led me to your video is creating a multi-cell battery discharge tester. I would like to use the multiple analog inputs measure the voltages of a number of 18650 lithium cells (recycled from a laptop, e.g.) under load over time, all at once. The challenge with these old cells for ebike and electric vehicles is getting batteries of equal capacity. There are easy ways to measure the capacity of single cells but not many cells at once. A multiplexer solution would allow testing of the many cells needed in a shorter time frame. Thanks for the excellent video.
I could see where I could use this to control a relay board - each relay controls a high power motor or other device.
Also, to control camera by selecting one camera at a time - but you can use many cameras around your property with only one Screen output.
Love this video !!
This is a really good example of usage of a multiplexer. A lot of times when this is introduced its just introduced vaguely as "here is a multiplexer it has select lines and one output" instead of being given different applications like using it for driving LCD monitors, having multiple sensors etc. You can really appreciate the multiplexer in combination with microcontrollers.
Thank you, thank you, thank you. Finally got my project working. Just want to read one potentiometer at a time.
man, you just saved me I was about to give up figuring this out
Thank you for this video. The datasheet wasn't so clear for amateurs and this tutorial really helps.
"For whatever reason you have 20 potentiometers and you have to read them." exactly what i want it for😂😂
Only 20?
@Janna for making a glove which reads movement based on potentiometer readings
In my case there are output of 6 current sensors and diagnostic signals. But idea behind how to read them remains the same as guy in video explained..
I know this is not what you do anymore and that you are somewhere else on your path
But daym!! You have the best walkthrough-how to-show and tell videos out there for someone learning this stuff.
I wish I had found your channel years ago M8 🙂.
Btw: Usecase. Monitoring a plethora of temperature and pressure sensors in a air to water heat pump system.
Hey Klaus, thank you for the comment. I've actually started a new channel that's more in line with what I do now: industrial automation. I guess all those years spent in embedded systems paid off. Really appreciate the kind comments.
Thank you, I was trying to figure out why my multiplexers werent working.
I didnt knew that pins 6 and 7 had to be grounded
Great stuff for an Arduino beginner such as me. I plan to use Multiplexing for a project where I want to re create a track control panel for a model railroad.
I've watched several tutorials on this argument, none worked (at least for me) except this. Thank you.
Vlad . Absolutely great lesson. Thank you very much for your time and knowledge sharing. Very appreciated.
Thank you very much Vlad. Very nice tutorial and very nice explanation as always. Love your tutorials. Please make them coming.
Nice! Comes in really useful when you want to measure slower signals.
From looking at the datasheet, the atmega328p can sample 15000 times per second at max 10 bit ADC resolution which can measure 1 x 7.5 KHz signal (good old Nyquist...should apparently sample slower than this to avoid aliasing but whatever.). Using your setup you can now instead measure 2 x 3.75 kHz signals, 3 x 2.5 KHz signals etc using only one pin!
I would use this setup for a temperature measurement systems where you want to map the temperature at hundreds of different locations, for example to find where the heat is distributed in my apartment and find out where the heat is leaking out in winter :)
+Michael Segev very good point mike! I haven't really gone through the drawbacks of this setup, but you can't have "everything". This would be adequate for 90% of analog applications; not for high speed ones.
This is bloody good especially for a beginner as me
Bro wonderful. Thank you so much for this video.
Excellent tutorial! Thank you for a perfectly clear explanation!
Thanks for this interesting tutorial. If you please I just want to know what happens if two or more buttons are pressed simultaneously ? does it still reads the values or not ??
You earned a new Sub today.
Dear you shared an excellent approach can you please shored how we can use audio sensors to trigger any an event in Arduino ...........
Thank you Vlad. Fantastic tutorial as always.
I was thinking of using this as part of an eight channel radio control transmitter. It should be easy enough.
2:14 if you have pins 6,7,8 on ground why does the table show pin 7 as supply voltage
very informative keep it up .me as a beginner I see a solution looking for a problem😆 I wish if you could make more examples of where to use such a chip thanks
It's looks like Sam Tyrell knows about electronics.
Bilge Kaan Atay all the readings were for something!
do you mean Samwell Tarly?
tone step closer to my electronic drums! thanks alot!
This video help so much, man! Thanks a lot!
thanks! I really appreciate the in depth explaination in this video. Do you have a video which involves multiple multiplexers?
nice clear tutorial! would there be any electrical implications if I use two back to back to achieve routing from multiple inputs to multiple output? like increase in resistance, a decrease in the signals amplitude or maybe a delay?
Thanks a lot...really informative video
Thank you for this video, it is really helpful. Just a question, can I see the value of analogue inputs at the same time, for example, if I press two bottoms simultaneously, will i see two values in the array?
Yes, each loop the code cycles through all 8 addresses in the multiplexer and grabs the current value so at the end/beginning of the loop you have an array with all of the values, so you will see a value for every button/input in the array
Very cool explanation. You mentioned flow in terms of sensing and analog input. So if I had an array of flow sensors how would this count each pulse and increment a flow value?
+Clayton Allen If you have an array of analog sensors, you would get a reading from each one of them into the array. After that, you can use any of the values stored there for any purpose in your program.
It works if I connect two analog sensors to the same analog pin ?, excellent video
I'm still learning Arduino programming and need to display the voltage in the serial monitor.
awesome video, great explanation of the concept
Very interesting, TKS! Is there a way to do the same for digital input/output as well?
I was wondering. Can you use many resistive inputs on an arduino pin like for example for controlling the indicator function including left right and hazards on a vehicle?
If you use this for analog outputs, won't you run into problems since the output signal will float when it's not being selected?
Sure, but you can mitigate for that in software. In other words, only read the input when a selection is made.
@@SolisPLC Since he mentioned it near the end of his video, I was referring to using it for analog outputs, not inputs. If you're driving the analog device, you're only driving it momentarily.
just what i needed, very cool
Can you chain link more 8 channel multiplexers, or would you need a 16 channel multiplexer?
nice video,is possible to put a pot were you have the swiches?
Great tutorial! Thanks so much! I have used the 74HC595N before for a series of digital outputs. With limited understanding of how they actually work. :D For a new project a need to read a series of analog inputs (where the 74HC4051 might come in handy). And also control a series of analog outputs (or digital with PWM). I am still struggling with the difference between mulitplexers like this and shift registers. How specific is their use? Could I use another one instead? Could I use this one for analog outputs, too? Or could I just the 74HC595N I already have for this job? Would be super greatful for any hints. THANKS!!!!
i have the same question. did you manage to use the 74HC595 in the end?
Exactly what i'm looking for. Tnx man!
Hey I was wondering if this sort of setup works with a differential signal like CAN signals?
I see a number of pins are used to address which input is being read at which time. I am looking into a project that may need many analog inputs (basically 10+ temp sensors). Obviously the way this system works won't scale well as more and more pins will be consumed to specify input addresses.
I was thinking that combining multiplexers with shift registers, where the shift registers will specify which analog address you are wanting to read would massively reduce the number of pins needed. What are your thoughts on this? I was hoping to avoid having to use multiple controllers having to talk to each other to get a bunch more analog inputs.
If you are using push buttons you could also tie one side of each button to ground with a different value resistor. That way each button will have a different analog read value so you can diferenciate them. And only uses one pin
Nice job. Thank you kindly for upload. What happens when more than one button is pushed at a time?
Answer this damn question OP.
dude thank you!
Just a quick question: I want to use the multiplexed for several moisture sensors, if I understand, the moisture sensors should be connected to the Y0-Y7, while S0-S3 to a digital pin each, Z to an Analog pin, and VCC to 5V pin?
yes, I guess so
I need to multiplex and demultiplex, positive and negative voltages, so can I use cd74hc4067 for this purpose
how much minimum voltage can be read ?
what is the resistance between input and output ( e.g Z and y0).
why I asking this is as I want to interface multiple sensor to be read.
I wander if you can tell me how can you make this counter to count 0 to 15 with 15 dip switches . Let say dip switch 1 dual led shows 01 then add dip switch 2 and show 02 and so on. Every time add on dip switch so to read 15 all 15 dip switches must be on. Please help.
Hey can i use the 4052 multiplexer ic instead of 4051? With this same code and connection please i need help i cant find the 4051 ic here
4052 has two banks of four inputs going to two output pins. (Or vice versa since the ins and outs are bidirectional.) You could read 8 values using two analog pins on the mC but that would require some wiring and code changes. While you would need two analog pins for input, it would require only two output pins for channel selection.
Good day, I came across your video, and thank you for the information, I am new to Arduino had done one or two projects but mostly learn as I go.
I would like to ask if it is possible that you could explain how the binary bit of the code works, I understand the incrementale part of the binary sets, what I am wondering is how are you writing the correct addresses for each input? Are you just cycling through the bits and the chip only responds to the correct addresses or is there another thing going on that the addressing is precise? I hope this makes sense? Kind regards.
Great Video. Is there any way to add LEDs to the circuit and the code so that when the buttons are pressed the LEDs will light up. Also is possible to add a toggle to the code so that each time you press a button it alternates between 0 and 1023? thanks
You would probably want to add a second multiplexer in output mode, though if you use a compatible multiplexer you can connect the address pins to the same address pins as the first multiplexer so that you only need one additional pin. Yes, there are examples of toggle buttons in code but it is just a matter of toggling a bool value when the button is just pressed
Great stuff, this just took me from 2 megas down to one, with a bit more PCB work.
Next step for me is to figure out how to read 0-120v via an analog pin, once I can do that my project will be a go.
I believe a normal voltage divider would suffice if you are only measuring the voltage (The power draw is basically voidable). With 2 resistors, 120v to 5 volt would be divided with 1 resistor being 24 times higher than the 2nd ( 120 / 5 = 24 ). Using www.ohmslawcalculator.com/voltage-divider-calculator 2 resistors with values 27 Ohm ( Closest to 24 and under 5v ) and 1 Ohm would give a reference voltage of 4.286V between the 2 resistors. This output would be linear to the input!
Same MUX used on Akai Apc40 and my master fader is not working (only one). Try to find why is it so, cause a numbers of pots are connected to same mux that fader attached to..
I am building a ckt to read and report various states (24VAC or 0) in a heat pump to an esp8266. Interesting chip. I am going to see what it's max input is. Maybe I can just rectify the single out to the esp.
You can press 2 buttons twice?
Is it possible to have two of these and make an 8x8 grid?
Yes, just use 3 more pins to select the next 4051 to create a matrix.
Nice tutorial. Would you have a source for the breadboard pots? Thanks!
does it applicable in limit swtiches?
awesome job!...do you know of a way to use an arduino mega as a game controller? I didn't know enough and bought one not realizing they're not preprogrammed to emulate a controller like the teensy or the leonardo.
i am going to read 4 sensor analog values into pin A0 for web interface its should read 4 analog sensor values one after another ......i need know what's the method for this and what are the changes i need to make in Coding
REALLY GREAT !!! I'm building a controller for audio mixing...
It's a very nice video. Could you teach me how to read the values sequentially in Arduino by connecting more than 3 mpu6050s to 74hc4051?
Mpu6050 runs via I2C.
So to run up to 8 6050's you'd need to use the 4051 to switch the i2c data line.
Can be done.
With multible 16 channel multiplexer what is the maximum input (ie. Buttons) you can get on a audino board? Also do you need to consider extra power sources?
Thanks for this. Very nice
HOW CAN I HAD MORE MULTLPLEXER AND THE CODE THANK YOU
hi nice tutorial is it possible to read analog values and put them seprately in a variable for uploading it to a iot cloud i am asking it for nodemcu cause it have just one analog pin
can i read the value indivisuali from each pin ?
i want to use multiple analog sensor but i have only 1 analoginput (Nodemcu esp8266).....want to extend ......................so thanks alot .
can u make another tutorial on above topic ..............BIG HELLP if you do.
At t:415.66 I noticed forth column changed state. Without you touching that button.
(and again at t:432.69)
Hats off to your logic. Working perfectly but spent the whole day but did not understand
" digitalWrite(pin_Out_S2, HIGH && (i & B00000100));"
@@jumbo999614 hahahahaha
you look at "i" in binary form. for example if i=5 in the loop then it will be: [1]*2^2 + [0]*2^1 + [1]*2^0 which is represented as 101 or B00000101 in binary. So the goal is to activate the 6th (0..7) analoug in order to get it's value and the way to do it is by sending the S0,S1,S2=HIGH,0,HIGH to the multiplexer. The code resolves the logical statements: 1) B00000101 & B00000001 = B00000001, 2) B00000101 & B00000010 = B00000000, 3) B00000101 & B00000101 & B00000100 = B00000100. HIGH is actually the boolean True (or integer other than zero) and LOW is the boolean False (or zero) so HIGH && B00000001 is actually HIGH\True\"Integer other than zero" and HIGH && B00000000 is LOW\False\zero
Thanks , It’s useful information :P
i did something wrong because my pins never read 0 even with a pulldown/up resistor. my wiring is probably wrong, i'll redo it. as to functionality and/or code, all working great. thank you!
I need to read 13 LDR values. Can I do that with this?
Yes. You need another resistor for build a voltage divider with each one LDR.
How to daisy chain it with 74hc595 please
If you have both analog and digital sensors, then It's better to use analogRead() than digitalRead() because it covers both analog & digital right?
could you explain me how works the following piece of code?
High && ( i & B00000001)
The answer to this would be helpful :). I'd subscribe for this answer :))
this tells the 74HC4051 which channel you want to listen to. In this example its channel 1. Then the 74HC4051 sends the value for channel 1 to the arduino
you look at "i" in binary form. for example if i=5 in the loop then it will be: [1]*2^2 + [0]*2^1 + [1]*2^0 which is represented as 101 or B00000101 in binary. So the goal is to activate the 6th (0..7) analoug in order to get it's value and the way to do it is by sending the S0,S1,S2=HIGH,0,HIGH to the multiplexer. The code resolves the logical statements: 1) B00000101 & B00000001 = B00000001, 2) B00000101 & B00000010 = B00000000, 3) B00000101 & B00000101 & B00000100 = B00000100. HIGH is actually the boolean True (or integer other than zero) and LOW is the boolean False (or zero) so HIGH && B00000001 is actually HIGH\True\"Integer other than zero" and HIGH && B00000000 is LOW\False\zero
I have a real world use for this circuit. I have about 15 strawberry planters that will freeze this winter on my balcony if I don't do something. Bringing them inside is not a good option.
I want to measure the temp of all my planters with an LM35 and I want to use some resistors to give them just enough heat so as not to freeze. It will get down to -10'F. So if I can use perhaps 5 watts worth of 1/2 watt resistors and keep the temp to about 37'F. I should be okay.
In summary I need to Mux 15 Analog inputs and 15 digital outputs to the tune of perhaps 5 watts.
Hello! How do I use two or three interconnected multiplexer, totaling 28 or 42 channels? Thanks in advance.
You would need to connect the output of the mux to the input of another. This would split one of your mux inputs into 8.
Ok. Thank you.
And what about the code for that if i want to create any case for any particulate pin input ?
I would be interested to see how to expand this, as well. Did you follow up on this?
NISHIT MISTRY this would be a very interesting and potentially confusing block of code, I would imagine. Do you think it would require nesting multiple "for" loops to read the pins within series of mux?
hello, great video,very inspiring, ...it gave me an idea.
how can i control 8 Fotorezistors and log the lighting conditions over from each individual Fotorezistor(placed in different areas) using just arduino or just one raspberry pi ?
basicaly i want to place 8 sensors around a small room and log the light intensity throughout a day.
i'm thinking that neither arduino or raspberry pi has enough gpio pins...
please help me understand how i could log data from 8 Fotorezistors at the same time placed in different areas.
What happens when you push multiple buttons at the same time? Do you get a reading on multiple channels or just one?(whichever button was pushed first, last, etc)
Hi, nice project and smooth presentation. Not sure you're still monitoring the comments on this video, but I try it anyway 🙂
What happens if you press 2 , 3, 4 buttons at the same time? if this works, what would be the maximum voltage you can receive?
Thanks in advance for your answer
Hi Alexandre, it's me - Vlad! I'm onto a different channel that involved industrial automation instead of the hobbyist stuff I used to do. Pressing multiple buttons works, the drawback of this implementation is latency. In other words, you only read one sensor at a time, but you read them in sequence. So it's slower, but only uses a single pin on the Arduino. The voltage is 5VDC based on the Arduino, but I'm sure you can scale that if necessary.
@@SolisPLC Hi, thank you for your answer, I'll have a look at your other channel.
I found some videos where the guys use registers shift modules, which allow for interesting multiplexing functions (ua-cam.com/video/nXl4fb_LbcI/v-deo.html from Kevin Darrah).
In my project, I'm looking for a solution to read the multiple voltages of a battery pack made of several 18650 cells. The challenge is to stay below that 5V limit.
Sir
I want 8 analog input and 8 digital output with this IC 74HC4051N or have some others IC
what should I do if I have to store these data separately into seprate variables..
What if i want to press more than 1 button at the same time ?
is there any code for that?
hi all. new to this. can i ask if this will be better for back ground noise or worse. and if its one pin will this work on atTiny 8 pin. Thanks in advance, great vid,
great software
how about reading 9 analog sensors if the 3 of them are voltage divider and the rest are acs712? as i know the voltage divider and acs712 have different codes in callibration? sorry, i'm just a beginner
Great job, i looking for video for combing many temperature sensors with this IC chip, can you help me to get the codes and connections.
any help will be appreciated
Nice .. 👍😎 How can i use this with 74HC595 ... With 16x outputs LEDs ... 16 Switchs... 16x input and 16x outputs. How can i turn off and on each Led ... I have 2 x. 74HC595. With 16x Running leds and 10x different FX. Can i use this to control each FX ? And Each LED.. ? Thank you.. In Advance..
It's possible to multiplexing a multiplexor?? I'm serching for the cheapest way to digitalice 577 analog inputs of LDR for a musical proyect. Thanks!
very nice
i tried the mulplexing using your codes on the same Arduiuno, the codes seem like your but it keeps bringing error can I have your help?
Anyone know how to get the individual analog values? So that I can map and constrain it? Thank you in advance
SIr, what type of multiplexing does this project use FDM, WDM or TDM?
is this all work in one time or work 1 analoge in one time
if iam using analog pin, how to enable pin IC4051d?
I have a similar-ish setup, but I try to read really fast (38 KHz) and I’ve run into the problem that when I switch the input the first three to 8 readings (depenging on the impedance, using an impedence) becomes inaccurate (High spikes when switching). The strange thing is that it’s the first three readings no matter the read speed (9kHz up to 64 kHz) so I find it hard to believe that it’s the adc which needs time for charges to settle (since then it would take a fixed amount of time, not reads). Do you have any ideas what’s going on here?