Mobile phones and gadgets

Mobile phones and gadgets

» How to properly assemble a matrix of LEDs. Dynamic indication. Connecting the LED matrix to the microcontroller. Firmware and settings

How to properly assemble a matrix of LEDs. Dynamic indication. Connecting the LED matrix to the microcontroller. Firmware and settings

In recent years, LED matrices have become widespread in outdoor advertising and various information boards. Quite bright, dynamic - they perfectly attract attention and do not go blind on a sunny day. Each of you sees them on the streets of your city every day.
Of course, their distribution was facilitated by the low price (due to Chinese manufacturers) and the ease of assembly of the screen.

But what if you try to use such matrices in your devices on microcontrollers? What is the exchange interface and output logic of these matrices?
Let's try to figure it all out.

The Chinese offer both the matrices themselves of different sizes and with different resolutions, as well as controllers for displaying images on them with various simple effects, as well as all the necessary accessories, connecting cables, frames.
Matrices are found as single-color (white, yellow, red, green, blue), and 3-color (RGB). The designation of the matrix model usually looks like Pxx or PHxx, where xx is a number indicating the distance between pixels in millimeters. In my case it is P10. In addition, matrices of some standard sizes are not only rectangular, but also square.

Possible options for die sizes



So, we have a white matrix of 32x16 pixels with dimensions of 320x160mm and, accordingly, an interpixel distance of 10 mm. Let's take a closer look at it.
Front view:

It also seemed to you that the LEDs are some kind of oval? Didn't you think...


A small visor is made above the LEDs, which prevents sunlight from illuminating the LEDs.

Front view with plastic mask removed



We turn the matrix and see the board:


There are a bunch of logic chips on the board. Let's see what these microcircuits are:
1. 1 x SM74HC245D - non-inverting buffer
2. 1 x SM74HC04 - 6-channel inverter
3. 1 x SM74HC138D - 8-bit decoder
4. 4 x APM4953 - assembly of 2 P-channel MOSFETs
5. 16 x 74HC595D Latched Shift Register
Two 16-pin connectors are interface, one of them is input (the screen controller is connected to it), and the second is output (the next matrix in the chain is connected to it). The arrow on the board is directed from the input connector to the output.
Power is supplied to the terminals in the center of the board. Supply voltage - 5V, maximum current (when all LED matrices are on) - 2A (for white matrix).

All the above information, as well as a demonstration of the matrix in the video below. In it, from 13:04 to 15:00 I talk about the dependence of the screen brightness on the number of matrices. This is due to an error in the algorithm. The bug has been fixed and now the data is loaded before the screen turns off.

I will also be glad to see you my youtube channel, where I still connect a lot of stuff to microcontrollers.

Thank you all for your attention!

Assembling a marquee based on an LED matrix and Arduino is a simple task that can be done even at home. You don't need to be a programmer and have in-depth knowledge of electronics to make letters move on an LED display. In this article, we will analyze how to assemble a running line from ready-made LED matrices and Arduino Nano.

What will be required?

To implement the idea, you need very few details:

  • two LED modules, consisting of four matrices of 8 by 8 pixels;
  • holder for a battery of standard size "Krona";
  • 9 volt battery (CR-9V, ER-9V or equivalent);
  • two-pin switch;
  • connecting wires;
  • Arduino Nano board;
  • hot glue.

Scheme

On the printed circuit board of the LED module used, there are 4 matrices 8 by 8 pixels in size. Each LED board is controlled by an integrated circuit (IC) MAX7219. This IC is a controller for controlling led displays, common cathode matrices and discrete LEDs in an amount of up to 64 pcs.

For a more comfortable perception of information displayed on the LED display, it is recommended to install several modules. To do this, they are combined into series-connected groups, that is, the output of the first module (out) is connected to the input of the second module (in). This assembly consists of two modules (16 matrices), the length of which is quite enough for convenient reading of entire sentences.

Assembly

The matrix module can have a pin connection or contacts on the board in the form of printed conductors. It depends on how they are connected. In the first case, a harness with connectors is used to obtain a reliable electrical contact, and in the second case, jumpers will have to be installed and soldered.

But first you need to combine both modules into a single unit using hot melt adhesive. Thermoplastic adhesive does not conduct electricity, which means that it can be safely applied to the printed circuit board. Glue is applied from the ends of both boards, pressed and left for several minutes. After hardening, the output contacts of the first block are connected to the input contacts of the second block according to the scheme:

  • VCC - VCC
  • GND-GND
  • D IN – D OUT
  • CS–CS
  • CLK - CLK

Attach the Arduino Nano, battery compartment, and switch to the back of the PCB with hot glue. Details are arranged in such a way that they can be conveniently used.
At the next stage, the Arduino is connected to the LED module by connecting the wires to the input of the first matrix. Depending on the version of the module, the operation is performed through a detachable connection or by soldering according to the diagram below:

  • VCC-5V
  • GND-GND
  • D IN - PIN 11
  • CS-PIN 10
  • CLK - PIN 13.

At the final stage of assembly, it is necessary to connect the battery power. To do this, the negative contact (black wire) from the crown compartment is connected to the GND pin of the Arduino. The positive contact (red wire) is connected to the switch, and then to Arduino pin #30, designed to supply voltage from an unregulated source. In test mode, a do-it-yourself ticker can be powered via micro USB from a computer.
After making sure of the reliability of the fasteners and the quality of the electrical connections, they begin to assemble the case. It can be made from an aluminum or plastic profile, since the elements of the circuit do not heat up. The color, dimensions, degree of protection and fastening of the housing depend on the future use of the device. In the simplest case, a protective screen made of a building plastic corner profile with a cutout for a switch is suitable.

Ticker programming

The running line from Arduino and LED modules under control of MAX7219 is almost ready. It is time to move on to the final program part. The software (software) for the used Arduino and the driver for it must be installed on the computer. Next, you need to download two libraries and a sketch (a special program that will be loaded and executed by the Arduino processor). The libraries are installed with the Arduino IDE closed in the Documents - Arduino - Libraries folder. Then they download and run the sketch and check for the presence of libraries and the correctness of other data.

Sketch setup:

  • "number of horizontal displays" indicate the number of lines, in our case 1;
  • "number of vertical displays" indicate the number of matrices, in our case 8;
  • "string tape" indicate the inscription displayed on the display;
  • "int wait" sets the output speed in milliseconds.

After checking the entered data, it remains to click on the "download" button. Then disconnect from the PC, insert the battery and start the device.

In conclusion, I would like to add that the do-it-yourself running line is assembled quite quickly even without the skills of working with Arduino. Therefore, you should not be afraid of this intricate board. It is also worth noting that the running line can be made longer by increasing the number of LED matrices.

Read also

After I made the 8x10 matrix, I was approached by many people with the request to create a matrix of a larger size, as well as to ensure that data was written to the matrix using a PC. Therefore, one day I collected the LEDs that were left after the manufacture of the LED cube, and decided to make a larger matrix, taking into account the requirements that my colleagues asked me about.

Well, what are you waiting for? Take LEDs and a soldering iron, because now we will make a 24x6 LED matrix together!

Step 1: Gathering Everything You Need

For this project, you will need a basic set of tools: a soldering iron, solder, tongs, some wire, wire cutters, a wire stripper, and desoldering tools if you need them.

To make a matrix, you need:
1. 144 LEDs
2. 24 resistors (the value is determined by the type of LEDs, in my case 91 ohms)
3. Decimal counter 4017
4. 6 resistors with a nominal value of 1 kOhm
5. 6 transistors 2N3904
6. Long breadboard
7.Arduino
8. 3 x 74HC595 shift registers
10. Multiple pin headers

Step 2: How does it work?

The idea of ​​the LED matrix is ​​as follows: information is usually divided into small parts, which are then transmitted one after another. In this way, you can save a lot of Arduino pins and keep your program fairly simple.

Now it's time to use the 3 shift registers, which multiply multiple outputs and save a lot of arduino pins.

Each shift register has 8 outputs and you only need 3 arduino pins to control an almost unlimited number of shift registers.

We will also use the 4017 decimal counter to scan the rows. It can scan up to 10 rows because you only have 10 outputs, but you only need 2 outputs to control them.

4017 is a very useful chip. You can see her work at the footnote.

As I said earlier, the scan is done with a 4017 decimal counter, by connecting one row to ground at a time and sending the data through the shift resistors to the speakers.

Step 3: Schematic

The only items I didn't include in the schematic are the current limiting resistors, as their value depends on the type of LEDs used. Therefore, you need to calculate their value yourself.

To calculate the values ​​of 24 resistors, go to the following link:.

First you need to look at the data sheet of the LEDs to find out the forward voltage and forward current. This information can be obtained from the seller. The circuit operates on a voltage of 5V. Therefore, you need a 5V power supply.

Download the original file to study the diagram in more detail (click on the diagram to enlarge the image).

Step 4: Soldering the LEDs

Soldering 144 LEDs to create a matrix can be a difficult task if you don't know exactly how to do it.

Last time I soldered the die using a lot of jumper wires, which were very hard to solder. Therefore, this time I approached this problem more creatively.

You need to bend down the positive lead of the LED towards the other leads and make a row, then cut off the unused part of the lead, and try to keep those connections as low as possible. Further, similarly perform this procedure for all positive conclusions.

Now the negative leads are connected in a column and their soldering is difficult due to the positive row in their path. So you need to bend the negative lead 90 degrees, then bridge the positive row to the next negative lead, and so on for the rest of the LEDs.

I won't explain how to solder the shift registers and other components, since everyone has their own style and working methods.

Step 5: Matrix Programming

So we come to the last stage of our project - matrix programming.

Before that, I have already written two programs that have a lot in common.

I have added a program that receives a word or sentence from the arduino IDE serial monitor and displays it on the matrix. The program code is quite simple and does not pretend to be the best in the world, but it really works. You can write your own code or modify mine to your liking.

I have attached an excel file so you can create your own signs and symbols.

Here's how it works:

Create the required character pixel by pixel (don't worry, it's very easy) and copy the output line like this - #define (OUTPUT LINE)

In the future, I plan to add animation code when I have more time.

Step 6: The device is ready!

Congratulations! You have made the a 24x6 matrix yourself and now you can quickly display everything you need on it.

Now you can test the matrix, come up with new programs or improve the interface.

List of radio elements

Designation Type of Denomination Quantity NoteScoreMy notepad
Arduino board

Arduino Uno

1 To notepad
U1-U3 shift register

CD74HC595

3 To notepad
U4 Special logic

CD4017B

1 K561IE8 To notepad
Q1-Q6 bipolar transistor

2N3904

6 To notepad
Resistor

Let's start with the types of matrix connection, there are only two of them: serial and parallel, + a combined power option. The pros and cons are shown in the figure, for large matrices it is preferable to use a parallel type, so power is much better organized. But with the branches of the power wires you have to tinker. If you make a matrix from a garland of modules, then naturally it is easier to make it a zigzag. But be sure to check at different brightnesses and make sure that there is enough current for the far LEDs (when the voltage drops, the set white color turns yellow (small drawdown) or red (strong voltage drop). In this case, the power will need to be duplicated with thick wires to each piece of tape (for each row of the matrix).

The matrix is ​​connected to the Arduino according to, then there is a squeeze out of it. Important points:

  • Logic pin of Arduino connected to pin DIN tapes (matrices) through a resistor with a nominal value of 220 Ohm (you can take any in the range of 100 Ohm - 1 kOhm). Needed to protect the Arduino pin from overload, i.e. limit the current in the circuit (see Ohm's law);

  • GND (ground, minus) tape necessarily connects to the GND pin of the Arduino even when powered separately;

  • An electrolytic capacitor is needed to power the Arduino to filter out the sudden voltage drops that the tape creates when changing colors. The voltage of the capacitor is from 6.3V (the more, the larger and more expensive the conder), the capacitance is around 470 uF, more is possible, less is not recommended. It is possible without it at all, but there is a risk of violation of the stability of the work!

  • A tape power capacitor is needed to facilitate the operation of the power supply with sudden changes in the brightness of the matrix. Yet again you can do without it, but there is a risk of disruption of the stability of the work!

  • The power (and maximum output current) of the power supply is selected based on the size of the matrix and the modes in which it will operate. See the sign and remember Chinese amps, i.e. the power supply must be taken with a current margin of 10-20%! The table shows the values current consumption of the tape.

  • In firmware GyverMatrixOS version 1.2 and higher, system current limit is configured. How it works: in the sketch settings there is a parameter CURRENT_LIMIT, which sets the maximum current consumption of the matrix in milliamps. Arduino will make a calculation based on the colors and brightness of the LEDs and automatically reduce the brightness of the entire matrix in order to prevent the current limit from exceeding the set current limit in especially “eating” modes. This is a very cool feature!

ASSEMBLING THE BODY AND DIFFUSER

FIRMWARE AND SETTINGS

The first step is to set up in the sketch matrix dimensions, connection point and direction of the first segment ribbons. Hint below.

This type of matrix initialization allows you to connect a matrix of any configuration with any position of the beginning of the matrix. This is convenient for purchased matrices that can only be “twisted”, as well as for home-made ones, when there are some features of the case or wire laying. That is, no matter how you do and position the matrix, it will still work with the correct position of the origin. By the way, you can very easily “mirror” the matrix horizontally or vertically, if for some reason you suddenly need it: just change the connection to the “opposite” along the desired axis. For example, we want to mirror the connection type (1, 0) vertically. We set it up as (2, 2) - see the picture above. We want to mirror the type (3, 1) vertically - we set it up as (2, 3). Type (3, 2) horizontally? Please put it as (2, 2). I hope the logic is clear.

If this is your first time working with Arduino, then stop and study. After installing the drivers and libraries, you can proceed to the platform firmware. I have a finished project with games and effects, go for details and firmware. Further there will be information for developers, that is, those who want to write something for the matrix on their own!

At the very beginning of the firmware, there are settings for the type of matrix and its connection, the connection type is determined by standing facing the matrix. To simplify the matrix connection settings (angle and direction), use the hint above =)

// **************** MATRIX SETTINGS **************** #define LED_PIN 6 // ribbon pin #define BRIGHTNESS 60 // default maximum brightness (0-255) #define WIDTH 16 // matrix width #define HEIGHT 16 // matrix height #define MATRIX_TYPE 0 // matrix type: 0 - zigzag, 1 - sequential #define CONNECTION_ANGLE 0 // connection angle: 0 - bottom left, 1 - top left, 2 - top right, 3 - bottom right #define STRIP_DIRECTION 0 // strip direction from corner: 0 - right, 1 - up, 2 - left, 3 - down

The firmware also contains a tab utility_funx, in which all the functions for working with the matrix just sit:

Void loadImage(bitmap array name); // display a picture from the "array name" array. From the pictures read below void drawDigit3x5(byte digit, byte X, byte Y, uint32_t color); // draw a number (digit, X-coordinate, Y-coordinate, color) void drawDots(byte X, byte Y, uint32_t color); // draw clock dots (x-coordinate, y-coordinate, color) void drawClock(byte hrs, byte mins, boolean dots, byte X, byte Y, uint32_t color1, uint32_t color2); // draw hours (hours, minutes, dots on/off, x-coordinate, y-coordinate, color1, color2) static uint32_t expandColor(uint16_t color); // convert color from 16 bit to 24 bit uint32_t gammaCorrection(uint32_t color); // gamma correction (transforms the color to a more natural color) void fillAll(uint32_t color); // fill the entire matrix with color void drawPixelXY(byte x, byte y, uint32_t color); // function for drawing a point by X Y coordinates (X coordinate, Y coordinate, color) uint32_t getPixColor(int thisPixel); // function to get the color of a pixel by its number uint32_t getPixColorXY(byte x, byte y); // function to get the color of a pixel in the matrix by its coordinates (x-coordinate, y-coordinate) uint16_t getPixelNumber(byte x, byte y); // get the pixel number in the feed by coordinates (x-coordinate, y-coordinate, color)

The origin of the matrix coordinates is the lower left corner, it has zero coordinates!

Using these functions, you can create various effects of varying degrees of complexity, as well as classic games!

8 years ago

Visit our DIY section - http://www.chipdip.ru/catalog-show/just-do-it/
Subscribe to our groups:
VK - http://vk.com/chipidip
FB - https://www.facebook.com/chipidip
Instagram - https://www.instagram.com/chipidip/
Instructables http://www.instructables.com/member/ChipiDip/*
If you suddenly need a small LED matrix of a non-standard size or shape, then you can always assemble it yourself using a breadboard, LEDs and current-limiting elements. For example, let's make a 10 by 10 matrix of UV LEDs, thus obtaining a detector authenticity of money. For this we use a velleman ECI prototyping board, 100 LEDs and 100 resistors. Why so many resistors? We will use 5 volts for power, so we will need 470 ohm resistors to set the required current of 20 milliamps through each LED. We will take the path of least resistance and simply connect all the LEDs in parallel, but this connection requires that each LED has its own current-limiting resistor. First, solder the LEDs to the board, for convenience, fixing each line consisting of them with adhesive tape, which will allow you to turn the board over and quickly solder them all at once. After that, we solder the resistors, having also previously secured them with adhesive tape, and, finally, we will create the missing power rails. Now we supply power to our matrix, and check that all the LEDs are on. It remains only to install it in the case and get the finished device. In the same way, you can make LED arrays of various colors for light and music, white for lighting or infrared for night vision cameras.

9 years ago

TV channel "St. Petersburg". "How It Works" program. Leading journalist: Kirill Pishchalnikov; cameramen: Alexander Chudin, Andrey Zhokhov, Dmitry Emelyanov; director - Sofya Iofa, editing - Andrey Alekseev, producers: - Anna Ageeva, Anna Tyatte; editor - Rodion Chepel, project manager - Mikhail Bergart, video engineers: Shamil Fabrikov, Yuri Stepanov.

8 years ago

A very dual state of mind and soul, on the one hand, I am very proud of such PEOPLE, and even a fellow countryman, and on the other hand, I am very ashamed of the officials and our government, which literally rots such PEOPLE, preventing them and its technologies from developing. At the same time, they contain meaningless, countless design bureaus, from which the efficiency is 0

8 years ago

This is one of our late projects. For schematics, layouts, and code see our project page: http://www.solderlab.de/index.php/led-projects/rgb-globe Best regards, Pepe PS: There is a small typo at the very beginning of the clip: It should be "2 PCBs" instread of "3".

8 years ago

Subscribe to our VKontakte group - http://vk.com/chipidip, and Facebook - https://www.facebook.com/chipidip * All over the world there is an active search for alternative environmentally friendly energy sources. In this regard, the use of thermoelectric modules for generating electricity is becoming very relevant. Thermoelectric generator modules are an alternative environmentally friendly source of electrical energy, which allow generating electrical energy up to 10 W at a DC voltage of up to 6 V from one module at a temperature difference of 100 °C. where: ТGM - product abbreviation - thermoelectric generator module; N is the number of thermoelectric pairs in the module; C is the length of the rib of the base of the thermoelectric element (in millimeters); h is the height of the thermoelectric element (in millimeters). For example, in this TGM-127-1.0-2.5 module: 127 thermoelectric pairs (254 thermoelectric elements), each element has a cross section of 1.0x1.0 mm and a height of 2.5 mm. The main areas of application of generator modules: utilization of waste heat in transport installations (cars, ships); autonomous power supply of electronic units for water boilers and waste incinerators; cathodic protection of gas pipelines; conversion of heat from natural sources - geothermal waters, etc. into electrical energy; autonomous power supply of low-power electrical devices.

6 years ago

This video shows the process of diagnosing and repairing an ASUS motherboard with a common problem for all motherboard and video card manufacturers, namely a short circuit (short circuit) in the processor or GPU power system. The video shows the process of calling a short circuit, searching for a faulty transistor (MOSFET) and the process of replacing a field worker with a working one. The results of the repair in the video :) Likes and subscriptions to the channel are welcome, they increase our morale :) .com/club54940932 Site of our service center: http://service-core.com.ua/

5 years ago

Article http://vip-cxema.org/index.php/home/svetodiody/237-led-lampa-svoimi-rukami (the board can be downloaded there) ask all questions on the forum (registration is not needed) http://forum .vip-cxema.org/index.php?/forum/19-voprosy-i-answer/ Our websites http://vip-cxema.org/ http://x-shoker.ru/ Official channel group https:/ /vk.com/club79283215 Group vip-cxema.org http://vk.com/club54960228 Group x-shoker.ru https://vk.com/public51079754 E-mail [email protected] My VK profile https://vk.com/akakasyan Support projects webmoney R392842219424 Z416312694449 Yandex.Money 410012993641116

3 years ago

The best course for beginners in electronics: https://diodov.net/moi-kursy/ Calculation of a resistor for an LED. Calculating the resistor value for any LED is quite simple. First you need to determine the amount of voltage that is applied to the LED. Further, using the reference book or datasheet, find out the rated current of the LED and the rated voltage of the LED. First you need to determine how much voltage you need to pay off on the resistor. It is equal to the voltage difference between the power supply and the LED. Next, you need to calculate the resistance of the quenching resistor. To do this, divide the voltage across this resistor by the rated current of the LED. The last item you need to calculate the power dissipation of the resistor. It is directly proportional to the square of the voltage of this resistor and inversely proportional to the resistance. As can be seen from the above, it is enough to know only three formulas. Using them, you can easily and quickly calculate the resistor for any type of LED at any input voltage without using various online calculators. Programming microcontrollers from scratch: https://www.youtube.com/channel/UCByG5fr-hWOMKlb7DqyQQ9Q Get a high DISCOUNT for the purchase of ALL products: http://ali.pub/3mwkwb A set of resistors 600 pieces, 30 denominations of 20 pieces: http: //ali.pub/3muaey A set of LEDs of different colors 300 pieces: http://ali.pub/3mubp1 Here you can buy good multimeters: 1. RM113D multimeter http://ali.pub/3mn1ru 2. RM409B multimeter http:// ali.pub/3mn432 3. BSIDE ADMS7 multimeter http://ali.pub/3mn5rx 4. RM101 multimeter http://ali.pub/3mn6pd 5. AN8009 multimeter http://ali.pub/3mn7z2 6. DT830B multimeter http://ali.pub/3mn7z2 ://ali.pub/3mn8qo #Resistance Calculation #LED #Resistor Calculation