Skip to content

Connections RGB

board707 edited this page May 11, 2024 · 6 revisions

Connections - RGB

LED matrix connections can be quite complex. Some signals must use of specific pins of the controller, for example with PWM support. Requirements for pins on different MCUs may differ, in this case, recommendations for STM32 and RP2040 are described separately.

DMD_RGB.h

Color channel pins R0, G0, B0, R1, G1, B1 & clock pin CLK are used for parallel loading of data into the DMD module. When initializing the dmd object, they are specified as a list, the first pin is CLK, then the color channel pins:

uint8_t custom_rgbpins[] = { PA15, PA0,PA1,PA2,PA3,PA4,PA5 }; // CLK, R0, G0, B0, R1, G1, B1

STM32: All these pins must be selected on the one port of the microcontroller, for example, all PAx or all PBx. Additionally, when using the COLOR_4BITSand COLOR_1BITS modes, only pins PA0-PA5 can be used.

RP2040: The CLK pin can be any GPIO, R0-B1 pin numbers must be consecutive in ascending order.

A B (C D E) – switches. Only part of the leds is powered at any one time. The number and order of parts(frames) into which the LED matrix is divided is determined by the scan mode. Types of RGB panels can varied from 2scan to 32scan. Depending on scan mode, the number of switch lines can be different - from AB to ABCDE. Combinations of high and low level on pins A B C D E select which part is currently lit. In the sketch, the pins for the A-E switches are specified as a list:

uint8_t mux_list[] = { DMD_PIN_A , DMD_PIN_B , DMD_PIN_C , DMD_PIN_D , DMD_PIN_E };

STM32: All these pins must be selected on the same controller port (but not necessarily on the same as the color pins R0 - B1).

RP2040: A B C D E pin numbers must be consecutive in ascending order.

OE (Output Enable) - is used to switch the LEDs on or off. By applying a PWM signal to this input, you can adjust the brightness of the picture. On STM32 by default, the TIM3 timer is used to generate PWM, so, pin OE must be selected among the outputs of the timer3 - PB0 PB1 PA6 PA7. On RP2040 you can use any GPIO for OE signal.

Starting from version 0.6.11 it is possible to select other timers for OE: eg. TIM4, outputs PB6 PB7 PB8 .

For LAT/SCLK, any output pin can be selected The GND pin of the panel connector must be connected to the corresponding pin of the microcontroller.

If the cable between the controller and the first panel is longer than 20-30cm, it is recommended to use a logic level converter between 3.3v and 5v.

Connections between the modules

The connection of RGB matrices is completely similar to the connection of monochrome panels. The CONNECT_NORMAL and CONNECT_ZIGZAG modes are supported. See Connections - Monochrome.

Two-color RedGreen panels and similar (HUB08)

Two-color panels, as a rule, have a HUB08 connector with a different pin arrangement. Except for this, their connection is similar to the connection of RGB panels. Pins not used in two-color panels (for example, blue B0 B1 pins in a Red-Green matrix) must still be assigned when initializing the dmd object. They do not need to be connected to the matrix, but they should not be used in program for anything else. As initialize dmd object when working with two-color matrices, you should select a template for RGB matrices with a color depth of 1 bit.