Multiplexing (for beginners) - Ec-Projects

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to easy profits today I will be talking about multiplexing so in my two latest videos I have been showing a circuit where I used multiplexing with a microcontroller to drive some 7-segment displays I also mentioned that one of these analog to digital converter chips uses multiplexing for the output signal so I thought I would made a video that explains what multiplexing is so to power up a light bulb like this you will need some voltage across it say 12 volts here and 0 volts here if you add a switch to the circuit either here or here you will be able to turn off the light bulb and of course it doesn't matter if we disconnect the ground or the positive so now imagine if we have 109 points that would mean 100 switches right but this is where multiplexing comes in that's all about reducing the number of switches that you have to control a given number of light bulbs and by using a very simple technique we can reduce the number of switches to 20 and to demonstrate how we can do this we will take an example of 9 type bulbs we will take one terminal of each light bulb and connect them across the row and we will also connect the other terminal of each lamp across the cone and in a configuration like this one you'll need six contacts so control nine lamps compared to the nine we would use in a traditional configuration the only thing is that we'll have to turn on two switches instead of one so say if you want to turn on this light bulb it will turn on this switch we will have our 12 volts this side and we'll have our 0 volts at this side so to turn on this light bulb all we'll have to do is turn on the switch and the switch so current can flow through here and it cannot turn on any of the other light bulbs even though this one and this one also gets the 12 volts but it cannot get to ground because the circuit is open at these points we can also turn on this one and this one at the same time because they in the same column or we could turn on this one and this one at the same time but we will not be able to turn on for example this one and this one because that will also light up lease them and let's try to explain that to turn on this lamp you will need to turn on this switch and the switch and to turn on this Lane you'll have to turn on the switch and this switch but remember we have also turned this one on so current can flow from this one and through this one I have the same with these two so basically at one side you can turn on as many switches as you want to light up more lamps at the same time but you can only keep one on at a time at the other side so what do we do if we want to light up an X what we can do is basically switch between the columns very very fast and then switch in the rows as it's needed so for the first column we will switch on the top one and the bottom one it quickly switches to the second column and will turn on the middle row it switches to the third column and we'll turn on the top and the bottom row again and this will repeat and if this goes at about a few hundred Hertz you will not be able to notice that they are not on at the same time but this will of course mean that every of these columns will only be on at any given time and they will be off for the rest of the time so that will give us a 33% on time and unfortunately that will also mean a 33.3% brightness well all this might seem as a bad trade-off you only save three pins and you lose 66% of the brightness but let's just add another seven lamps and let's see what will happen and I'm sorry it doesn't look pretty but I hope you get the idea you can see for adding seven more lamps we only got two more switches so now we have eight switches to control sixteen lamps and these numbers would be 25% instead and if we scale this to ten by ten we will have twenty switches to control one hundred lamps we can of course also do this with seven segment displays where we will have seven traces to control the digits that is one for the decimal point as well but we don't necessarily need that and they will only be added one extra wire for each display so if you add a third display you will only get one extra wire you could add 800 this place and you will just have a hundred of these wires plus the seven for the segment's or eight if you want to include the dot point so if you had 100 displays that would be 700 pins if you are not using multiplexing and with multiplexing that will be 107 of course as I said we have to make this alternating between the displays so fast that we cannot see them flickering if this goes very slow it will just update one and the other one the other if it goes a little bit faster we will start to see the displays flickering and if it goes as fast as it should we will not even notice that they're being multiplexed so in this demonstration I added the option to increase the delay between the updates so if you press this button you can easily see the individual display lighting up and you might notice the brightness is increasing as well when the display is lighting up but on average the brightness will be the same as if I release the button but it will look much more uniform and in the end we will take a look at the code I used to drive these displays I am using a 4511 driver chip so the signal coming from this microcontroller will be a binary coded decimal the 4511 will translate that into the seven segments so that can be displayed on these seven segment displays I am simply using a transistor to switch in the ground for each display when that display needs to be updated so the transistors will alternate and switch in the correct display I have also built up an example of an LED matrix that is driven through multiplexing Here I am alternating between the rows switching in the ground with a transistor and the columns go to the microcontroller I'm just using the pins directly for the columns because only one of these LEDs is on at a time but mall LEDs can be on at a time across the rows so I will need a transistor to that because microcontroller cannot sink all that current and we will also take a look at the code for this one but before we get to the code let's take a look at this schematic follow the circuit with the 7-segment displays I am using a pic16f54 controller and I'm using that to send a signal to this 4511 decoder chip I have already done a video of this one so you can check that out if you want to know more about this tip but all this basically does is to convert a binary number in so the signal that is needed to drive a seven segment display so you go from four wires so seven wires we use some current limiting resistors because this circuitry is running at 5 volts and the individual segments in the displays cannot take that so we need a resistance and as you can see after these resistance this display has all its segments linked to the corresponding ones of this display and if you had three or four displays you will just link in those segments as well so in slow-motion what is happening here is the pic has some code in it if you want to ride tin to these displays it will send a one to the decoder that will set a one on these pins and the pic will turn on this transistor so it will share a 1 and this display and this one is turned off so this will be blank when this has lit up for a fraction of a second this transistor will turn it off again the microcontroller will put a 0 here and this will be translated into the segments the pic will turn on this transistor and it will light up a 0 here and this will of course be off so this display will be blank and when this is going very fast you cannot see that only one is on so let's take a look at the code and all this first part of the code is not that important I have said everything to be outputs except for one pin in the 4e because I need that for my button to slow down the display so with as you saw we could see multiplexing I have started up a time of that I'm using and this is basically just to do with the time and after this time I end up with a variable B that will increment to 9 and reset to zero and here I have my delay and that simply if the button is not pressed that the label be a thousand microseconds and if it is priced the delay will be 8500 microseconds so we will be able to see the displace alternating I set the port a 2-0 remember this was these two transistors so they will both be off I said port C equal to B so it will display the number of it and I said port a 2 1 and a 1 in binary is of course just a 1 and the binary number for party corresponds to the pins on the tip so there will be 6 pins and it will take the 6 least significant digits when this is set to 1 this value will show up on the first display and it will delay for either thousand or 80,000 microseconds depend depending if the button is pressed or not and it will do exactly the same thing for the other display and notice we have a 2 here and that will of course be a 0 1 so the first pin will be off and the next pin will be on so this will be off and this will be on and you could of course put another variable here if you wanted something else to display on the second display I just choose the same and if you had to use this in a product you probably would not have these delays in there because that the code will just sit there for 5 microseconds doing nothing and wait for delay to expire and then move on and if I had a first display I would do exactly the same and this time I will set party to four because he four will be zero so one you could of course put this fall in binary by writing a 0 B followed by your bits and this might be a little bit easier to see the pins on the pole a is called our a followed by the number of the pin starting with zero and pin 0 will be the first digit pin 1 next pin 2 3 4 5 & 6 & 7 but in this case 6 & 7 is not left there's only 0 from 2 5 serve six pins so the way that I did the dot matrix display was exactly the same I had a 5 by 5 array this is only a 4 by 4 it doesn't matter so I had 5 transistors instead of the two with the 7-segment displays and I had 5 inputs on this side as well I did exactly the same thing with the transistors connected to a property and the other inputs to the display were from port C and here just made a software counter that increments a by 1 every time the code runs through and I just did something different to this number for each of the lines I start by turning off all the transistors of blanking the display I change the column here and I enable the line that I want to light up I then increment I by 1 so it's ready for the next time the code runs through and that's a little delay here if then moves on set for a to 0 again blanking the display changing the column here have another variable B and I will take that divide it by 100 and subtract that from 31 so that will basically count down instead of up I then set prodigy to 2 so this will fuel on the second line of the display and so on for the rest of the code except when I get to the fourth line then I have to skip a pin here because I free cannot be an output that can only be an input so I have to skip that and then exactly the same with this last one so there is of course a lot more to multiplexing than this you could go three dimensions instead of two dimensions you could connect the LEDs up in different ways drive the displays in different ways make different patterns and so on but anyway this was just meant to be a brief introduction so I hope you liked the video and if you did please give it a thumbs up and subscribe to my channel see
Info
Channel: EcProjects
Views: 54,331
Rating: undefined out of 5
Keywords: DIY, Electronics, Microcontroller (Computer Processor), PIC16f616, multiplexing, 4511, display, Do It Yourself (Website Category), dot matrix, 7 segment
Id: rOAzENzgA8U
Channel Id: undefined
Length: 18min 24sec (1104 seconds)
Published: Mon Dec 23 2013
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.