Electronic Basics #5: How to Multiplex

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so you just finished building an awesome 4x4 by for RGB LED cube or a 10 by 5 LED matrix and you want to control each LED individually the matrix contains of 50 LEDs and the cube of 3 by 64 LEDs so 192 LEDs and that's the moment you realize that you are screwed because none of your microcontrollers have this many i/o pins not even the Arduino mega with its whopping 50 for iOS is enough so I'm going to show you how to control many LEDs with only a few iOS and I will only use an Arduino Nano one TLC five nine four zero LED driver five p-channel MOSFETs the F 9 5 4 0 n 1 to K resistor and five 1k resistor I think the principle is easier to explain with an LED matrix so let's build one I just sold on my LEDs to a PCB like normal but now happens the magic I connect all cathodes or negative pins of all LEDs in one column and repeat this process for all columns now I connect the anodes or positive pins of all LEDs in one row and I made sure that the anodes and cathodes touch nowhere and it's done now I have my five anode rows right and ten calf out columns down I also sold out some female headers to those to make connecting easier and just for better view and programming for later I labeled D columns from a to J and D rows from A to E this maps my LEDs clearly like shown in this schematic now we connect positive voltage to a and ground to a and led a a lights up that could save us a lot of i/o pins of the Arduino as long as we only light up one LED everything works fine but when we want to light up a a and GA we also light up J a and a e so this does not work that is when we use multiplexing we light up each row individually and one offer the other but we go through the rows so fast that our eyes don't notice and just see a static complete picture but one row can draw up to 200 milliamps with 10 LEDs so we cannot connect those to one i/o we have to use a p-channel MOSFET as a switch I'm using the f9 5 4 0 n and connect gate to my i/o source to 5 volts and drain to the anode rows and I use 10 outputs of my tlz 59404 the 10 cathode columns you can take a look at my schematic to get all the connections right gate of MOSFET Rho a 2 nano pin 8 MOSFET Rho 2 2 pin 7 row 3 2 pin 6 row 4 2 pin 5 row 5 2 pin for this is also written in my Arduino code which you can download tlz pin 28 to column 1 GHz pin 1 column-two TLC pin 2 to column 3 and so on until TLC pin 9 2 column 10 the rest wiring of the TLC is well described in the schematic we also need 5 1k resistor as pull-up resistors between the gate of each MOSFET and 5 volts and 1 2k resistor to set the constant current of the tlz to 20 milliamps per LED ok let's get to the code working with the tlz can be really difficult if you write the code from scratch but that is not what we want we're going to use great toz library from the arduino playground just place the library in your libraries folder and you can include it in your sketch the code is much easier than it looks like and I wrote it by myself so there's tons of things to optimize and criticize if you just upload the code like this you should see a moving sine wave I also made the static Road house and the moving letter E nothing spectacular and here we see what happens when I increase the on time of a row we can clearly see that it's not one complete picture but single rows which light up one after the other if you wish to understand the code a little better and use it then go ahead and download it I comment every line and hopefully make it easy to understand as you can see it works quite well with the sine wave and I will use this concept in my upcoming video of the RGB LED cube I hope you learned something today if so don't forget to Like share subscribe and I will see you next time
Info
Channel: GreatScott!
Views: 493,088
Rating: undefined out of 5
Keywords: Electronics (Field Of Study), multiplex, tutorial, LED, matrix, control led, arduino, tlc5940, p channel mosfet, electronics, how to, greatscott!, technology, multiplexing, gadget, demo, how to multiplex
Id: uQMUPhyoXoE
Channel Id: undefined
Length: 4min 54sec (294 seconds)
Published: Sat Mar 22 2014
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.