015 - MakeCode MicroBit: Brickcell 8x8 Dot Matrix Display
Table of Contents
MAX7219 Dot Matrix Display
The MAX7219 is a serially interfaced, common-cathode LED display driver. It is often used to control dot matrix displays or seven-segment displays. The MAX7219 can drive up to 64 individual LEDs and uses a 16-bit shift register and constant-current LED drive, minimizing the number of required external components.
When used with an 8x8 dot matrix display, the MAX7219 controls 8 rows and 8 columns of LEDs (total of 64 LEDs). It greatly simplifies LED multiplexing and data control for display projects.
Key Features of the MAX7219
- SPI Interface: Communicates using a serial interface, allowing multiple MAX7219 modules to be daisy-chained together, reducing pin usage.
- Multiplexing: Controls multiple LEDs using fewer pins by cycling through rows rapidly to create the illusion of a steady display.
- Brightness Control: Digital control for LED brightness levels, allowing smooth intensity adjustments.
- Cascading: Multiple MAX7219 chips can be connected in series for larger or multiple display setups.
The MAX7219 is widely used in display-based projects such as scrolling text displays, digital clocks, and status indicators due to its ease of use and efficiency.
Hardware Instruction
Let's explore how to connect the Dot Matrix Display module (MAX7219) to a micro:bit and program it using MakeCode.
- Connect the MAX7219 GND pin to micro:bit GND pin.
- Connect the MAX7219 VCC pin to micro:bit 3V3 pin.
- Connect the MAX7219 serial data input (DIN) to micro:bit pin 15.
- Connect the MAX7219 serial clock (CLK) to micro:bit pin 14.
- Connect the MAX7219 chip select (CS) to micro:bit pin 13.
Software Instruction
Now, let's program the micro:bit to control the 8x8 MAX7219 Dot Matrix Display.
- Login to https://makecode.microbit.org/ using your Microsoft account.
- Create a new project by clicking the "New Project" button. Name it descriptively, such as dotmatrix-8x8-max7219-test.
- Click the "Extensions" block under the "Math" category.
- Type https://github.com/gbantique/brickcell-dotmatrix-max7219/ in the search bar.
- Select the brickcell-dotmatrix-max7219 from the search results. The "dotmatrix max7219" block should appear under the Brickcell category.
- Copy and paste the following code:
let max7219 = Brickcell.create()
max7219.setup(
1,
DigitalPin.P15,
DigitalPin.P14,
DigitalPin.P13,
DigitalPin.P16,
max7219_rotation_direction.clockwise,
true
)
basic.forever(function () {
max7219.scrollText(
"Brickcell 8x8 Dot Matrix Display",
150,
300
)
})
Or you can make a copy of my created project in your MakeCode workspace:
https://makecode.microbit.org/S88323-04917-57323-26509/
Expected Result
If you carefully follow the instructions above, you should see a scrolling text message: "Brickcell 8x8 Dot Matrix Display" on the LED matrix.