Marc's Public Blog - Arduino Hacking


All | Aquariums | Arduino | Btrfs | Cars | Cats | Clubbing | Dining | Diving | Electronics | Exercising | Flying | Halloween | Hiking | Linux | Linuxha | Monuments | Museums | Public | Rc | Sciencemuseums | Snow | Solar | Trips



Table of Content for arduino:

More pages: 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



2020/01/24 Running Arduino code with 2D FastLED, Adafruit::GFX, and LEDMatrix displays on Linux
π 2020-01-24 01:01 in Arduino
As part of writing my driver/port to run 2D FastLED, Adafruit::GFX, and LEDMatrix on RGBPanels using a Raspberry Pi, I ended up improving ArduinoOnPc to support X11 or SDL and serial input support on linux.
In the process I added drivers/configuration in neomatrix_config.h to support 3 more display drivers supported by my fork of ArduinoOnPc

  • LINUX_RENDERER_SDL uses ArduinoOnPc's built in FastLED Emulation which allows running native FastLED::NeoMatrix
  • LINUX_RENDERER_X11 uses a quick and dirty driver I wrote: https://github.com/marcmerlin/FastLED_TFTWrapper_GFX
  • Both allow running your basic 2D code written either of Adafruit::GFX, and LEDMatrix, or 2D FastLED on your linux computer:



    There is basic serial input/output emulation to allow you to interact with serial debugging on your arduino code when run on linux, and of course you can run the code under gdb.

    You can find all the code and installation/usage instructions here: https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos

    2020/01/14 LCA 2020 Talk, ESP32 Memory Management, Neopixels and RGBPanels
    π 2020-01-14 01:01 in Arduino
    As part of LCA 2020, I gave a quick talk at the Open Hardware Miniconf about a year's worth of work in ESP32 and upgrading my Shirt from 24x32 neopixels (P10) to 64x96 in RGBPanels (P4), giving me almost 10x more pixels.
    Running lots of demo code at 96x64 in 24bpp, storing 2 framebuffers for page switching, plus bitplanes for PWM, it ended up significantly stressing the amount of fragmented memory available on ESP32, so this talk deals with what I learned and how to get around the limitations.

    Then, I also brought a demo of my next version using Raspberry Pi and displaying a framebuffer of 128x192, using FastLED_RPIRGBPanel_GFX I wrote for the occasion :)


    Demo of 64x96 with ESP32 and 128x192 on Rasberry Pi
    Demo of 64x96 with ESP32 and 128x192 on Rasberry Pi


    Talk video below:

    2020/01/14 Linux.conf.au Open Hardware Miniconf 2020: Dingo Car with Tensorflow Video Analysis v2
    π 2020-01-14 01:01 in Arduino, Electronics, Linux
    Another LCA, another Open Hardware Miniconf. This year was an improved version of the Dingo Car from last year.

    Jon, presenting the miniconf as per how many
    Jon, presenting the miniconf as per how many





    Raspberry Pi running the car
    Raspberry Pi running the car



    This year's dingo car, controlled by the rPi
    This year's dingo car, controlled by the rPi

    All done
    All done

    Andy presenting the software side of the car
    Andy presenting the software side of the car

    We then trained our cars' neural network by manually driving them arount the track:


    and before long, I got my car to drive around on its own
    and before long, I got my car to drive around on its own

    Here is a video of my car driving on its own, including how it learned to drive:

    During the miniconf, I also gave a talk on my recent LED panel/ESP32 work and brought my recent RGBPanels:


    2020/01/01 Running FastLED, Adafruit::GFX, and LEDMatrix code on High Resolution RGBPanels with a Raspberry Pi
    π 2020-01-01 01:01 in Arduino
    RBGPanels are a pain to drive, they require constant refreshing and it becomes more of a problem when you aim for higher resolutions (128x128 and above), as they require more horsepoewr and memory than either a teensy 3.6 or ESP32 can reasonably provide (the two top of the line chips supported by SmartMatrix)

    Another issue is that SmartMatrix, while better than all the other libraries on arduino, doesn't support all kind of weird panels out there, specifically the AB and AC panels that you often end up getting when you get higher resolutions like 128x64.

    Using Neopixels would work better of course, but they caan't reasonably be had in less than P5 (0.5cm/LED) while RGBPanels go down to P2. Also, neopixels are about 10X more expensive per pixel, if not more.
    So, the solution is to use a rPi to drive RGBPanels of size 128x128 and larger (a single Pi with 3 parallel channels can reasonably run up to 256x256. After that it gets harder and you need multiple microcontrollers).

    This is where the excellent https://github.com/hzeller/rpi-rgb-led-matrix driver comes in. It's the most feature complete RGBPanel driver for microcontrollers

    Ok, but you have all this arduino code, maybe written for a FastLED::NeoMatrix or Adafruit::NeoMatrix array using the Adafruit::GFX API. Or maybe, you used the FastLED API with an XY mapping function, or maybe even you're using the LEDMatrix API for FastLED. None of those work on rPi, and you don't want to change/rewrite your code.

    Well, there is good news: you can use https://github.com/ChrisMicro/ArduinoOnPc to run arduino code on PCs, and therefore also rPi. It is however designed to display in an X11 windows, which is not what you'd want. So, instead, I forked it for you and wrote a rPi glue driver for my FrameBuffer::GFX base class: https://github.com/marcmerlin/ArduinoOnPc-FastLED-GFX-LEDMatrix

    You therefore end up getting access to those 3 arduino graphics APIs, and you can render on rPi using a much faster and the more feature complete https://github.com/hzeller/rpi-rgb-led-matrix driver

  • https://github.com/marcmerlin/Framebuffer_GFX is the base class you need for access to the 3 APIs I mentionned
  • https://github.com/marcmerlin/FastLED_RPIRGBPanel_GFX is the driver that glues rpi-rgb-led-matrix with ArduinoOnPc
  • https://github.com/marcmerlin/ArduinoOnPc-FastLED-GFX-LEDMatrix is my fork that adds a few fixes and git submodules for required libraries and demo code.
  • And this is what the end result, looks like with a cool resolution of 128x192 with 3 panels of 128x64 run in parallel with the active-3 board from https://github.com/hzeller/rpi-rgb-led-matrix/tree/master/adapter/active-3




    By using these driver options, I get about 400Hz refresh rate on rPi3, lowering the amount of pwm bits:
    ~/rpi-rgb-led-matrix/examples-api-use/demo --led-gpio-mapping=regular --led-rows=64 --led-cols=128 --led-row-addr-type=0 --led-chain=1 --led-show-refresh --led-slowdown-gpio=1 --led-parallel=3 --led-pwm-dither-bits=1 --led-pwm-bits=7 --led-panel-type=FM6126A -D0

    Those variables are assigned when you create "rgb_matrix::Canvas *canvas", which is fed into matrix->setCanvas(). See this example code:

  • https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/blob/022257656e2f1beabe327e88bb96747c0fc955f9/neomatrix_config.h#L262
  • https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/blob/022257656e2f1beabe327e88bb96747c0fc955f9/neomatrix_config.h#L697
  • With rPi, especially with the active-3 board you can drive resolutions of at least 256x256. Here is an example of 128x192, 4 times bigger than the highest resolution I was ever able to drive on ESP32 (64x96). Here is a video natively playing on rPi:


    Well, actually 2 months later, I was able to get to the probably max achieveable resolution, 384x256, see RGB Panels, from 192x80, to 384x192, to 384x256 and maybe not much beyond

    384x192 resolution with 9 panels
    384x192 resolution with 9 panels

    384x256 resolution with 12 panels
    384x256 resolution with 12 panels


    More pages: 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

    Contact Email