Page 1 of 5

Anyone working on a MAX7219 8x8 LED matrix display library?

Posted: Mon Jun 08, 2015 12:03 am
by DrJ007
I have a MAX7219 8x8 LED matrix display working on my Arduino and I would now like to run it from my pyboard. Has anyone written a micropython library to do this? Or any sample code? Thanks in advance.

Re: Anyone working on a MAX7219 8x8 LED matrix display library?

Posted: Mon Jun 08, 2015 9:11 pm
by Frédéric Boulanger
I have written some code for a MAX7219 driven 8x8 LED matrix. You will find it on:

http://wwwdi.supelec.fr/fb/Archi2015/PyBoardMAX7219-8x8

The main text is in French, but the code is commented in English. It should give you the basic elements to create your own code with the 8x8 matrix.

Frédéric

Re: Anyone working on a MAX7219 8x8 LED matrix display library?

Posted: Mon Jun 08, 2015 10:33 pm
by DrJ007
Thank you for the quick reply. I have your example running on my pyboard and my 8x8 matrix. Your code is nicely written and will help me to get my code running. I'm just curious why you didn't use the SPI class?

Re: Anyone working on a MAX7219 8x8 LED matrix display library?

Posted: Thu Jul 14, 2016 4:24 pm
by Frédéric Boulanger
I have a new version using the SPI class:

http://wdi.supelec.fr/boulanger/MicroPython/#MAX7219

Re: Anyone working on a MAX7219 8x8 LED matrix display library?

Posted: Thu Sep 28, 2017 10:38 am
by d4ß
[quote="Frédéric Boulanger"]I have a new version using the SPI class:
http://wdi.supelec.fr/boulanger/MicroPython/#MAX7219[/quote]

Hello Frédéric Boulanger,
if I understand right your driver supports more then one 8x8 LED Dot-Matrix Segment?
How I can define how much segments I use ?
So that I can for example scroll text across them?
The driver that is provided by adafruit (https://github.com/adafruit/micropython ... it-max7219) works fine for one segment but not more (I get at all my 4 segments the same out put).
While I am not really experienced with scripting I would like to receive some advices.

Thank you!

Re: Anyone working on a MAX7219 8x8 LED matrix display library?

Posted: Sun Oct 01, 2017 1:31 am
by mcauser

Re: Anyone working on a MAX7219 8x8 LED matrix display library?

Posted: Sun Oct 01, 2017 2:49 am
by mattyt
Hi d4ß,

I believe you're talking about cascading MAX7219's? Using this feature of the MAX7219 you can chain together multiple 7219's but still only use the three pins of SPI to control multiple units.

As I understand it works by connecting DOUT from one 7219 to DIN of the next and 'passing along' packets as they're received until CS goes high when all the devices act on their data. There are quite a few forums discussing this online but this one helped make it 'click' for me.

From what I can tell neither Frédéric's or Deshipu's libraries currently support cascading. That said it shouldn't be too much work to extend either library for this...

I've recently purchased a 4x 8x8 LED matrix module (using 4x cascaded MAX7219's) and so am interested in this topic! It should arrive in a couple of weeks so I'll let you know what I find or come up with - please do the same!

Cheers,
Matt

Re: Anyone working on a MAX7219 8x8 LED matrix display library?

Posted: Sun Oct 01, 2017 7:58 am
by mcauser
Neat online tool for visualising an 8x8 led matrix.
It’s geared towards Arduino, but you may find it useful.
https://xantorohara.github.io/led-matrix-editor/

Re: Anyone working on a MAX7219 8x8 LED matrix display library?

Posted: Sun Oct 01, 2017 1:50 pm
by mcauser
I added cascading to deshipu's driver, and added framebuf to give text and shape support:
Works on my single 8x8 matrix, quad 8x8 matrices and 2x quad 8x8 matrices.
https://github.com/mcauser/micropython-max7219

Image

If you have a chain of 4x 8x8 matrices and you want to only update the 2nd matrix (closest to the DIN matrix), you need to send NOOPs to each of the other matrices. You write to the furthest away from DIN matrix first. For each row, the right most pixel is the least significant bit.

eg. Light the top row of the 2nd matrix and leave the others unchanged.

Code: Select all

_NOOP = const(0)

cs.low()
spi.write(bytearray([_NOOP, _NOOP]))
spi.write(bytearray([_NOOP, _NOOP]))
spi.write(bytearray([1, 255]))
spi.write(bytearray([_NOOP, _NOOP]))
cs.high()

Re: Anyone working on a MAX7219 8x8 LED matrix display library?

Posted: Sun Oct 01, 2017 2:04 pm
by mattyt
That's awesome work mcauser! Especially like the use of framebuf.

I'm looking forward to playing with my 4x 8x8 matrix now!

Oh, and the visualisation tool you linked to will be useful too, thanks. :)