Sooner or later there is a need to output data from the Arduino and display them on a relatively large display. Large size displays cost a lot for hobby projects, so one of the best options is an LED display. But the rare Arduino has 64 outputs for controlling at least 8 × 8 familiarities, not to mention the large size.
You can apply to multiplex and get 16 used conclusions and a lot of hassle on organizing the dynamic display. And you can take a proven and convenient chip driver LED matrix MAX7219, reduce the number of pins used to 3 and get the opportunity to collect large running lines of text!
To implement the project from this article, we need the following components:
- Arduino Uno R3
- MAX7219 – LED Matrix
BRIEF OVERVIEW OF THE MODULE
Modules based on MAX7219 are usually packaged with convenient connections to the same modules for extending the string. The microcircuit itself allows controlling a matrix of LEDs up to 8 × 8 in size, although initially it was designed to control a ruler of eight-segment indicators with a common cathode.
The microcircuit needs only 1 resistor to set the current of all the LEDs of the circuit, but on the modules it is already installed and it will not be your headache!
The microcircuit operates on a voltage of 5 V with logic levels of 0 V-5 V. The maximum current per segment is 40 mA, the total current is 330 mA.
SCHEME OF CONNECTION TO ARDUINO
- DIN (MOSI) module – 12 pin
- CLK – 11 pin
- CS – 10 pin
- VCC – + 5V
- GND – GND
CONNECTING TO ARDUINO IDE
To work with the microcircuit, a large number of libraries are written, including the one supported by the universal U8g2, we will try to search for something specific in the Library Manager:
We will use LedControl, put it:
And we go to analyze the examples, in our case – LCDemoMatrix:
Connect as described in lines 5-10, and upload the sketch to the Arduino (don’t forget to connect the power lines too!). Further, the code traces the display of various effects, but the methods for displaying them in different libraries are different, so we will lay their detailed study on the shoulders of the user.
The main work falls on the setRow and setColumn functions, there is also a setLed function, which takes parameters in the form of coordinates and pixel values and exposes it. Function descriptions are in the file LedControl.h at
Documents / Arduino / LedControl / src.
Have a good study of working with matrices!