Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
HCDotMatrix Arduino library for 8x8 LED dot matrix module 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 650
Post HCDotMatrix Arduino library for 8x8 LED dot matrix module
Image

This Arduino library was written to work with our 8 x 8 LED dot matrix module (HCOPTO0011)

You will need to download and unzip this library to the Adruino development environment library area

On Windows:
My Documents\Arduino\libraries\
My Documents\Arduino\libraries\
My Documents\Arduino\libraries\

On Mac:
Documents/Arduino/libraries/
Documents/Arduino/libraries/
Documents/Arduino/libraries/

or similarly for Linux.


To use the library just include the HCDotMatrix.h header file and create an instance of the HCDotMatrix library. E.g:

Code:
HCDotMatrix HCDotMatrix(R0,R1,R2,R3,R4,R5,R6,R7,C0,C1,C2,C3,C4,C5,C6,C7);

Where R0 to R7 are the digital IO pins connected to the modules 8 row pins and C0 to C7 are the digital IO pins used to connect to the modules 8 column pins.

The following functions are available with this library:

Code:
HCDotMatrix.print(Array[], TextPosition);

Outputs a string of ascii test to the module with a column pixel offset of TextPosition. But incrementing the value of TextPosition this allows you create the illusion of scrolling text. Array[] is of type char array[] with a null termination, and TextPosition is of type Int.

Code:
HCDotMatrix.UpdateMatrix();

This must be continually run in your main loop or via a timer interrupt (See HCTimer2 library) to keep the matrix refreshed.

Example Arduino Sketch:
Code:
/* FILE:    ARD_HC_Dot_Matrix_Example_1
   DATE:    19/09/13
   VERSION: 0.1

REVISIONS:

19/09/13 Created version 0.1

This is an example of how to use the Hobby Components 8x8 LED dot matrix
display module (HCOPTO0011)

To connect the LED module to an Arduino development board please follow
the pinout below:

MATRIX LED    ARDUINO

R1            D9
R2            D4
R3            A0 (D14)
R4            D6
R5            D10
R6            A1 (D15)
R7            D11
R8            A3 (D17)

C1*           D5
C2*           D12
C3*           D13
C4*           D8
C5*           A2 (D16)
C6*           D7
C7*           D3
C8*           D2

* ALL MATRIX COLOUMN PINS MUST BE CONNECTED TO THE ARDUINO BOARD VIA A 220R
RESISTOR OTHERWISE YOU MAY RISK DAMAGING THE MODULE.

HCOPTO0011 8X8 MATRIX LED PINOUT:

PIN  1   2   3   4   5   6   7   8
LED  C8  C7  R2  C1  R4  C6  C4  R1

PIN  9   10  11  12  13  14  15  16
LED  R5  R7  C2  C3  R8  C5  R6  R3


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 selling 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 7 segment display library */
#include <HCDotMatrix.h>

/* Create an instance of HCDotMatrix(pinout). Where pinout is the DIO pin
   connections to the module in the order of R0...R7 and C0...C7 */
HCDotMatrix HCDotMatrix(9,4,14,6,10,15,11,17,5,12,13,8,16,7,3,2);

/* Stores the position index for the portion of text to diplay */
int TextPosition;
/* Used to control the scroll speed. */
int ScrollCounter = 0;

void setup()
{

}

/* Main program */
void loop()
{
  /* Increment the scroll counter */
  ScrollCounter++;
 
  /* Has enough time passed to move the text by one position ?*/
  if (ScrollCounter >= 100)
  {
    /* Have we got to the end of the text (24 characters x 8 pixels wide)?
       If so go back to the start.*/
    if (TextPosition > (24*8))
      TextPosition = 0;
   
    /* Output a string to the matrix buffer and specify the display
       column position */
    HCDotMatrix.print("WWW.HOBBYCOMPONENTS.COM", TextPosition);
   
    TextPosition++;
    ScrollCounter = 0;
  }
 
  /* Refresh the display. This must be run continuously */
  HCDotMatrix.UpdateMatrix();
}


Example Sketch Using HCTimer2 Library:
Code:
/* FILE:    ARD_Dot_Matrix_Example_2
   DATE:    19/03/13
   VERSION: 0.1

REVISIONS:

19/09/13 Created version 0.1

This is an example of how to use the 8x8 LED dot matrix display module (HCOPTO0011).
This example uses the HCTimer2 library as well as the HCDotMatrix library to keep
the LED's regularly updated whilst keeping the main loop completely free for other
code.

To connect the LED module to an Arduino development board please follow
the pinout below:

MATRIX LED    ARDUINO

R1            D9
R2            D4
R3            A0 (D14)
R4            D6
R5            D10
R6            A1 (D15)
R7            D11
R8            A3 (D17)

C1*           D5
C2*           D12
C3*           D13
C4*           D8
C5*           A2 (D16)
C6*           D7
C7*           D3
C8*           D2

* ALL MATRIX COLOUMN PINS MUST BE CONNECTED TO THE ARDUINO BOARD VIA A 220R
RESISTOR OTHERWISE YOU MAY RISK DAMAGING THE MODULE.

HCOPTO0011 8X8 MATRIX LED PINOUT:

PIN  1   2   3   4   5   6   7   8
LED  C8  C7  R2  C1  R4  C6  C4  R1

PIN  9   10  11  12  13  14  15  16
LED  R5  R7  C2  C3  R8  C5  R6  R3


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 selling 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 7 segment display library */
#include <HCDotMatrix.h>

/* Include the HCTimer2 library */
#include <HCTimer2.h>

/* Create an instance of HCDotMatrix(pinout). Where pinout is the DIO pin
   connections to the module in the order of R0...R7 and C0...C7 */
HCDotMatrix HCDotMatrix(9,4,14,6,10,15,11,17,5,12,13,8,16,7,3,2);

int TextPosition;

void setup()

  /* Initialise the HCTimer2 library with a 2.04mS interval.
     See HCTimer2 library for more information */
  HCTimer2Init(T2_CLK_DIV_128, 254);
}

/* Main program */
void loop()
{
  for (TextPosition = 0; TextPosition <= (24*8); TextPosition++)
  {
    /* Output a string to the matrix buffer and specify the display
       column position */
    HCDotMatrix.print("WWW.HOBBYCOMPONENTS.COM", TextPosition);
    delay(80);
  }
}


/* Use the HCTimer2 Timer 2 interrupt to constantly refresh the
   matrix LED display. */
void HCTimer2()
{
   /* Output the current buffer to the matrix */
   HCDotMatrix.UpdateMatrix();
}


Library:
Attachment:
HCDotMatrix.zip


You do not have the required permissions to view the files attached to this post.


Thu Oct 24, 2013 3:37 pm
Profile

Joined: Fri Aug 29, 2014 5:13 pm
Posts: 1
Post Re: HCDotMatrix Arduino library for 8x8 LED dot matrix modul
I can't make this work :S


Fri Aug 29, 2014 5:23 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 645
Post Re: HCDotMatrix Arduino library for 8x8 LED dot matrix modul
Do you mean you can't compile the software or you are not seeing anything on the dot matrix module?

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Sat Aug 30, 2014 1:41 pm
Profile

Joined: Sat Apr 04, 2015 3:40 am
Posts: 1
Post Re: HCDotMatrix Arduino library for 8x8 LED dot matrix modul
Some problem in schematic and I have the inverted module. So I edit constructor in cpp to add appropriate variable also


Sun Apr 05, 2015 6:20 pm
Profile

Joined: Tue Apr 14, 2015 9:00 pm
Posts: 3
Post Re: HCDotMatrix Arduino library for 8x8 LED dot matrix modul
got issues as well so in a desperate attempt i went in with a multimeter and i now have a completely different pinout will post it as soon as i'm home
altough i now can manually light up any led i want by applying power to the appropriate pins the library and examples will not work for me instead every led on the module lights up and simply stays lit :cry: want it to display some text for electronic music box im making for my wife


Tue Apr 14, 2015 9:53 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 645
Post Re: HCDotMatrix Arduino library for 8x8 LED dot matrix modul
Could either if you confirm that you are using the LED module that came with either the Experimenters or Master kit? If so I'll take a look at the library and see if I can fix it.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Wed Apr 15, 2015 7:36 am
Profile

Joined: Tue Apr 14, 2015 9:00 pm
Posts: 3
Post Re: HCDotMatrix Arduino library for 8x8 LED dot matrix modul
Hi Andrew ,
I have taken a look at my order history and indeed it is an 1588BS display from the experimenters kit.
I have made some progress and can now based on the blink sketch control the columns and make them scroll.
As promised in previous post i give the pinout as i have found it
This pinout has the following orientation
1588BS text to the left with the 1 on the top
the right hand side contains pin 9 to 16 beginning from the top

Matrix pin control element Arduino
1 C4 D8
2 C2 D12
3 R2 D4
4 R3 A0
5 C1 D5
6 R5 D10
7 C3 D13
8 C6 D7
9 R8 A3
10 R7 D11
11 C7 D3
12 R1 D9
13 C5 A2
14 R6 A1
15 R4 D6
16 C8 D2


I could post the scrolling sketch i've made if requested


Wed Apr 15, 2015 1:03 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 645
Post Re: HCDotMatrix Arduino library for 8x8 LED dot matrix modul
Thanks for confirming and the info. I'll take a look at the library. Please bear with me though because I'll probably have to wire one up first. I'll post back here I figure out a fix for it.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Wed Apr 15, 2015 4:11 pm
Profile

Joined: Tue Apr 14, 2015 9:00 pm
Posts: 3
Post Re: HCDotMatrix Arduino library for 8x8 LED dot matrix modul
Hi Andrew,

Victory at last I found the correct pinout for the 1588BS LED matrix

from top left pin 1 to 8
1:R5 goes to D10
2:R7 goes to D11
3:C2 goes to D12
4:C3 goes to D13
5:R8 goes to A3
6:C5 goes to A2
7:R6 goes to A1
8:R3 goes to A0

from bottom right pin 9 to 16
9: R1 goes to D9
10:C4 goes to D8
11:C6 goes to D7
12:R4 goes to D6
13:C1 goes to D5
14:R2 goes to D4
15:C7 goes to D3
16:C8 goes to D2

*All C's must be connected through a 220 ohm resistor
sketches are working now
mus be an older model of display than the one you're offering now with a different pinout than presented in the sketch info
:lol:
thanks a lot for the support

:oops: see now i had it reversed


Fri Apr 17, 2015 6:22 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 645
Post Re: HCDotMatrix Arduino library for 8x8 LED dot matrix modul
That's great. We did indeed change the modules in the kit but this was quite some time ago so you must have a very old kit. I could still do with looking at the library because it's getting a little out of date and would benefit with a update.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Sat Apr 18, 2015 8:21 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD