MAX7219 8 Digit Seven Segment Display Module (HCMODU0082)

LCD, TFT, OLED, LED modules
admin
Site Admin
Posts: 726
Joined: Sun Aug 05, 2012 4:02 pm

MAX7219 8 Digit Seven Segment Display Module (HCMODU0082)

Post by admin » Thu Mar 12, 2015 11:33 am

Image

Image

This 8 digit seven segment display module (HCMODU0082) is based upon the Maxim MAX7219 LED display driver. The module uses two standard 4 digit seven segment displays to display a total of 8 digits in RED with decimal point. A convenient input and output header allows additional modules to be daisy-chained and controlled with just just 3 digital IO pins. To panel mounting the module has 4 mounting holes and 4 brass pillars with screws are supplied.

The Maxim MAX7219 driver allows for each segment of up to 8 digits (with decimal point) to be controlled individually from a serial interface. An 8x8 static ram area stores each digit and multiplexing the display is handled automatically.

If you plan to use this module with an Arduino board we have written an exclusive library (HCMAX7219) than allows you to effortlessly display and scroll alphanumeric characters across one or more modules. This can be downloaded from the software section of our support forum here:

http://forum.hobbycomponents.com/viewforum.php?f=58

Or on github here:
https://github.com/HobbyComponents




Image

Model number: HCMODU0082
Driver: Maxim MAX7921
Voltage: 4.0 - 5.5V
Max current: 180mA (all LEDs on)
Min current: <0.5mA (shutdown mode)
Length: 82.3mm
Width: 15.5mm
Height: 18mm (approx)
Display length: 60.5mm
Display width: 14.2mm

Image



Image

Code: Select all

/* FILE:    HCMODU0082_Serial_7_Segment_Module_Example2
   DATE:    19/03/15
   VERSION: 0.2
   
REVISIONS:

12/03/15 Created version 0.1
19/03/15 Updated to work with V0.2 of the HCMAX7219 library

This is an example of how to use the Hobby Components serial 8 digit seven 7 
segment display module (HCMODU0082). To use this example sketch you will 
need to download and install the HCMAX7921 library available from the software
section of our support forum (forum.hobbycomponents.com) or on github:
(https://github.com/HobbyComponents)

The library assumes you are using one module. If you have more than one module
connected together then you will need to change the following line in the 
libraries HCMAX7219.h header file to the number of drivers you have connected:

#define NUMBEROFDRIVERS 1 <- Change this number


PINOUT:

MODULE.....UNO/NANO.....MEGA
VCC........+5V..........+5V
GND........GND..........GND
DIN........11...........51
CS (LOAD)..10...........10
CLK........13...........52

You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of promoting products that
directly compete with Hobby Components Ltd's own range of products.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, 
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED 
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR
LACK OF NEGLIGENCE. HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE
FOR ANY DAMAGES INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR 
CONSEQUENTIAL DAMAGES FOR ANY REASON WHATSOEVER. */

/* Include the HCMAX7219 and SPI library */
#include <HCMAX7219.h>
#include "SPI.h"

/* Set the LOAD (CS) digital pin number*/
#define LOAD 10
 
/* Create an instance of the library */
HCMAX7219 HCMAX7219(LOAD);


void setup() 
{
  HCMAX7219.Init();        
}

/* Main program */
void loop() 
{
  byte Loopcounter;
  byte Position;
  
  /* SCROLL SOME TEXT 5 TIMES BEFORE MOVING ON */
  for (Loopcounter = 0; Loopcounter <= 5; Loopcounter++)
  {
    /* We are scrolling 30 characters of text across the entire display */
    for (Position = 0; Position <= DISPLAYBUFFERSIZE + 30; Position++)
    { 
      /* Write the test to the output buffer at the position we require */
      HCMAX7219.print7Seg("HCMAX7219 SCROLLING TEXT DEMO ",Position);
      /* Send the output buffer to the display */
      HCMAX7219.Refresh();  
      delay(200);
    }
  }
  
  
  /* WE CAN ALSO DISPLAY INTEGER NUMBERS */
  
  /* Clear the output buffer */
  HCMAX7219.Clear();
  /* Write some text and output it*/
  HCMAX7219.print7Seg("INT NUM.",8);
  HCMAX7219.Refresh();
  delay(2000);
  
  /* display an example of a negative integer number */
  HCMAX7219.Clear();
  HCMAX7219.print7Seg(-1234567,8);
  HCMAX7219.Refresh();
  delay(2000);
  
  /* Clear the output buffer */ 
  HCMAX7219.Clear();
  /* Write some text and output it*/
  HCMAX7219.print7Seg("WITH DP.",8);
  HCMAX7219.Refresh();
  delay(2000);
  
  /* Show the DP in different places. Notice when the DP is at the 
    beginning the number is padded with a zero */
  HCMAX7219.Clear();
  for (Position = 1; Position <= 7; Position++)
  { 
    HCMAX7219.print7Seg(-1234567,Position,8);
    HCMAX7219.Refresh();
    delay(1000);
  }
}

Image

HCMAX7921 Arduino library for above sketch is available for download from the software section of our support forum here:

http://forum.hobbycomponents.com/viewto ... =58&t=1794

Or from github here:
https://github.com/HobbyComponents/HCMAX7219

MAX7921 Datasheet:
max7219.pdf
You do not have the required permissions to view the files attached to this post.

andreotti60
Posts: 1
Joined: Sat Jun 06, 2015 11:35 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by andreotti60 » Sat Jun 06, 2015 11:50 pm

This post was very helpful to me in understanding how these boards work. Thank you for sharing it. I was wondering about your wiring diagram which seems to be a Fritzing schematic. I was trying to recreate the same design using Fritzing but I cannot find the icon for the MAX7219 7-segments board in the library of components.

Can you please let me know if this component is in fact used in Fritzing and where I can download it?

Thank you very much indeed.

Gianluca

andrew
Site Admin
Posts: 796
Joined: Sun Aug 05, 2012 4:15 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by andrew » Mon Jun 08, 2015 8:07 am

I'm afraid it isn't created using Fritzing. All our diagrams are hand draw using a standard drawing package.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

dgw
Posts: 5
Joined: Wed Jan 14, 2015 7:54 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by dgw » Mon Apr 11, 2016 9:07 am

Hi, I can't seem to get this library to work with the Arduino Due. It compiles fine, but there are no signals being sent from the SPI pins (a simple SPI test example works fine). Any help appreciated, best wishes, dgw.

dgw
Posts: 5
Joined: Wed Jan 14, 2015 7:54 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by dgw » Mon Apr 11, 2016 9:07 am

Hi, I can't seem to get this library to work with the Arduino Due. It compiles fine, but there are no signals being sent from the SPI pins (a simple SPI test example works fine). Any help appreciated, best wishes, dgw.
EDIT: using Arduino 1.6.7

andrew
Site Admin
Posts: 796
Joined: Sun Aug 05, 2012 4:15 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by andrew » Tue Apr 12, 2016 8:46 am

The library wasn't tested with a Due but there shouldn't be a reason for it not to work. Looking at the library I suspect that the Due doesn't like the SPI library to be initialised inside of a constructor whereas on other Arduino boards it doesn't care. I'll try and get an update made to the library later today to fix the problem.

Edit: Actually it's probably not the fact that its being initialised inside a constructor, I think it's because on a Due it doesn't like the SPI library being Initialised before the setup() function. I've seen this problem before.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

dgw
Posts: 5
Joined: Wed Jan 14, 2015 7:54 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by dgw » Tue Apr 12, 2016 12:53 pm

thanks - I just did a quick modification to move the code out of the constructor and that seemed to work (but I'll also wait for the 'official' fix), cheers, d.

andrew
Site Admin
Posts: 796
Joined: Sun Aug 05, 2012 4:15 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by andrew » Tue Apr 12, 2016 3:07 pm

I've added an updated version (V0.3) of the library to the software section of the forum:

http://forum.hobbycomponents.com/viewto ... 4248#p4248

You need to add the following line to the setup() function in your sketch to initialise the library:
HCMAX7219.Init();
Hopefully it should work on the Due now.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

dgw
Posts: 5
Joined: Wed Jan 14, 2015 7:54 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by dgw » Tue Apr 12, 2016 5:36 pm

I can confirm that this works on the Due - thanks.

DIY_Monster
Posts: 12
Joined: Thu Nov 20, 2014 3:35 pm

Re: MAX7219 8 Digit Seven Segment Display Module (HCMODU0082

Post by DIY_Monster » Mon Jul 18, 2016 8:31 pm

I am attempting to display the time on the 7seg display in the form of 3 pairs of characters (unsigned int) HH, MM, SS. However if any of these have a leading zero then is not displayed and testing using the following:
HCMAX7219.print7Seg(1, 8); shows a 1 on the LHS while...
HCMAX7219.print7Seg(0, 8); does not compile with the error...
error: call of overloaded 'print7Seg(int, int)' is ambiguous
HCMAX7219.print7Seg(0, 8);

I also attempted to cast the number to a string as in...
HCMAX7219.print7Seg(String(0), 8);
Compile error: no matching function for call to 'HCMAX7219::print7Seg(String, int)' HCMAX7219.print7Seg(String("0"), 8);
Can anyone help?
William.

Post Reply