Displaying on MAX7219 Dot Matrix Using Raspberry Pi

If you want to have a bigger number or string display, you can consider to use MAX7219 Dot Matrix Display

INTRODUCTION

If you want to have a bigger number or string display, you can consider to use 4 In 1 MAX7219 Dot Matrix Display Module. In this tutorial, we will show you how to interface MAX7219 Dot Matrix with Raspberry Pi based on Luma.LED_Matrix library. Credit to Richard Hull.

VIDEO

This video shows how to display on 4 in 1 MAX7219 Dot Matrix Display module using Raspberry Pi based on Luma.LED_matrix library.

HARDWARE PREPARATION

Wiring Connections

4 In 1 MAX7219 Dot Matrix Display ModuleMaker pHAT
VCC5V
GNDGND
DINMOSI
CSCE0
CLKSCK

Software Preparation

First, you need to enable SPI module in Raspberry Pi. Then instal Luma.LED_Matrix library (credit to Richard Hull). Write following command on Terminal.

sudo apt-get install build-essential

sudo apt-get install python-dev python-pip

sudo apt-get install libfreetype6-dev libjpeg-dev

git clone http://github.com/rm-hull/luma.led_matrix.git

sudo -H pip install –upgrade luma.led_matrix

Sample Code

This is the python sample code to do a basic display on MAX7219 Dot Matrix.

import RPi.GPIO as GPIO
from time import sleep, strftime
from datetime import datetime
from luma.core.interface.serial import spi, noop
from luma.core.render import canvas
from luma.core.virtual import viewport
from luma.led_matrix.device import max7219
from luma.core.legacy import text, show_message
from luma.core.legacy.font import proportional, CP437_FONT, LCD_FONT
serial = spi(port=0, device=0, gpio=noop())
device = max7219(serial, width=32, height=8, block_orientation=-90)
device.contrast(5)
virtual = viewport(device, width=32, height=16)
show_message(device, 'Raspberry Pi MAX7219', fill="white", font=proportional(LCD_FONT), scroll_delay=0.08)
try:
while True:
with canvas(virtual) as draw:
text(draw, (0, 1), "Idris", fill="white", font=proportional(CP437_FONT))
#text(draw, (0, 1), datetime.now().strftime('%I:%M'), fill="white", font=proportional(CP437_FONT))
except KeyboardInterrupt:
GPIO.cleanup()

Thank you

References

  1. Luma.LED_Matrix, credit to Richard Hull.

Thanks for reading this tutorial. If you have any technical inquiry, please post at Cytron Technical Forum.

3 thoughts on “Displaying on MAX7219 Dot Matrix Using Raspberry Pi”

  1. DIANA ANN AGAST

    Can I know what is the software name for coding? I doing my finally year project by using raspberry pi zero n I’m using the same coding but he has be an error.

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

Ultrasonic HC-SR04P Using Raspberry Pi Pico
Object Sense With Servo Using Maker Pi RP2040
Build Otto DIY Robot Using Maker Pi RP2040
Raspberry Pi RP2040 vs STM32F1 vs SAMD21G18 vs ESP32-S2
The Easiest Way to Print Temperature Tower Using Cura 4.9.1 Plugins
Tutorials of Cytron Technologies Scroll to Top