Designing LED Matrix Circuit
LED matrix is the number of LEDs arranged in columns and rows. Those LEDs are then used to display images or text that usually displayed with certain animation effects. Therefore, the LED matrix is often referred to as the Running Text or Moving Sign.
Arrange LEDs as matrix
MXLED is a simulator of the circuit matrix of LEDs. With this simulator, we can try to program the LED matrix controllers even without the hardware. MXLED made LED matrix by arranging the LEDs on the vertical lines and horizontal lines. We must provide the number of rows of horizontal lines (we make eight lines). Then, we also make as many vertical lines of columns. Arrangement of vertical lines and horizontal images are as follows:
Lines of vertical and horizontal are not connected. Then, at each meeting point between the vertical and horizontal lines, attach a LED by connecting its anode to the horizontal lines and its cathode to the vertical lines. Installation of these LEDs are as shown below:
By installing LEDs as above, the light up LED is the LED where the anode is connected to the horizontal lines which is high (1) and the cathode is connected to the vertical lines which is low (0). There is only one low vertical line at a time, while other line must be kept high. This low vertical line we refer to as the active column. Unlike the vertical lines, horizontal lines consisting of eight lines may has high or low value without having to pay attention to the other horizontal lines.
To give the voltage on this horizontal line, we can not directly connect it to port. This is caused by the need for large electrical currents. Therefore, horizontal lines are the powered using a PNP transistor as shown below:
Each horizontal line given a transistor like the picture above. In this way, to make the horizontal lines can give the current to the LED, then the base must be low state (0). Meanwhile, if the base was given a high state, then the line could not provide current to the LED.
As horisontol lines, vertical lines can not be controlled directly using the port. This is caused by the large amount of current that must be sunk into the ground. Therefore, we can use the NPN transistor to sink current from these vertical lines. Way of installation is as shown below:
Each vertical line is controlled using a transistor as shown above. If the base was given a high condition (1), then the line (column) will be an active line. Conversely, if the base were given the condition of low (0), then the line becomes inactive column.
As already mentioned above, there is only one column that should be active, while the other columns must be inactive. There are many ICs that output works like that. One of the cheapest is the 4017.
Too bad that this IC only has 10 outputs. Thus, we can only make the controls to 10 columns 🙁
Relax, we can use other tricks to extend the control capabilities of this 4017. The trick is to make the block columns. The columns are grouped into block of columns. Each block columns consists of 10 columns. The columns in each block columns are numbered from 0 to 9. So, column 0 is the column 0 of block 0, column 10 is the column 0 of block 1, column 21 is column 1 of block 2, and so on.
Each base of the column with the same number are combined into one and is controlled by an output of 4017. For example, the base of the column 0 is connected to the base of the column 10, column 20, column 30, and so on. Then the bases which have become one, controlled by the Q0 of 4017.
From the picture above, we can see that although the base of column 0 and column 10 are controlled concurrently, but the column that can sink current is only the column with the active block. Seen that way of controlling the “column” or “block columns” is the same. If the number of block columns is only a few, then the controlling block of columns can be done directly using the port of the microcontroller. However, if the number of block columns is quite a lot, then the block columns can also be controlled using the other 4017. So, we develop a multilevel 4017, ie 4017 units (control column) and 4017 tens (the controlling block of columns). And if the number of block columns more than 10, then we can make the next level, ie 4017 level in the hundreds.
To cascade 4017 as above, is by connecting the carry output of 4017 units level as the input clock for the 4017 of tens level. And if there is 4017 of hundreds level, then the carry output of 4017 of tens level is used as the input clock for the 4017 of hundreds level. And so on. While the reset input of all of 4017 are combined into one. Thus, the overall control system only requires two lines for columns control, ie the input clock (clock input for 4017 of unit level) and the reset input (composite of all reset of 4017). Thus, the preparation of the LED matrix is exactly the same as the MXLED simulation.
Power Current Calculation
From the explanations above, we can see that there are three kinds of transistors viewed from the position. First is the row controller transistor, second is the column (unit) controller transistor, third is the column block (tens) controller transistor. Of course this calculation assuming that the number of columns are not more than 100 columns.
Calculation of the row controller transistor current
If each LED using a current of I, then the total maximum amount of current through the line control transistor is I x number of columns. For example, if each of our LEDs designed to use 5mA current and the number of columns are 30 columns, then the row controller transistor should be able to drain 5 x 30 = 150mA current.
The next question is, what is the value of collector resistor of the transistor?
To answer these questions, we should see the path of current from the power supply to get to the ground. First, the power supply current enter the PNP transistor through the emitter to the collector. Then passes through the collector resistor, then continues to enter into LED, enter into the collector of column controller, then enter the collector of the block columns controller.
If the power supply used is 5V, how much is the clamp voltage across the resistor? The voltage across the resistor is 5V – V on LED – VCE line controller tansistor – VCE of column controller transistor – VCE of column block controllers transistor. LED clamp voltage is typically about 1.7 V, but there are some types of LEDs which have a clamp voltage of up to 3V. While VCE transistors in saturation state is typically around 0.3 V. We assume that we use a regular LED with a clamp voltage of 1.7 V. Thus, the voltage across the resistor pin is 5 – 1.7 – (3 x 0.3) = 2.4 V.
Once we know the clamp voltage at the collector resistor of the line controller transistor, to calculate the magnitude of the resistor is R = V / I = 2.4 V / 150mA = 16 ohms. Too bad that we might be difficult to obtain this value of 16 ohms. So we can use a slightly lower value, eg 15 ohms, so that the LED current will be slightly higher, or use a little higher, for example 18 ohms, so that the LED current will be slightly lower.
Things should be kept on the LED matrix design like this is, that these calculations is the calculation of the current if the scanning is running. If scanning is not running, then a current of 150mA will be entered on one LED alone ❗ And currents of this magnitude would likely destroy the LED. So, we must take precautions so that the current should only flow if scanning process has been running. A little good news is, if we use the MCS-51 as a controller, so when the reset (the scanning process is not running) port is always in a state of high. So, if the base of line controller transistor is connected to the MCS-51 port, so it can be sure that the current will not flow to the LEDs on the reset state. However, you must ensure that the program will not hang. Because if the program hangs and stops the scanning process, then it means disaster for your LED matrix. And if you are not sure that your program can run smoothly, then you can reduce the LED current so that even if the scanning process is not running, current flows are still small enough to be able to be borne by one LED.
To calculate the base resistor value of the line controller transistor, we only consider the transistor to work as a transistor switch, which is so current that flows is the saturation current. With the calculation of the collector current of 150mA, then we can use the C9012 transistor that has a current gain of about 150. We can take a value of 100 to make it more secure. With the gain of 100 and the collector current of 150mA, then the base current should be about 1.5 mA. Clamp voltage at the base resistor is approximately 5V – VBE, where VBE is about 0.7 V. Thus, the clamp voltage at the base resistor is about 4.3 V. Thus, the base resistor value is 4.3 V / 1.5 mA = 2K8. And again that this value is not available values. So we could slightly reduce the value to the nearest number of available, namely 2k7.
Calculation of the column controller transistor current
Column controller will sink as much current number of rows in that column. And we have determined that the number is eight lines. If we have determined that the LED current is 5mA, then the maximum current to be sunk by the column controller transistor is 8 x 5mA, which is 40mA. With the value of this, we simply use the C9013 transistor to control the column. The Gain of C9013 transistor is also about 150. And as before, we take saver value to 100 only. With the gain of 100 and the collector current of 40mA, then the base current in the column controller transistor is 0.4 mA.
Clamp voltage at the base resistor of the column controller transistor is the output voltage of 4017 minus 2x the VBE voltage. If we use a 5V power supply, then the output voltage of 4017 is approximately 4.8 V. Thus, the clamp voltage at the base resitor is about 4.8 – 2 x 0.7 = 3.4 V. Thus, the base resistor value of the column controller transistor is 3.4 V / 0.4 mA = 8K5. And again, this value is not available values. So, just use the 8K2.
Calculation of the block columns controller transistor current
The block columns controller transistor will sink as much current in the column controller transistor x 10, which is 10 x 40mA = 400mA. From the datasheet, C9013 has a maximum collector current of 500mA. So, we can still use the C9013 to controll block columns.
Clamp voltage at the base resistor of the block columns controller transistor is the voltage used to control this transistor reduced by 1x VBE. If we also use 4017 to control the block column, then the clamp voltage across the base resistor of the block columns controller transistor is approximately 4.8 – 0.7 = 4.1 V. Thus, the value of the base resistor of the block columns controller transistor is 4.1 V / 4mA = 1K.
That’s it. Happy trying ❗
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.Please notice that comment or question submitted should match the topic.