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

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
DrJ007
Posts: 2
Joined: Fri Jun 05, 2015 7:02 am

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

Post by DrJ007 » Mon Jun 08, 2015 12:03 am

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.

User avatar
Frédéric Boulanger
Posts: 4
Joined: Mon Jun 08, 2015 9:05 pm
Location: Gif-sur-Yvette, France
Contact:

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

Post by Frédéric Boulanger » Mon Jun 08, 2015 9:11 pm

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

DrJ007
Posts: 2
Joined: Fri Jun 05, 2015 7:02 am

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

Post by DrJ007 » Mon Jun 08, 2015 10:33 pm

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?

User avatar
Frédéric Boulanger
Posts: 4
Joined: Mon Jun 08, 2015 9:05 pm
Location: Gif-sur-Yvette, France
Contact:

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

Post by Frédéric Boulanger » Thu Jul 14, 2016 4:24 pm

I have a new version using the SPI class:

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

d4ß
Posts: 5
Joined: Thu Sep 28, 2017 10:19 am

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

Post by d4ß » Thu Sep 28, 2017 10:38 am

[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!


User avatar
mattyt
Posts: 223
Joined: Mon Jan 23, 2017 6:39 am

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

Post by mattyt » Sun Oct 01, 2017 2:49 am

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

User avatar
mcauser
Posts: 373
Joined: Mon Jun 15, 2015 8:03 am

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

Post by mcauser » Sun Oct 01, 2017 7:58 am

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/

User avatar
mcauser
Posts: 373
Joined: Mon Jun 15, 2015 8:03 am

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

Post by mcauser » Sun Oct 01, 2017 1:50 pm

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()

User avatar
mattyt
Posts: 223
Joined: Mon Jan 23, 2017 6:39 am

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

Post by mattyt » Sun Oct 01, 2017 2:04 pm

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. :)

Post Reply