Arduino Text Scrolling Display | MAX7219 Dot Matrix 4-in-1| xcluma MAX7219 Microcontroller 4 In 1 Display with 5P Line Dot Matrix Module

Arduino Text Scrolling Display | MAX7219 Dot Matrix 4-in-1
xcluma MAX7219 Microcontroller 4 In 1 Display with 5P Line Dot Matrix Module 



In this video i will show you how to make scrolling text display on max7219 based dot matrix module, circuit is quite simple and easy, purchase links are given below, you can buy it from any where. scrolling speed can be controlled by a variable resistor and the text can be changed during run time using serial monitor.


common issues like mirror image, inverted image, vertical display errors are resolved in this video, watch it till the end.

Connections

CLK_PIN     to Arduinos pin no.  13  // or SCK
DATA_PIN  to Arduinos pin no. 11  // or MOSI
CS_PIN        to Arduinos pin no.10  // or SS



#include <MD_MAX72xx.h>
#include <SPI.h>

#define USE_POT_CONTROL 1
#define PRINT_CALLBACK  0

#define PRINT(s, v) { Serial.print(F(s)); Serial.print(v); }

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 11

#define CLK_PIN   13  // or SCK
#define DATA_PIN  11  // or MOSI
#define CS_PIN    10  // or SS

// SPI hardware interface
MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Arbitrary pins
//MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

// Scrolling parameters
#if USE_POT_CONTROL
#define SPEED_IN  A5
#else
#define SCROLL_DELAY  75  // in milliseconds
#endif // USE_POT_CONTROL

#define CHAR_SPACING  1 // pixels between characters

// Global message buffers shared by Serial and Scrolling functions
#define BUF_SIZE  75
char curMessage[BUF_SIZE];
char newMessage[BUF_SIZE];
bool newMessageAvailable = false;

uint16_t  scrollDelay;  // in milliseconds

void readSerial(void)
{
  static uint8_t  putIndex = 0;

  while (Serial.available())
  {
    newMessage[putIndex] = (char)Serial.read();
    if ((newMessage[putIndex] == '\n') || (putIndex >= BUF_SIZE-3)) // end of message character or full buffer
    {
      // put in a message separator and end the string
      newMessage[putIndex++] = ' ';
      newMessage[putIndex] = '\0';
      // restart the index for next filling spree and flag we have a message waiting
      putIndex = 0;
      newMessageAvailable = true;
    }
    else if (newMessage[putIndex] != '\r')
      // Just save the next char in next location
      putIndex++;
  }
}

void scrollDataSink(uint8_t dev, MD_MAX72XX::transformType_t t, uint8_t col)
// Callback function for data that is being scrolled off the display
{
#if PRINT_CALLBACK
  Serial.print("\n cb ");
  Serial.print(dev);
  Serial.print(' ');
  Serial.print(t);
  Serial.print(' ');
  Serial.println(col);
#endif
}

uint8_t scrollDataSource(uint8_t dev, MD_MAX72XX::transformType_t t)
// Callback function for data that is required for scrolling into the display
{
  static char   *p = curMessage;
  static uint8_t  state = 0;
  static uint8_t  curLen, showLen;
  static uint8_t  cBuf[8];
  uint8_t colData;

  // finite state machine to control what we do on the callback
  switch(state)
  {
    case 0: // Load the next character from the font table
      showLen = mx.getChar(*p++, sizeof(cBuf)/sizeof(cBuf[0]), cBuf);
      curLen = 0;
      state++;

      // if we reached end of message, reset the message pointer
      if (*p == '\0')
      {
        p = curMessage;     // reset the pointer to start of message
        if (newMessageAvailable)  // there is a new message waiting
        {
          strcpy(curMessage, newMessage); // copy it in
          newMessageAvailable = false;
        }
      }
      // !! deliberately fall through to next state to start displaying

    case 1: // display the next part of the character
      colData = cBuf[curLen++];
      if (curLen == showLen)
      {
        showLen = CHAR_SPACING;
        curLen = 0;
        state = 2;
      }
      break;

    case 2: // display inter-character spacing (blank column)
      colData = 0;
      curLen++;
      if (curLen == showLen)
        state = 0;
      break;

    default:
      state = 0;
  }

  return(colData);
}

 void scrollText(void)
{
  static uint32_t prevTime = 0;

  // Is it time to scroll the text?
  if (millis()-prevTime >= scrollDelay)
  {
    mx.transform(MD_MAX72XX::TSL);  // scroll along - the callback will load all the data
    prevTime = millis();      // starting point for next time
  }
}

uint16_t getScrollDelay(void)
{
#if USE_POT_CONTROL
  uint16_t  t;

  t = analogRead(SPEED_IN);
  t = map(t, 0, 1023, 25, 250);

  return(t);
#else
  return(SCROLL_DELAY);
#endif
}

void setup()
{
  mx.begin();
  mx.setShiftDataInCallback(scrollDataSource);
  mx.setShiftDataOutCallback(scrollDataSink);

#if USE_POT_CONTROL
  pinMode(SPEED_IN, INPUT);
#else
  scrollDelay = SCROLL_DELAY;
#endif

  strcpy(curMessage, " Manmohan Pal MOB. 8989811397");
  newMessage[0] = '\0';

  Serial.begin(9600);
  Serial.print("\n[MD_MAX72XX Message Display]\nType a message for the scrolling display\nEnd message line with a newline");
}

void loop()
{
  scrollDelay = getScrollDelay();
  readSerial();
  scrollText();
}



Circuit Diagram:  https://drive.google.com/file/u/0/d/1MBlD0g761nh0qBIblS5iQhujkn4JmdKh/view?usp=sharing
Code Link: https:  https://drive.google.com/file/d/1cSFbR9GnkoM6rGhi4OZ0DDECTyhh_Emj/view?usp=sharing
Blog Page:https: https://arduinobymanmohan.blogspot.com/p/large-led-matrix-board.html


Manmohan Pal
WhatsApp 8989811397
Email- mannmohanpal@gmail.com
Blog: http://electronics4ubymanmohanpal.blogspot.in/p/blog-page_5.html
Youtube Channel: https://www.youtube.com/channel/UCDnhARnHOEIPuNIEp5vPdGQ



video lists.


How To Make 8X8 Led Matrix DIY by Manmohan Pal
https://www.youtube.com/watch?v=AtG29h2SLpA&t=530s


How to display Scrolling Text on 8*8 LED Dot Matrix by Manmohan Pal
https://www.youtube.com/watch?v=cO_O4s2Swus&t=300s


HOW TO MAKE SCROLLING TEXT LED DISPLAY || 64X8 LED MATRIX BY MANMOHAN PAL
https://www.youtube.com/watch?v=-nSiwW6jl6U

Bluetooth Car using Arduino + HC05 +Android APP by Manmohan Pal
https://www.youtube.com/watch?v=1T0QCpnQrOo&t=186s


RF Remote Control Robo Car using 433Mhz RF Module by Manmohan Pal
https://www.youtube.com/watch?v=safPeO38_2A


How To Identify 8*8 Led Matrix Pins by Manmohan Pal
https://www.youtube.com/watch?v=ZXF62U0ziJ8


RF Remote Control Car Using 433 Mhz RF transmitter and Receiver Kit by Manmohan Pal
https://www.youtube.com/watch?v=rcaQluS7Gzw


RF Remote Control Circuit Using 433 Mhz Module and HT12E Encoder and HT12D Decoder IC by Manmohan
https://www.youtube.com/watch?v=51TNQiaXm3U


IC L293 Moter Driver H Bridge IC by Manmohan Pal
https://www.youtube.com/watch?v=1Gh-aVm5rDg


RF Remote Control Circuit Using 433 Mhz Module and HT12E Encoder and HT12D Decoder IC by Manmohan
https://www.youtube.com/watch?v=51TNQiaXm3U


Wireless 4 Channel 433 Mhz RF Remote Control Transmitter and Receiver Unboxing by Manmohan Pal
https://www.youtube.com/watch?v=ZFjDGuFBMnI


433 Mhz RF Module Tx and Rx with Arduino Nano, RF Remote Control Circuit by Manmohan Pal
https://www.youtube.com/watch?v=JHN7kgguCG8


Wireless 4 Channel 433 Mhz RF Remote Control Transmitter and Receiver Unboxing by Manmohan Pal
https://www.youtube.com/watch?v=ZFjDGuFBMnI


RF 4 Channel Remote Control Relay Module using 433 Mhz RF Transmitter and Reciever bu Manmohan Pal
https://www.youtube.com/watch?v=1bgBXruwxfE&t=58s
https://www.youtube.com/watch?v=C1qGVaGgGOo


Touch Switch using NAND gate IC 4011 by Manmohan Pal
https://www.youtube.com/watch?v=jIEKWVs8d40


Touch Switch || Toggle aswitch || Touch ON Touch Off Switch using IC 4017
https://www.youtube.com/watch?v=9iA0AtnrL7A


433 Mhz RF Module Tx and Rx with Arduino Nano, RF Remote Control Circuit by Manmohan Pal
https://www.youtube.com/watch?v=JHN7kgguCG8&t=607s


Remote Control Relay Module 4 Channel 5 volt by Manmohan Pal
https://www.youtube.com/watch?v=67_CzDsuyfw


Remote control for every home appliance
https://www.youtube.com/watch?v=mUuSYWyD7Ic


Remote operated light- by Manmohan Pal
https://www.youtube.com/watch?v=5oP1SCkVJm8


Remote control Fan- IR remote control Circuit using IC 555 Timer by Manmohan Pal
https://www.youtube.com/watch?v=GvAZadfdIAE


Arduino Nano Unboxing| Uploading First Program on Arduino Nano- By Manmohan Pal
https://www.youtube.com/watch?v=OxQcPwc8Wl0



No comments:

Post a Comment

Wifi Home automation Diy kit

 Wifi Home automation Diy kit By Manmohan Pal Wifi Home Automation Kit Hi, This is Manmohan Pal, I am glad to present a DIY kit for Home Aut...