Controlling a BIG LED Matrix?! How Shift Registers work! || EB#39

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
not too long ago a viewer sent me lots of electronic components which for example included a whole lot of different ICS two big motors and most importantly tons of my favorite electronic components LEDs but he did not only send over those ten millimeter light-emitting diodes but also three custom-made LED matrices which featured 32 LEDs in the x-direction and 12 LEDs in the y-direction so a total of whopping 384 LEDs per matrix those are so dots onto a big PCB to which also male and female headers as well as a couple of ICS capacitors and resistors are soldered onto now by applying a voltage directly to the LEDs we can see that they all still seem to work correctly so of course I want to use this LED matrix to display something useful like for example letters that is why in this video we will firstly reverse engineer the PCB connections then find out how the eye sees so-called shift registers are used to control the LEDs and finally what kind of my controller codes we have to write in order to properly control the matrix let's get started [Music] this video is sponsored by Jael CPCB whose Factory is even open to in Chinese New Year so that oversea customers can still get their common 2 layer PCBs so upload your Gerber files today to order 10 PCBs for only $2.00 let's start off with the two headers on the top of the PCB which are due to thick traces connected to one another in parallel after doing a bit of probing rounds I realized that the top four pins are connected to all the anodes of the LEDs in the first three lines which are the lines one two three the next four pins are connected to all LED I know it's in the lines four five and six and this wiring scheme then pretty much continues for the remaining eight pins and the lines 7 to 12 without questioning this wiring yet I moved on to the cathodes of the LEDs and found out that they all connect to a pin of the six available st-pierre 16 CEO of 596 ICS which according to the datasheet are 16 bits constant current LED sync drivers that means that this IC connects our LEDs cathode to grounds and lets a constant current flow through it's according to the utilised current set resistor value if there's a positive voltage connected to the LEDs anodes here begins the confusing part though because each of those ICS has only 16 outputs which means we could manage a total of 96 LEDs but we got four times that amounts with 384 the solution is that the cathodes of each individual LED in every fourth line are connected in parallel so by firstly connecting the upper three lines to the supply voltage we can control all the LEDs in those individual year by utilizing the LED year sink ICS then we can move on to the next three lines by switching the supply voltage and control those LEDs and then we switch over once more and then one last time in order to light up all the LEDs individually but we later go through those lines so quickly that our eyes do not notice this switching and instead sees a static picture this functional principle is called multiplexing and it can save us lots of control pins phone LED matrix but you should definitely watch my standalone multiplexing video if you're confused right now but anyway after I determined and wrote down which I see with which output pin is connected to which led cathodes it was time for me to find out how to actually control the LED drivers their data she told me that they're actually 16 bits C will in parallel out shift registers that feeds a 16-bit D type storage register which sounds super confusing at first but if we have a closer look at the block diagram we can easily understand what they mean the upper parts is our storage register and the lower part is the shift register so let's start with that as you can see it consists of 16 of those blocks with the labels d r q and CK which are codes D type flip-flops if we dig deeper we can find out that those d type flip-flops consists of one inverter and phone ends which are logic gates with two inputs and one output depending on whether a high or low voltage aka a one or zero is applied to the inputs they spit out a specific output voltage according to this truth table now feel free here to apply different states to the deal or data and CK or clock inputs and find out for yourself how the Q output changes but to spoil the fun let me tell you that only if your clock signal is rising this state of the data inputs is set on the outputs and stays there even if the data or clock inputs is low but of course if your data inputs is low and the clock rises you got your outputs pull down to low as well so basically here a g-type flip-flop can save this state of 1 bits on the inputs for our 16-bits shift register we got 16 of those flip-flops cascaded meaning the output of the first one is connected to the input of the second one and so on and on as an example let's set the SDI inputs to 1 and create a rising edge on the clock line the 1 now got saved on the output 1 while the other flip-flop outputs safe their zeros with the next rising edge the previously saved 1 gets shifted to the writes but the output of the first flip-flop stays 1 because the input is still at a high voltage now by going through 16 wise and clock cycles the ones get shifted to the right one step at a time we could even attach the serial data inputs of another shift register to the serial data outputs of the first shift register to get a total of 32 output pins why the data would still only shift from left to right but why would you want such an IC well if you listen carefully you probably noticed that we only use two pins in order to control 16 output pins or more this is important for microcontrollers with only a limited amount of GPIO pins who want to control a lot of electrical components like for example tons of LEDs in a big LED matrix the type of shift register we had a look at is called s IPO or serial-in parallel-out s-- which refers to the data type on the inputs and outputs there also exists sis o P is o and P IPO shift registers whose usage is also important but not as important as the s IPO type last but not least for oh I see we got the D type storage register which like the name implies are also simply d type flip-flops that means all we have to do is to trigger d connected I'll open up them once in order to Tran port the output of the shift register to logical ends whose output unable pin we can basically tie to grounds in order to finally connect these shift register outputs to the constant current outputs of course you can also find all this information in the truth table and timing diagram of the IC stata sheets but anyway after more investigation I noticed that the input of the LED driver Isis are not directly connected to the lower male headers but instead to two sn7 for LS 1 5 CS which are hex Schmitt trigger inverters to clean up the data signal but once again feel free to watch my video about Schmidt triggers to truly understand their purpose nevertheless after use my multimeter with its continuity function to find out which male had a pin ultimately connects to which led driver inputs I connected the unable pin to ground hooked up all these serial data pins the clock pin and the latch pin to push buttons and finally connected power to the matrix as you can see if I keep the serial data input higher and alternate between triggering the clock and the latch pin you can see that the ones slowly get shifted food the shift register from left's two rights which proves the theory we talked about earlier but since push-button control will never grant us complete control over the matrix I rather connected the data inputs to not we know Nano which I then hooked up to my computer in the codes I set up the timer one of the at mega ready to appear in order to create a timer compare interrupt at 100 microseconds and 200 microseconds which I used to set the serial data and the clock line next I created a small boolean matrix in order to form the word high and continued by utilizing the timer compare interrupts to set the serial data inputs according to this boolean matrix afterwards it was time to upload the codes which as you can see you worked flawlessly to add a bit of excitement though I set up a second timer which executes a timer compare interrupt every 10 milliseconds this way I created a small but let's face it pretty inefficient function that lets the boolean matrix values move one step to the right every 1/2 seconds after uploading this codes this new function seemed to work acceptable well but we only utilized the upper three lines of horror since I did not implement its multiplexing yet to do that I added four p-channel MOSFETs with pull-up resistors to the male supply voltage headers whose gates I then connected to for more digital pins of the Arduino next I created a way bigger boolean matrix which contained the word cool modified a determine impaired function in order to cycle through the four three line segments of the LED matrix while triggering the correct LEDs and finally uploaded the codes and as you can see here what I had in mind did work out but not perfectly yet because with this video I did not only wanted to show you how easy and awesome it is to work with shift registers but also that programming codes for such a big matrix can be quite challenging and with that being said I hope you enjoyed this video and learned something new if so don't forget to Like share and subscribe stay creative and I will see you next time
Info
Channel: GreatScott!
Views: 445,895
Rating: undefined out of 5
Keywords: led, LED, matrix, big, multiplex, control, drive, shift, register, tutorial, guide, beginners, diy, make, project, explain, SIPO, serial, parallel, in, out, how, to, constant, current, flip, flop, bit, state, truth, table, clock, data, output, NAND, AND, inverter, push, button, arduino, code, sketch, timer, timers, atmega328p, atmega, frequency, hex, schmitt, trigger, enable, latch, circuit, greatscott!, greatscott, electronic, electronics, basics, basic, d type
Id: Degt4HUzWXY
Channel Id: undefined
Length: 12min 33sec (753 seconds)
Published: Sun Feb 03 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.