Silicon ChipEl Cheapo Modules, Part 7: LED Matrix displays - June 2017 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: SPICE streamlines circuit design
  4. Feature: The Flettner Rotating Sail and the Magnus Force by Ross Tester
  5. Project: All-new 10-Octave Stereo Graphic Equaliser, Part 1 by John Clarke
  6. Project: Arduino-based Digital Inductance & Capacitance Meter by Jim Rowe
  7. Feature: LTspice – simulating and circuit testing, Part 1 by Nicholas Vinen
  8. Serviceman's Log: Fixing the food processor that wouldn't by Dave Thompson
  9. Project: El Cheapo Modules, Part 7: LED Matrix displays by Jim Rowe
  10. Project: New Marine Ultrasonic Anti-Fouling Unit, Part 2 by Leo Simpson & John Clarke
  11. Feature: Getting Started with the Micromite, Part 4 by Geoff Graham
  12. Subscriptions
  13. Review: Keysight’s 9917A 18GHz Spectrum Analyser by Nicholas Vinen
  14. Product Showcase
  15. Vintage Radio: HMV’s 1951 portable model B61D by Associate Professor Graham Parslow
  16. PartShop
  17. Market Centre
  18. Advertising Index
  19. Notes & Errata: Micromite LCD BackPack V2 / ATmega-based Metal Detector with stepped frequency indication (Notebook Mar17)
  20. Outer Back Cover: Hare & Forbes Machineryhouse

This is only a preview of the June 2017 issue of Silicon Chip.

You can view 43 of the 112 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "All-new 10-Octave Stereo Graphic Equaliser, Part 1":
  • 10-Octave Stereo Graphic Equaliser PCB [01105171] (AUD $12.50)
  • Front panel for the 10-Octave Stereo Graphic Equaliser [01105172] RevB (PCB, AUD $15.00)
  • 10-Octave Stereo Graphic Equaliser acrylic case pieces (PCB, AUD $15.00)
  • 10-Octave Stereo Graphic Equaliser PCB pattern (PDF download) [01105171] (Free)
  • 10-Octave Stereo Graphic Equaliser front panel artwork (PDF download) (Free)
Articles in this series:
  • All-new 10-Octave Stereo Graphic Equaliser, Part 1 (June 2017)
  • All-new 10-Octave Stereo Graphic Equaliser, Part 1 (June 2017)
  • Completing our new Graphic Equaliser (July 2017)
  • Completing our new Graphic Equaliser (July 2017)
Items relevant to "Arduino-based Digital Inductance & Capacitance Meter":
  • 1nF ±1% polypropylene (MKP) or C0G/NP0 ceramic capacitor (Component, AUD $2.50)
  • 16x2 Alphanumeric serial (I²C) LCD module with blue backlight (Component, AUD $12.50)
  • Clear UB3 Lid for Arduino-based Digital LC Meter (PCB, AUD $5.00)
  • Firmware (Arduino Sketch) file for the Arduino-based Digital Inductance & Capacitance Meter [Arduino_LC_meter_sketch.HEX] (Software, Free)
  • Arduino-based Digital LC Meter front panel artwork (PDF download) (Free)
Items relevant to "LTspice – simulating and circuit testing, Part 1":
  • Software for the LTspice Tutorial, Part 1 (Free)
Articles in this series:
  • LTspice – simulating and circuit testing, Part 1 (June 2017)
  • LTspice – simulating and circuit testing, Part 1 (June 2017)
  • LTspice Part 2: Simulating and Testing Circuits (August 2017)
  • LTspice Part 2: Simulating and Testing Circuits (August 2017)
  • LTspice Tutorial Part 3: Modelling an NTC Thermistor (September 2017)
  • LTspice Tutorial Part 3: Modelling an NTC Thermistor (September 2017)
  • LTspice Simulation: Analysing/Optimising Audio Circuits (May 2018)
  • LTspice Simulation: Analysing/Optimising Audio Circuits (May 2018)
Items relevant to "El Cheapo Modules, Part 7: LED Matrix displays":
  • MAX7219 controller (SMD) with pluggable 8x8 red LED matrix display (Component, AUD $4.50)
  • MAX7219 controller (DIP) with pluggable 8x8 red LED matrix display and jumper leads (Component, AUD $2.50)
  • MAX7219 controller (SMD) with red 8-digit 7-segment display (Component, AUD $5.00)
  • Software for MAX7219 (Free)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
Items relevant to "New Marine Ultrasonic Anti-Fouling Unit, Part 2":
  • New Marine Ultrasonic Anti-Fouling Unit PCB [04104171] (AUD $15.00)
  • PIC16F88-I/P programmed for the New Marine Ultrasonic Anti-Fouling Unit [0410417A.HEX] (Programmed Microcontroller, AUD $15.00)
  • One 40kHz 50W ultrasonic transducer (Component, AUD $55.00)
  • ETD29 transformer components (AUD $15.00)
  • IPP80N06S4L-07 high-current N-channel Mosfet (TO-220) (Component, AUD $2.00)
  • New Marine Ultrasonic Anti-fouling unit lid panel artwork (PDF download) (Free)
Articles in this series:
  • New Marine Ultrasonic Anti-Fouling Unit (May 2017)
  • New Marine Ultrasonic Anti-Fouling Unit (May 2017)
  • New Marine Ultrasonic Anti-Fouling Unit, Part 2 (June 2017)
  • New Marine Ultrasonic Anti-Fouling Unit, Part 2 (June 2017)
Items relevant to "Getting Started with the Micromite, Part 4":
  • Software for the Micromite Tutorial, Part 4 (Free)
Articles in this series:
  • Getting Started with the Micromite (February 2017)
  • Getting Started with the Micromite (February 2017)
  • Getting Started with the Micromite, Part Two (March 2017)
  • Getting Started with the Micromite, Part Two (March 2017)
  • Micromite Tutorial, Part 3: strings and arrays (May 2017)
  • Micromite Tutorial, Part 3: strings and arrays (May 2017)
  • Getting Started with the Micromite, Part 4 (June 2017)
  • Getting Started with the Micromite, Part 4 (June 2017)

Purchase a printed copy of this issue for $10.00.

SPI 8x8 LED Matrix Display Module Using Cheap Asian Electronic Modules Part 7: by Jim Rowe This low-cost module uses a Maxim MAX7219 serial LED display chip and comes complete with a plug-in 8x8 LED matrix display. But the MAX7219 is equally capable of driving an 8-digit 7-segment LED display and its SPI interface allows it to be driven by a micro using only three wires, meaning both the module and the chip are surprisingly flexible. W hen I first noticed this type of 8x8 LED matrix display module being offered on eBay and AliExpress, I must confess that I didn't get overly excited. Sure, they were very cheap – but what could you actually use an 8x8 LED matrix display for? All I could think of was for displaying a few pretty patterns. Fun, perhaps, but not all that useful. Despite this ho-hum first impression, I decided to order a couple of the modules just to see if they had any other uses. And when they arrived, I discovered that they did. This very cheap module includes the MAX7219 IC and a plug-in 8x8 LED matrix display. siliconchip.com.au The data sheet for the MAX7219 controller chip is available from Maxim's website (https://datasheets.maximintegrated.com/en/ds/MAX7219MAX7221.pdf) and indicates that it has primarily been designed to drive an 8-digit 7-segment LED display. In fact, the ability to drive an 8x8 LED matrix is in many ways just a bonus feature! Inside the MAX7219 To understand the dual personality of the MAX7219, take a quick look at the block diagram, Fig.1. As you can see, there's more inside this modestlooking 24-pin DIP device than you might have expected. Down at the bottom, you can see the 16-bit shift register where data and instructions are shifted into the chip from almost any micro, via a standard SPI (Serial Peripheral Interface) bus. Then above the eight least significant bits (D0-D7) is an eight-byte dual-port SRAM, where the display data is stored. Four more bits, D8-D11, are decoded to determine whether the data in the lower eight bits of the shift register is to be loaded into one of the addresses in the display SRAM (either with or without further decoding), or into one of the control registers to set the chip's operating modes. Five registers control shutdown, the mode, intensity, scan limit and display test. Briefly, the purpose of the shutdown register is to blank the display when power is first applied or at a later time, to reduce the power consumption. It can also be used to flash the display on and off, for “alarm” situations. During normal operation, data bit D0 of this register is set to one. The mode register is used to control whether the data in the SRAM registers for each digit is to be decoded (according to “CODE B”) or used as-is. The interesting point here is that the mode register can be set for decoding all eight digits, none of them or virtually any combination in between. So for driving an 8x8 LED matrix, for example, you wouldn't use the decoding features, while for driving an 8-digit 7-segment display you'd program it to decode all eight registers. But you could also use it to drive a 6-digit 7-segment display by decoding just those six digits, with the remaining two digit positions either unused or used without June 2017  61 SEGMENT CURRENT REFERENCE 8 CODE B ROM WITH BYPASS SHUTDOWN REG. 8 MODE REGISTER INTENSITY REG. SEG B SEGMENT DRIVERS ISET of register address bits D8-D11 while Fig.3 shows the significance of data bits D0-D7 when segment decoding (ie, “CODE B”) is enabled (A) or decoding is disabled (B). SEG A INTENSITY PULSE WIDTH MODULATOR SEG C SEG D SEG E Driving the 8x8 LED matrix SEG F SEG G So that's a quick run-down on the MAX7219 device and its internal working. Fig.4 shows the full circuit for the module as it arrives and it has everything needed to drive the 8x8 LED matrix directly from a micro like an Arduino or a Micromite. There's very little to the module apart from the MAX7219 (IC1), the 8x8 LED matrix and the two 8-pin connectors (CON2 and CON3) used to join them together. There are two 5-pin SIL connectors; one used for the supply and serial bus inputs (CON1) and the other for the matching outputs (CON4) used for daisy-chaining further modules, plus the 10kW resistor connected to IC1's ISET pin and a pair of bypass capacitors on the 5V supply line, one 100nF and one 10µF electrolytic. Programming it to produce interesting patterns turns out to be fairly straightforward, as we'll see shortly. But before we do so, you'll recall that I mentioned earlier that the MAX7219 was originally intended for driving 7-segment LED displays of up to eight digits. SEG DP SCAN -LIMIT REG . DISPLAY TEST REG. 8x8 DUAL–PORT SRAM ADDRESS REGISTER DECODER LOAD MULTIPLEX SCAN CIRCUITRY DIGIT DRIVERS D6 8 8 D5 D4 D3 D2 D1 D0 8 DIN D7 4 (MSB ) D0 D1 D2 D3 D4 D5 D6 D7 D8 DOUT D9 D10 D11 D12 D13 D14 D15 CLK Fig.1: internal block diagram of the MAX7219 IC. The 8-byte dual-port SRAM is used to store the current LED state while the decoder block simplifies the software required to drive a 7-segment display. The segment drivers supply a fixed current determined by the current flow out of the Iset pin and intensity is modulated by PWM applied by those same segment drivers. decoding to drive other indicator LEDs. So it's quite flexible. The intensity register provides programmable digital control over the brightness of the LEDs. As you can see from Fig.1, the chip has a segment current reference circuit (at upper left), controlled by the current fed in via the ISET pin (pin 18). The peak current sourced from the chip's segment driver outputs (upper right) is nominally 100 times the current entering the ISET pin, which is normally connected to the +5V supply rail via a resistor of 9.53kW or more. The module shown in the pictures uses a 10kW resistor. At the same time, the value stored in bits D0-D3 of the intensity control register determines the duty cycle of the chip's internal pulse-width modulator and hence the display brightness. The duty cycle is a 4-bit value, meaning that there are 16 different programmable duty cycle/brightness levels, from 1/32 (3%) to 31/32 (97%). Then there's the scan limit control register, which is basically used to determine how many digits are scanned by the display multiplexing circuitry. This allows the chip to be programmed for any number of display digits between one and eight. Note though that Maxim warns in the datasheet that if three or 62  Silicon Chip fewer digits are selected, the resistor connected to the chip's I SET pin should be increased in value to reduce the power dissipation in the digit drivers. Finally, there's the display test control register, which can be used to switch between normal operation and the test mode, where all segments are lit in order to test the display itself. To help you put all of these functions of the MAX7219 into perspective, Fig.2 summarises the decoding D15 D14 D13 D12 D11 D10 This configuration is shown in Fig.5, with a pair of 4x7-segment displays wired to CON2 and CON3 of the DATA BITS REGISTER ADDRESS BITS DON ’T CARE Driving 8-digit 7-segment displays D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 X X X X 0 0 0 0 = NO OP (X0 hex) X X X X 0 0 0 1 = DIGIT 0 (X1 hex) X X X X 0 0 1 0 = DIGIT 1 (X2 hex) X X X X 0 0 1 1 = DIGIT 2 (X3 hex) X X X X 0 1 0 0 = DIGIT 3 (X4 hex) X X X X 0 1 0 1 = DIGIT 4 (X5 hex) X X X X 0 1 1 0 = DIGIT 5 (X6 hex) X X X X 0 1 1 1 = DIGIT 6 (X7 hex) X X X X 1 0 0 0 = DIGIT 7 (X8 hex) X X X X 1 0 0 1 = DECODE MODE (X9 hex) X X X X 1 0 1 0 = INTENSITY (XA hex) X X X X 1 0 1 1 = SCAN LIMIT (XB hex) X X X X 1 1 0 0 = SHUTDOWN (XC hex) X X X X 1 1 1 1 = DISPLAY TEST (XF hex) Fig.2: data is sent to the MAX7219 over a serial bus, 16 bits at a time. This table shows how bits 8-11 determine which register is written to, while bits 0-7 contain the new data for that register. With bits 8-11 set to a value between 1 and 8, one of the entries in the dual-port SRAM is updated while values of between 9 and 12 or 15 are used to write to one of the five control registers. siliconchip.com.au Above is the layout of the module without the 7-segment display and below in Fig.4 is the matching circuit diagram. Fig.3 (left): when “Code B” decoding is active for a segment, the lower four bits of the value for that segment forms a lookup table for one of 16 possible 7-segment display configurations, as shown at right. The top bit determines whether the decimal point is lit. Compare this to (B) at bottom, where decoding is not active and the eight bits in SRAM control the segment drivers directly. Fig.4 (below): the circuit of a typical pre-built 8x8 LED matrix module with MAX7219 driver. A photo of this type of module is shown above. There’s virtually nothing to it, just the LED matrix display module, the MAX7219 IC and some connectors to join them together and to provide connections to the microcontroller and optionally, more daisy-chained LED displays. 1088 AS 8x8 LED MATRIX 19 100nF Vcc SEG DP 10k SEG G 18 SEG F ISET SEG E SEG D SEG C 10 F IC1 MAX7219 SEG B SEG A DIG0 DIG1 DIG2 1 13 12 24 DIG3 DIN DIG4 CLK DIG5 LOAD (CS) DIG6 DOUT DIG7 GND 4 CON1 VCC GND DATA IN CS CLK siliconchip.com.au 13 CON3 GND 9 SEG G 16 22 SEG F 15 4 17 DIG 1 14 10 15 SEG DP 13 6 21 DIG 3 12 11 3 23 SEG E 11 15 20 SEG C 10 16 16 DIG 0 9 14 9 14 8 12 1 7 2 5 2 11 SEG D 6 DIG 2 7 DIG 5 CON2 8 7 3 6 10 DIG 7 5 5 SEG B 4 8 SEG A 3 DIG 6 2 DIG 4 1 CON4 VCC GND DATA OUT CS CLK June 2017  63 Fig.5: the circuit of a typical pre-built 8-digit 7-segment common cathode LED display using a MAX7219. Pre-built modules for this configuration are also available. We haven't shown the IC itself, as its configuration is identical to that of Fig.4 – all that's changed is that in place of the 8x8 LED matrix are two 4-digit 7-segment displays with the anodes wired in parallel. module instead of the 8x8 LED matrix. Note that for space reasons, we haven't shown the MAX7219 chip or the rest of the module circuitry to the left of CON2 and CON3 in Fig.5, but these are all exactly the same as in Fig.4. In fact, the only changes needed to drive a pair of 4x7-segment displays instead of an 8x8 LED matrix with the MAX7219 module are in terms of software rather than hardware. Specifically, it's just a matter of enabling decoding for all eight digits, instead of disabling it, as required for driving the 8x8 LED matrix. Which leads us on to hooking the MAX7219 module up to popular micros and programming it to display what you want. In fact, not only is it possible to drive an 8-digit display using a MAX7219, pre-built modules are available on eBay and AliExpress, etc. These incorporate a PCB with an SMD MAX7219 on the back and two 4-digit 7-segment displays plugged into header sockets on the front. Like the 8x8 matrix displays, they have 6-pin connectors at each end to wire up to your micro and also allow daisy chaining. Driving them from an Arduino As shown in Fig.6, it's quite easy to Fig.6: connecting either type of MAX7219-based module to an Arduino is easy. Simply wire up the SPI pins and power supply to the ICSP header on the Arduino and the CS pin to a free GPIO – ideally IO10 which is the hardware slave select (SS) pin. 64  Silicon Chip siliconchip.com.au Directly below you can see the underside of the module is sparse, only having the markings for the connections to and from the module. GND +5V +3.3V 26 24 22 SCK SS 21 MICROMITE 18 MOSI SS SCK 17 16 14 (MISO ) 10 9 5 4 3 MOSI RESET connect these modules up to almost any Arduino or Arduino clone, by taking advantage of the fact that most of the connections needed for interfacing to an SPI peripheral are made available on the 6-pin ICSP header fitted to most Arduino variants. The connections to the ICSP header are fairly consistent over just about all Arduino variants, including the Uno, Leonardo and Nano, the Freetronics Eleven and LeoStick, and the Duinotech Classic or Nano. In fact the only connection that's not available via the ICSP header is the one for SS/CS/LOAD, which needs to be connected to the IO10/ SS pin of an Arduino Uno, Freetronics Eleven or Duinotech Classic as shown in Fig.6. With other variants you should be able to find the corresponding pin without too much trouble and even if you can't, the pin reference can be changed in your software sketch to match the pin you do elect to use. Driving them from a Micromite It's also quite easy to drive these modules from a Micromite, using the connections shown in Fig.7. By connecting the MOSI, SCK and SS/LOAD lines to Micromite pins 3, 25 and 22 as shown, MMBasic's built in SPI protocol commands will have no trouble in communicating with the module. siliconchip.com.au VCC GND DATA IN CS CLK VCC GND DATA OUT CS CLK TO OTHER MODULES 25 MAX7219 BASED 8x8 LED MATRIX DRIVER MODULE Fig.7 (left): wiring a MAX7219 module to a Micromite is simply a matter of connecting the 5V, GND and 3-wire SPI bus between the two units. The MOSI and SCK pins on the Micromite are fixed (and may vary between different types of Micromite) while slave select (SS) can go to pretty much any digital output pin. So that's the basic story regarding the hardware side of the MAX7219 based module which can drive either an 8x8 LED matrix array or eight 7segment LED displays. Before we finish, a few words are in order regarding the software side, ie, how to write programs to get the module to display what you want. Writing the software The basic idea here is that when your program starts up, it needs to carry out a number of set-up tasks. These are: • Declare the micro's pins that are going to be used by the SPI interface and set them to their idle state (normally high). • Start up the SPI interface, with its settings configured for a clock rate of say 5MHz, the data to be sent MSB (most significant bit) first and using clock/data timing mode 0. If possible, it should also be set for the data to be exchanged in 16-bit words rather than bytes. • Send the initialisation commands to the MAX7219 to set up its five control registers: shutdown, decode mode, intensity, scan limit and display test. After these tasks have been done, you should be able to send out the actual display data for each of the 8-digit display addresses in the MAX7219's SRAM. And if the display is to be a dynamic one, you can send out revised data at the appropriate times. To help you understand what's involved in writing your own programs for the module, I have written a couple of simple example programs which repeatedly display an expanding star pattern on the 8x8 LED matrix array (you can see the fully expanded star on the lead photo). One of these programs is written for Arduino and is called “sketch2_ for_Testing_MAX7219.ino”. The other is written for the Micromite, and is called “MAX7219 LED array Star.bas”. Both of these programs are available for download from the Silicon Chip website (www.siliconchip.com.au). Both programs simply blank the display for a second or so, then cause a small square pattern to appear first in the centre of the array and then expand out fairly quickly to form a star, with its tips at the four corners of the array. The expanded star remains visible for about three seconds before the array is blanked again and the sequence repeats. It's all quite simple, but either program should give you a reasonably clear guide regarding how to use the MAX7219 display driver module in your own projects. I've tried to provide a lot of explanatory comments in both programs, to SC help in this regard. June 2017  65