Skip to content

Raspberry PI DMD (rpi-rgb-led-matrix)

Related Config File Sections:

The rpi dmd platform can be used to control a RGB LED matrix on your Raspberry Pi (any model).

1. Connect the hardware

We suggest that you follow the tutorial in the rpi-rgb-led-matrix library.

2. Install the extension

You need to install the rgbmatrix extension on your RPi using the following command:

git clone
cd rpi-rgb-led-matrix
sudo apt-get update && sudo apt-get install python3-dev python3-pillow -y
make build-python PYTHON=$(which python3)
sudo make install-python PYTHON=$(which python3)

3. Configure your DMD

This is an example config:

  platform: rpi_dmd
  cols: 32
  rows: 32
  gpio_slowdown: 2
  pwm_lsb_nanoseconds: 300
  width: 600
  height: 200
  title: Mission Pinball Framework
  window:   # on screen window
    width: 600
    height: 200
  dmd:   # source display for the DMD
    width: 32
    height: 32
    default: true
    round_anchor_x: left
    source_display: dmd
  window_slide_1:   # slide we'll show in the on-screen window
    - type: display   # this widget shows the DMD content in this slide too
        - type: color_dmd
      width: 512
      height: 128
    - type: text
      anchor_y: top
      y: top-3
      font_size: 30
      color: white
    - type: rectangle
      width: 514
      height: 130
      color: 444444
  dmd_slide_1:   # slide we'll show on the physical DMD
    - type: text
      text: IT WORKS!
      font_size: 30
      color: red
      target: window
      target: dmd
##! test
#! assert_text_on_top_slide "IT WORKS!" dmd
#! assert_text_on_top_slide "MISSION PINBALL FRAMEWORK" window

The size of your dmd (32x32 pixel in the example) should match your physical matrix. Also make sure to configure the rpi_dmd: section accordingly.

Note that the Using an RGB full-color LED DMD guide has more details on the window and slide settings used in this machine config.

4. Start MPF as root

For this library to work you need to start MPF as root like this:

sudo mpf game

This is needed for the matrix to access the hardware and it will drop privileges after it started.

Related How To guides

What if it did not work?

Have a look at our hardware troubleshooting guide.

Something missing or wrong? You can fix it!

This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?

Please help us! You can fix it yourself and be an official "open source" contributor!

It's easy! See our Beginner's guide to editing the docs.

Page navigation via the keyboard: < >

You can navigate this site via the keyboard. There are two modes:

General navigation, when search is not focused:

  • F , S , / : open search dialog
  • P , , : go to previous page
  • N , . : go to next page

While using the search function:

  • Down , Up : select next / previous result
  • Esc , Tab : close search
  • Enter : go to highlighted page in the results