# LED Matrix Display

**URL:** <https://forum.hardwario.com/t/led-matrix-display/744>\
**Category:** TOWER\
**Created:** [March 23, 2023, 2:50pm UTC](https://forum.hardwario.com/t/led-matrix-display/744 "2023-03-23T14:50:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunube](https://forum.hardwario.com/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@sunube](https://forum.hardwario.com/u/sunube)\
**Post date:** [March 23, 2023, 2:50pm UTC](https://forum.hardwario.com/t/led-matrix-display/744/1 "2023-03-23T14:50:27Z")

</div>

Hello, I am doing this project:

> **[Wireless LED Matrix Display with RaspberryPi, Node-RED, MQTT](https://www.hackster.io/hubmartin/wireless-led-matrix-display-with-raspberrypi-node-red-mqtt-0f44a8)**
>
> Universal wireless display, control text and intensity over MQTT from Node-RED or your phone. Display weather, notifications, time. By Martin Hubáček.

But I have a problem with the led array, I’m using a bigger one and changing the values of: LED\_MODULES\_COUNT  
I can’t get it to work, my matrix is the one in the image is MAX7219

Thanks

 ![MAX7219-dot-matrix-modul-mikrocontroller-modul-DIY-KIT-MCU-LED-Display-Control-Modul-Kit.jpg_640x640](https://forum.hardwario.com/uploads/default/original/1X/9c1ab212ab155875c18585d08f5ca9ad96e76246.jpeg)

---

<div class="post-metadata">

**Author:** ![hub.martin](https://forum.hardwario.com/user_avatar/forum.hardwario.com/hub.martin/32/631_2.png) [@hub.martin](https://forum.hardwario.com/u/hub.martin)\
**Post date:** [March 23, 2023, 3:09pm UTC](https://forum.hardwario.com/t/led-matrix-display/744/2 "2023-03-23T15:09:08Z")

</div>

Hi, you need to give us more information.  
Absolutely minimum is datasheet/schematics of the display module. Every manufacturer can wire them as they like. There is no “MAX7219 standard”.

Then please explain in more detail what “I can’t get it to work” means. Does it show anything? What did you tried? Can you check whether the bits you shift to the first MAX7219 does shift out correctly on next MAX7219?

---

<div class="post-metadata">

**Author:** ![sunube](https://forum.hardwario.com/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@sunube](https://forum.hardwario.com/u/sunube)\
**Post date:** [March 23, 2023, 3:30pm UTC](https://forum.hardwario.com/t/led-matrix-display/744/3 "2023-03-23T15:30:15Z")

</div>

Right when you turn on all the leds scroll through the screen, but when you start the script with the time, random leds turn on and they change every second, I have tried changing the number of panels but it continues to do the same (random leds).

This is the information I have: Module parameters:

1. A single module can drive a 8\*8 common cathode array
2. Module working voltage: 5V
3. Module size: length 26.5cm X width 6.4cm X height 1.3cm
4. For screws with 64 fixing holes, the hole diameter is 3mm.
5. Module with input and output interface, compatible with multiple modules in cascade.  
Wiring Instructions:
6. The left side of the module is the input port and the right side is the output port.
7. When controlling a single module, you only need to connect the input port to the CPU
8. When there are multiple modules in cascade, the input terminal of the first module is connected to the CPU, the output terminal is connected to the input terminal of the second module,. The output terminal of the second module is connected to the input terminal of the third module, etc. …

Take 51 single-chip microcomputers as an example:  
VCC → 5V  
GND → GND  
DIN → P2.2  
CS → P2.1  
CLK → P2.0

and the image:

 ![U07937a4e0b2849108557f29e1e9804d3K](https://forum.hardwario.com/uploads/default/original/1X/d507b94f29513e9c898b773ec06e8a0a713f2542.jpeg)

---

<div class="post-metadata">

**Author:** ![hub.martin](https://forum.hardwario.com/user_avatar/forum.hardwario.com/hub.martin/32/631_2.png) [@hub.martin](https://forum.hardwario.com/u/hub.martin)\
**Post date:** [March 24, 2023, 8:06am UTC](https://forum.hardwario.com/t/led-matrix-display/744/4 "2023-03-24T08:06:06Z")

</div>

> “when you start the script with the time, random leds turn on and they change every second”

This is the important information I hoped for. So as I expected, every manufacturer connects MAX7219 to the row and columns differently. So the “random” LEDs are not random; they are just swapped because firmware expects different MAX7219 to LED matrix connections.

And here is the issue with every (usually Chinese) module - there are no schematics. So I can’t help you there; you have to figure out the connection yourself.

You need to edit **led\_matrix\_draw\_pixel** function to match the connection on your module.

> <https://github.com/hubmartin/bcf-led-matrix-max7219/blob/master/app/application.c#L127>

The best solution would be to create a simple loop that cycles through all 64 (8x8) pixels on the first 8x8 module. Maybe cycle it when you press the button, send the expected x,y point coordinates over console and take note of which pixel really turns on.  
You must find if the rows/columns are swapped (rotated number 90 degrees) or if the pixels in the row or column are swapped between each other.  
Another solution might be to find some Arduino or example code and find how the pixels are addressed, and change the **led\_matrix\_draw\_pixel** accordingly.

---

<div class="post-metadata">

**Author:** ![sunube](https://forum.hardwario.com/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@sunube](https://forum.hardwario.com/u/sunube)\
**Post date:** [March 27, 2023, 2:32pm UTC](https://forum.hardwario.com/t/led-matrix-display/744/5 "2023-03-27T14:32:27Z")

</div>

Can you help me create the simple loop?

---

<div class="post-metadata">

**Author:** ![hub.martin](https://forum.hardwario.com/user_avatar/forum.hardwario.com/hub.martin/32/631_2.png) [@hub.martin](https://forum.hardwario.com/u/hub.martin)\
**Post date:** [April 4, 2023, 11:03am UTC](https://forum.hardwario.com/t/led-matrix-display/744/6 "2023-04-04T11:03:43Z")

</div>

Create a loop in your button callback or in the application\_loop()

And call clear, draw\_pixel and update functions. Like in this function

> <https://github.com/hubmartin/bcf-led-matrix-max7219/blob/master/app/application.c#L161>

You need to increment some static variable that will be incremented each time, and from this variable, with division and modulo, compute the X and Y coordinates of the pixel.

If you do this in the application\_loop, then use the schedule relative function with some delay, so you can see how the pixel is moving. The TOWER doesn’t have directly delay function. It uses tasks which could be rescheduled later.

[https://sdk.hardwario.com/group\_\_twr\_\_scheduler.html#ga3a01cc23214414434e8a981f8e98ebb3](https://sdk.hardwario.com/group __twr__ scheduler.html#ga3a01cc23214414434e8a981f8e98ebb3)
