Go Down

Topic: Arduino mega and 128x64 LED matrix (Read 466 times) previous topic - next topic

crywolf49

I recently purchased P2.5 128x64 LED matrix.
I'm having trouble getting it to work with my Arduino Mega.
Sketch works fine on my 32x64 matrix.
I would like to display more data hence I purchased the 64x128.

I am hoping someone here can help me figure out what is wrong. The ghosting on the right hand side baffles me. Am I using the wrong libraries or should I be using an extra library?

Purchase location and matrix details are in the attached file "matrix specs".

I use the standard ABCDE wiring as shown on this site:
https://raw.githubusercontent.com/DFRobot/DFRobotMediaWikiImage/master/Image/DFR0499_Connection_Diagram.png

The sketch "9ball_scorer.ino" is also attached.

"32x64 scorer.jpg" is a picture of the scoreboard sketch running on the 32x64.

"64x128 scorer.jpg" is a picture of the scoreboard sketch running on the 64x128.

ieee488

I don't know if your 128x64 is the same as the I bought and sold, but take a look at http://woodsgood.ca/projects/2015/04/14/192x64-pixel-graphics-lcd-module/ .
I followed that tutorial to get my 128x64 LCD working.

.

PaulRB


PaulRB

#3
Nov 20, 2019, 09:06 pm Last Edit: Nov 20, 2019, 09:22 pm by PaulRB
If you want forum members to read your code, its best to post it in line, between code tags, like below and as described in the forum guide in the "please read" sticky post. Most forum members use smart phones and tablets to view the forum most of the time, and can't open .ino files.
Code: [Select]
// RGB matrix Panel - Version: 1.1.0
#include <RGBmatrixPanel.h>
#include <gamma.h>

// USE THIS ON ARDUINO MEGA
#define OE   9
#define LAT 10
#define CLK 11
#define A   A0
#define B   A1
#define C   A2
#define D   A3

int colorRed, colorBlue, colorBlack, colorGreen, colorWhite;
int Matchnum,Racknum;
int BreakerMatchBalls,MatchInnings,MatchDeads,RackerMatchBalls;
int BreakerRackBalls,RackInnings,RackDeads,RackerRackBalls;
int MatchSplit1,MatchSplit2,pos,data;

RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 64);

const byte numChars = 64;
char receivedChars[numChars];
boolean newData = false;


void setup() {
  //virtual serial port bluetooth configuration
    Serial3.begin(9600);
    Serial3.println("<BT Arduino is ready>");

  matrix.begin(); {
  
  colorRed =   matrix.Color333(1, 0, 0);
  colorBlue =  matrix.Color333(0, 0, 3);
  colorGreen = matrix.Color333(0, 2, 0);
  colorBlack = matrix.Color333(0, 0, 0);
  colorWhite = matrix.Color333(2, 2, 2);

  // fill the screen with 'black'
  matrix.fillScreen(colorBlack);
  
  // layout the screen
  matrix.drawRect(0, 0, matrix.width(),matrix.height(), colorGreen); // green frame
  matrix.drawLine(1,  10, matrix.width()-2,10,colorRed); // red horiz line 1
  matrix.drawLine(1, 20, matrix.width()-8,20,colorRed); // red horiz line 2
  matrix.drawLine(14,1,14,9,colorRed);  // red vert 1 row 1
  matrix.drawLine(34,1,34,9,colorRed);  // red vert 2 row 2
  matrix.drawLine(14,11,14,19,colorRed); // red vert 1 row 2
  matrix.drawLine(28,11,28,19,colorRed); // red vert 2 row 2
  matrix.drawLine(42,11,42,19,colorRed); // red vert 3 row 2
  matrix.drawLine(56,11,56,19,colorRed); // red vert 4 row 2
  matrix.drawLine(14,21,14,30,colorRed); // red vert 1 row 3
  matrix.drawLine(28,21,28,30,colorRed); // red vert 2 row 3
  matrix.drawLine(42,21,42,30,colorRed); // red vert 3 row 3
  matrix.drawLine(56,21,56,30,colorRed); // red vert 4 row 3


  // fill in the constant text
  matrix.setTextSize(1);     // size 1 == 8 pixels high
  matrix.setTextWrap(false); // Don't wrap at end of line - will do ourselves

  matrix.setTextColor(colorBlue);  // Match label
  matrix.setCursor(2,2);
  matrix.print("M");
  matrix.setTextColor(colorGreen);  // Rack label
  matrix.setCursor(16,2);
  matrix.print("R");

  }  //matrix
 
}  //setup

void loop() {
    recvWithStartEndMarkers();
    showNewData();
}  //loop

void recvWithStartEndMarkers() {
    static boolean recvInProgress = false;
    static byte ndx = 0;
    char startMarker = '<';
    char endMarker = '>';
    char rc;
 
   if  (Serial3.available() > 0) {
     while (Serial3.available() > 0 && newData == false) {
        rc = Serial3.read();

       if (recvInProgress == true) {
         if (rc != endMarker) {
           receivedChars[ndx] = rc;
           ndx++;
            if (ndx >= numChars) {
              ndx = numChars - 1;
            }
          }
            else {
                receivedChars[ndx] = '\0'; // terminate the string
                recvInProgress = false;
                ndx = 0;
                newData = true;
            }
        }

        else if (rc == startMarker) {
            recvInProgress = true;
        }
      }
   }
}  //recvWithStartEndMarkers

void showNewData() {
    if (newData == true) {
        /*Serial3.print("Data ... ");
        Serial3.println(receivedChars);*/
        newData = false;
        ParseRcvdData();
    }
}   //showNewData

void ParseRcvdData(){
  int pos = atoi(&receivedChars[0]);
  int data = atoi(&receivedChars[3]);
  ConvertToScreenLoc(pos,data);  //rowx,posx,datay
}  //ParseRcvdData

void ConvertToScreenLoc(int pos,int data){
 switch(pos){
  
   case 11: Matchnum=data;break;
   case 12:Racknum=data;break;
   case 13:MatchSplit1=data;break;
   case 14:MatchSplit2=data;break;
    
   case 21:BreakerMatchBalls=data;break;
   case 22:MatchInnings=data;break;
   case 23:MatchDeads=data;break;
   case 24:RackerMatchBalls=data;break;

   case 31:BreakerRackBalls=data;break;
   case 32:RackInnings=data;break;
   case 33:RackDeads=data;break;
   case 34:RackerRackBalls=data;break;
 }
WriteToMatrix();
}  //ConvertToScreenLoc

void WriteToMatrix(){
  // setup for the variabes positioning
  // Match #
  matrix.fillRect(8,2,5,7,colorBlack);  //Clear previous data
  matrix.setTextColor(colorBlue);
  matrix.setCursor(8,2);
  matrix.print(Matchnum);
  
  //Racknum
  matrix.setTextColor(colorGreen);
  matrix.fillRect(22,2,11,7,colorBlack);
    if (Racknum > 9)
  {
    matrix.setCursor(22,2);
    matrix.print(Racknum);
  }
  else
  {
    matrix.setCursor(25,2);
    matrix.print(Racknum);  
  }
  
  // Night Split
  /* 3 pieces. matchsplit1 is our score
               a dash
               Matchsplit2 is Opp score */
  
  matrix.fillRect(36,2,27,7,colorBlack);
  matrix.setTextColor(colorWhite);
  matrix.drawLine(48,6,49,6,colorWhite); // dash btwn split
    if (MatchSplit1 > 9)
  {
    matrix.setCursor(36,2);
    matrix.print(MatchSplit1);
  }
  else
  {
    matrix.setCursor(42,2);
    matrix.print(MatchSplit1);
  }
  matrix.setCursor(51,2);
  matrix.print(MatchSplit2);

  //BreakerMatchBalls
  matrix.fillRect(2,12,11,7,colorBlack);
  matrix.setTextColor(colorBlue);
  if (BreakerMatchBalls > 9)
  {
    matrix.setCursor(2,12);
    matrix.print(BreakerMatchBalls);
  }
  else
  {
    matrix.setCursor(5,12);
    matrix.print(BreakerMatchBalls);  
  }
  
  //  MatchInnings  16,12
  matrix.fillRect(16,12,11,7,colorBlack);
  if (MatchInnings > 9)
  {
    matrix.setCursor(16,12);
    matrix.print(MatchInnings);
  }
  else
  {
    matrix.setCursor(19,12);
    matrix.print(MatchInnings);  
  }

 // MatchDeads  30,12
  matrix.fillRect(30,12,11,7,colorBlack);
  if (MatchDeads > 9)
  {
    matrix.setCursor(30,12);
    matrix.print(MatchDeads);
  }
  else
  {
    matrix.setCursor(33,12);
    matrix.print(MatchDeads);  
  }

  // RackerMatchBalls  44,12
  matrix.fillRect(44,12,11,7,colorBlack);
  if (RackerMatchBalls > 9)
  {
    matrix.setCursor(44,12);
    matrix.print(RackerMatchBalls);
  }
  else
  {
    matrix.setCursor(47,12);
    matrix.print(RackerMatchBalls);  
  }

// enter data for current rack
  matrix.fillRect(2,22,11,7,colorBlack);
  matrix.setTextColor(colorGreen);
  // Breaker Rack Balls  
  if (BreakerRackBalls > 9)
  {
    matrix.setCursor(2,22);    // Breaker Rack Balls
    matrix.print(BreakerRackBalls);
  }
  else
  {
    matrix.setCursor(5,22);    // Racker Rack Balls
    matrix.print(BreakerRackBalls);  
  }
  
  //RackInnings
  matrix.fillRect(16,22,11,7,colorBlack);
  if (RackInnings > 9)
  {
    matrix.setCursor(16,22);
    matrix.print(RackInnings);
  }
  else
  {
    matrix.setCursor(19,22);    // Racker Rack Balls
    matrix.print(RackInnings);  
  }
  
  //  RackDeads
  matrix.fillRect(30,22,11,7,colorBlack);
  if (RackDeads > 9)
  {
    matrix.setCursor(30,22);
    matrix.print(RackDeads);
  }
  else
  {
    matrix.setCursor(33,22);    // Racker Rack Balls
    matrix.print(RackDeads);  
  }    
    
  //RackerRackBalls
  matrix.fillRect(44,22,11,7,colorBlack);
  if (RackerRackBalls > 9)
  {
    matrix.setCursor(44,22);    // Racker Rack Balls
    matrix.print(RackerRackBalls);
  }
  else
  {
    matrix.setCursor(47,22);    // Racker Rack Balls
    matrix.print(RackerRackBalls);  
  }
  
}  //WriteToMatrix

PaulRB

#4
Nov 20, 2019, 09:25 pm Last Edit: Nov 20, 2019, 09:28 pm by PaulRB
If also helps to post links that can be clicked, like this, instead of just pasting web addresses (the forum software does not turn them into links automatically, but it's only one extra click).

For pictures, post them in-line too:



PaulRB

Quote
Am I using the wrong libraries...
I use the standard ABCDE
Yes, I think you may be using the wrong libraries. You seem to be using the AdaFruit RGB matrix library. All the AdaFruit matrixes have only ABCD as far as I can see, not ABCDE.

You posted the web address of an image from the DFrobot site. Can you post a link to their pages that describe how to use this display? What libraries do they suggest using?

ieee488

I think the OP is talking about an LED module.
Ah. One of those fancy ones.
One of these days I want to buy one to try.

crywolf49

My apologies for the ineffective posting. I am new to this site.
Yes for operating data, unit bought from eBay, seller is not manufactured and does not respond to emails via eBay.

Any help identifying my problem would be greatly appreciated.

PaulRB

I use the standard ABCDE wiring as shown on this site:
https://raw.githubusercontent.com/DFRobot/DFRobotMediaWikiImage/master/Image/DFR0499_Connection_Diagram.png
You posted the web address of an image from the DFrobot site. Can you post a link to their pages that describe how to use this display? What libraries do they suggest using?

crywolf49

This is the only link I can find for detailed information about the panel.
http://www.superchip.cn/Private/ProductFiles/636709864216932389822770434.pdf

PaulRB

#10
Nov 23, 2019, 06:39 pm Last Edit: Nov 23, 2019, 06:47 pm by PaulRB
Ok, I can see you are deliberately trying to annoy me by ignoring my requests and refusing to read and follow the forum guide. Life is too short. Good luck with your project.

Go Up