Home CodeEspruino Espruino and MAX7219 7 segment display example

Espruino and MAX7219 7 segment display example

by shedboy71

The MAX7219  is a compact, serial input/output common-cathode display drivers that interface microprocessors (µPs) to 7-segment numeric LED displays of up to 8 digits, bar-graph displays, or 64 individual LEDs. Included on-chip are a BCD code-B decoder, multiplex scan circuitry, segment and digit drivers, and an 8×8 static RAM that stores each digit. Only one external resistor is required to set the segment current for all LEDs.

These chips are commonly found on 8×8 LED matrix modules and 7 segment modules, we will look at an example for the second example. The module we used was low cost and looked like this.

max7219-seven-segment-display

You can use these in a wide variety of projects that require some sort of numeric display such as temperature projects, stopwatch, distance meter and a clock – to fire off a couple of ideas. We will be revisiting these in future projects but lets take a look at how to connect these to our Espruino

Connection

Here are the connections that I used

Module Pin Espruino Pin
GND GND
VCC VBAT
DIN B5
CS B4
CLK B3

 

Layout

Here is a layout diagram showing the connections above

 

espruino-max7219-7segment

Code

A very simple example which displays some numbers on the display

[codesyntax lang=”javascript”]

require("MAX7219");

SPI1.setup({mosi:B5, sck:B3});
var disp = require("MAX7219").connect(SPI1,B4);
disp.on();
disp.set("01234567");

[/codesyntax]

 

Link

These modules are prices about the $2.50 mark
MAX7219 EWG 8-Digit Digital Tube Display Control Module Red

Share

You may also like