Marc's Public Blog - Arduino Hacking


All | Aquariums | Arduino | Btrfs | Cars | Cats | Clubbing | Computers | Diving | Dreamstate | Edc | Electronics | Exercising | Festivals | Flying | Halloween | Hbot | Hiking | Linux | Linuxha | Monuments | Museums | Oshkosh | Outings | Public | Rc | Sciencemuseums | Solar | Tfsf | Trips



>>> Back to post index <<<

2017/04/24 Adafruit GFX on NeoMatrix and RGB Matrix Panel Demo
π 2017-04-24 01:01 in Arduino
Give me code:
  • https://github.com/marcmerlin/Adafruit_NeoMatrix/tree/master/examples/MatrixGFXDemo
  • https://github.com/marcmerlin/RGB-matrix-Panel/tree/master/examples/PanelGFXDemo
  • FastLED Version https://github.com/marcmerlin/FastLED_NeoMatrix/blob/master/examples/MatrixGFXDemo/MatrixGFXDemo.ino
  • Note that the last link uses my https://github.com/marcmerlin/FastLED_NeoMatrix library which ports NeoMatrix to the better FastLED backend. The nice thing though is that all your code keeps working just the same, no changes required outside of matrix initialization. I wrote a different page for my FastLED::NeoMatrix library.

    All the displays, 4 made with neopixels and soldered by hand
    All the displays, 4 made with neopixels and soldered by hand

    Yeah, the 24x24 one took forever to lay out, glue and solder (6H+)
    Yeah, the 24x24 one took forever to lay out, glue and solder (6H+)

    More than 2 years ago, I spent many hours writing an interrupt written driver for LED matrices that require fast line scanning while you setup the right rows, and even faster per color refreshes where you turn the color on and off depending on how bright you want each color component to be to yield different color mixes. This is explained in more details on my page on Driver for direct driving single to 3 color LED Matrices with software PWM.

    Then came in Neopixels which can be individually addressed without fast row scanning, and the Adadfruit Neomatrix library. Those made creating color matrices much more trivial (except for the part where you have to actually build and solder that matrix):

    2 row scanned matrices on the upper left, 7x7 neomatrix, another row scanned 32x16 Adafruit panel.
    2 row scanned matrices on the upper left, 7x7 neomatrix, another row scanned 32x16 Adafruit panel.

    on the bottom row, self built 16x8 neomatrix, and another 12x12 neomatrix
    on the bottom row, self built 16x8 neomatrix, and another 12x12 neomatrix

    I ended up taking my old Adafruit GFX demo I wrote fro my interrupt driven scan matrices, porting it to Neomatrix (which was trivial) and then extending it. You can find my MatrixGFXDemo code here,
    Soon afer, I dug up my Adafruit 16X32 RGB LED Matrix Panel, setup an old Arduino Mega to control it and have enough RAM left to run some fun code (on an Uno memory would have been too tight), it turns out that thanks to Adafruit GFX support, it took very little time to get my same demo working on the RGB Panel.

    Here is a video of the demo I wrote on all those different displays:

    Here are some things the demo does:

  • Init displays the same 8x8 pattern as many times as it will fit

  • The code will then draw lines, rectangles and circles that match the size of the display:


  • If the display is at least 16x8, it will display the resolution in various ways appropriate to the display size:




  • another part of the demo displays an 8x8 color pixmap with drawRGBBitmap I added in Adafruit-GFX-Library and bounces it around on any display bigger than 10x10:


  • then, it will display a 24x24 bitmap which on most displays will be panned around to show the whole picture:


  • Hope you enjoy the demo, it should work pretty trivially on any display that supports Adafruit::GFX, see https://github.com/marcmerlin/RGB-matrix-Panel/blob/master/examples/PanelGFXDemo/PanelGFXDemo.ino#L21 on how some backend specific code can be #define'd to work on other backends.


    More pages: November 2024 June 2024 August 2023 June 2023 May 2023 April 2023 March 2022 January 2022 January 2021 December 2020 March 2020 January 2020 May 2019 April 2019 March 2019 January 2019 July 2018 May 2018 April 2018 January 2018 June 2017 April 2017 January 2017 February 2016 January 2015 September 2013 January 2012 December 2011 May 2011 January 2011

    >>> Back to post index <<<

    Contact Email