Help with scrolling Text

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
42n8
Posts: 46
Joined: Wed Dec 26, 2012 8:10 pm
Location: Auckland, NZ

Re: Help with scrolling Text

Post by 42n8 » Mon Feb 25, 2013 12:48 am

kitbots wrote:Thanks for the reply.

The info. for the constant current regulator says it will regulate both current and voltage and I will be supplying it with 5v from a regulated power supply so how could the voltage ever go higher? Is the microprocessor really regulating the current when its powered through the USB or is it simply the regulators in the laptop that is limiting the current? If the latter then surely the constant current constant voltage device would do the same but simply at a higher level. I certainly do not see the brightness change as the amount of text goes up and down when powered through the USB.
Pete,
To answer your first question... When you are powering from USB, notice that:
  • there's no direct power connection between USB and DMD power rails
  • the lights go out when too many LEDs are lit at once
There's a common reason that these two things occur. The power being supplied to the DMD is sourced from the microprocessor ports. These are constant current sources and when the current drain trys to exceed the port limitation the port automatically shuts down to prevent damage to the port.

Your second answer is:
The laptop regulators will quite happily supply much more current than the USB port will source, which is limited to 0.5Amps. So if any device develops a short circuit, the USB driver chip will sense the overcurrent and rapidly disconnect the USB line from the device, again it's an inbuilt protection method.

Yes, I agree that you don't see a brightness change so let's look at the science by analysing the circuit in depth.

Signal R selects pin 12 of every 595 in the system, which is the stop pin so it has nothing to do with the data control system. It controls the entire board state, either ON or OFF and overrides the nOE pin so it's just used for blanking.

The data could be such that all 512 LEDs appear to be on at once, but is this really so?
Signals A and B select one of the four quadrants to be addressed, a maximum of 128 LEDS. The two lines are decoded by the 138, which is set up as a 2 - 4 line decoder. These outputs each feed two 4952 row driver chips, which further restrict the output to two rows so that only 32 LEDS can be addressed at any one time.

Signal nOE is also connected to every 595 on pin 13. It is an 8 bit wide tristate latch and current sink, which latches the data on the 595 and sinks the "LED Data Bus" for want of a better description.

This "LED data bus" is a matrix of 32 LEDS powered by the 4952 row driver chips and because they are latches the outputs are ON or OFF until instructed otherwise. Each of the 595s 8 outputs drives 4 LEDS but only one will light because each of the 4 LEDs is powered by a different row. Moreover, only one of the two possible rows are selected which means that it is possible to address a single LED, which we all know is true.

Does this mean that only one LED per board is switched on at any one time? No, if it were so then the USB port could deliver enough current to power 25 LEDs at full brightness, provided that no other USB device was connected.

It is latching that's important, not addressing. Each latch can sink up to 8 pixels concurrently and since there are 4 latches per quadrant then 32 pixels per quadrant are possible and there being 4 quadrants there are a maximum of 128 pixels that can be lit at any one time, per board.

If each LED is at full brightness and the max current that a single LED can handle comfortably is 20ma then the max current setting will be 128 pixels x 20ma = 2.56 Amps per board.

In summary, there are several important points to take away.
  • That it requires a serious amount of energy to drive large arrays
  • That each of the LEDs has a constant current sink and thats why you don't see a brightness change.
  • That the existing current sink is not variable and therefore not useful as a control unless we could somehow control the length of time that the 595s were latched in the ON state
Finally:
Preregulating a current source defeats the purpose and it has never worked, in my experience. The idea is to allow the voltage to float so that a low current drain on the supply lets the voltage rise such that at virtually 0 Amps the voltage reaches peak and it sags as current rises.

You can, however, post regulate the voltage by using avalanche techniques so that the voltage that the device sees is never greater than its capacity to handle it. As you can imagine, making such a current source, while possible is not an easy task and one that few would tackle, especially when there are easier methods of getting the job done.

This might be an answer to a maiden's prayer for many people...
I was having a discussion with Stryker last night about controlling brightness on the nOE port. It appears that there may be a positive outcome from his work, within the next few days.

See this thread viewtopic.php?f=26&t=3435

Regards

astech
Posts: 3
Joined: Sun Dec 09, 2012 11:29 am

Re: Help with scrolling Text

Post by astech » Thu Feb 28, 2013 10:56 am

Hi,
re speed of scrolling.
Find the following section of code and reduce the value 30 to speed up scrolling.

while(!ret){
if ((timer+30) < millis()) {
ret=dmd.stepMarquee(-1,0);
timer=millis();
}

kitbots
Posts: 11
Joined: Tue Oct 30, 2012 2:39 am

Re: Help with scrolling Text

Post by kitbots » Fri Mar 01, 2013 12:34 am

Thanks, I'll give that a try :D


astech wrote:Hi,
re speed of scrolling.
Find the following section of code and reduce the value 30 to speed up scrolling.

while(!ret){
if ((timer+30) < millis()) {
ret=dmd.stepMarquee(-1,0);
timer=millis();
}

ftboy
Posts: 1
Joined: Sun Mar 03, 2013 1:23 am

Re: Help with scrolling Text

Post by ftboy » Sun Mar 03, 2013 1:28 am

I have been pulling my hair out since 4am trying to get the example sketch running on 1.0.3 and reverting to 1.0.2 as I knew this sketch was running last time I played with it.

error: no matching function for call to 'DMD::drawMarquee(char [29], int&, int, int)

Is the first place it bombs and cant think my way out of it.

Any pointers would be appreciated

roman
Posts: 3
Joined: Tue Feb 06, 2018 4:39 am

Re: Help with scrolling Text

Post by roman » Tue Feb 06, 2018 6:25 am

using this the message is scrolling from right to left...
is there any way to scroll the message from right to the center of the screen.

i have used the below code but i need some other technique.

Code: Select all

dmd.selectFont(FONT2);
     const char *next = MESSAGE;
     while(*next) {
     Serial.print(*next);
     box1.print(*next);
     delay(500);
     next++;
     }
plz help

User avatar
stryker
Posts: 268
Joined: Sat Jan 14, 2012 2:44 pm

Re: Help with scrolling Text

Post by stryker » Tue Feb 06, 2018 6:44 am

Hi Roman

You've not told us how many DMDs you are using in your display nor the size of your font, but you could get an approximation of the message ending in the middle by moving the left side and width of "box1" in the declaration. eg let's pretend it's just one, it might look something like

Code: Select all

SoftDMD dmd(1,1);
DMD_TextBox box1(dmd, 7, 0, 24, 16);
Adjust to suit your particular situation, and length of message of course...

Cheers ! Geoff

roman
Posts: 3
Joined: Tue Feb 06, 2018 4:39 am

Re: Help with scrolling Text

Post by roman » Tue Feb 06, 2018 6:47 am

thanks for reply
i have used this technique.
see the detail code.

Code: Select all

/*
  Scrolling alphabet demo, displays characters one at a time into a scrolling box.
 */

#include <SPI.h>
#include <DMD2.h>
#include <fonts/SystemFont5x7.h>
#include <fonts/Arial14.h>
#include <fonts/Droid_Sans_24.h>
#include <fonts/Droid_Sans_16.h>
// Set Width to the number of displays wide you have
const int WIDTH = 1;
const int COUNTDOWN_FROM = 0;
int counter = COUNTDOWN_FROM;
// You can change to a smaller font (two lines) by commenting this line,
// and uncommenting the line after it:
const uint8_t *FONT = SystemFont5x7;
const uint8_t *FONT2 = SystemFont5x7;

const char *MESSAGE = "GOA";

SoftDMD dmd(WIDTH,1);  // DMD controls the entire display
DMD_TextBox box(dmd, 0, 1);
DMD_TextBox box1(dmd,11,1);  // "box" provides a text box to automatically write to/scroll the display

// the setup routine runs once when you press reset:
void setup() {
  Serial.begin(9600);
  dmd.setBrightness(255);
  //dmd.selectFont(FONT);
  dmd.begin();  
}

// the loop routine runs over and over again forever:
void loop() {
  dmd.selectFont(FONT);
  box.print(counter);
  dmd.selectFont(FONT2);
  const char *next = MESSAGE;
 while(*next) {
  Serial.print(*next);
  box1.print(*next);
  delay(500);
  next++;
  }
    box.println(F(""));
    counter++;
    if(counter == 60) {
    dmd.clearScreen();
    counter = 0;
  }
 
  
  
}

gvaldes
Posts: 1
Joined: Thu Mar 15, 2018 5:47 pm

Re: Help with scrolling Text

Post by gvaldes » Thu Mar 15, 2018 8:47 pm

joevpt wrote:
Wed Oct 31, 2012 9:07 pm
Here you go Pete...

Code: Select all

/*--------------------------------------------------------------------------------------

 dmd_pete.cpp 
--------------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------------
  Includes
--------------------------------------------------------------------------------------*/
#include <SPI.h>        //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include <DMD.h>        //
#include <TimerOne.h>   //Needed for the panel refresh which is done every 5ms.
#include "SystemFont5x7.h"  // Including both fonts.  If you don't need it, comment one out.
#include "Arial_black_16.h"

//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1   // Just 1 panel x 1 panel
#define DISPLAYS_DOWN 1
#define FLASHES 4           // For the flashing text, number of flashes.

DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

/*--------------------------------------------------------------------------------------
  Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
  called at the period set in Timer1.initialize();
--------------------------------------------------------------------------------------*/
void ScanDMD()
{ 
  dmd.scanDisplayBySPI();
}

/*--------------------------------------------------------------------------------------
  setup
  Called by the Arduino architecture before the main loop begins
--------------------------------------------------------------------------------------*/
void setup(void)
{

   //initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
   Timer1.initialize( 5000 );           //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
   Timer1.attachInterrupt( ScanDMD );   //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()

   //clear/init the DMD pixels held in RAM
   dmd.clearScreen( true );   //true is normal (all pixels off), false is negative (all pixels on)

}

/*--------------------------------------------------------------------------------------
  loop
  Arduino architecture main loop
--------------------------------------------------------------------------------------*/
void loop(void)
{
   byte b;

   // Clear the panel(s)
   dmd.clearScreen( true );

   // THE FIRST MESSAGE - SCROLLING
   // Select the font. Both fonts included here.  Just comment out one of them
   //dmd.selectFont(System5x7);
   dmd.selectFont(Arial_Black_16);
   char msgOne[] = "Scrolling Text for message 1";
   int msgOneLength = 28;
   dmd.drawMarquee(msgOne,msgOneLength,(32*DISPLAYS_ACROSS)-1,0);
   long start=millis();
   long timer=start;
   boolean ret=false;
   while(!ret){
     if ((timer+30) < millis()) {
       ret=dmd.stepMarquee(-1,0);
       timer=millis();
     }
   }


   // THE SECOND MESSAGE NON SCROLLING - FLASHING
   // Select the font. Both fonts included here.  Just comment out one of them
   dmd.selectFont(System5x7);
   //dmd.selectFont(Arial_Black_16);
   char msgTwo[] = "Eight";
   int msgTwoLength = 5;
   int noOfFlashes = 3;
   for (int i=0;i<noOfFlashes;i++)
   {
     // Display the message (flash it on)  (1,5 = top corner of text )
     dmd.drawString(  1,  5, msgTwo, msgTwoLength, GRAPHICS_NORMAL );
     delay(500);  // wait 0.5 seconds
     // Blank the message ( flash it off)
     dmd.drawString(  1,  5, msgTwo, msgTwoLength, GRAPHICS_NOR );
     delay(500);  // wait 0.5 seconds
   }
   dmd.clearScreen( true );

   // THE THIRD MESSAGE -  SCROLLING
   // Select the font. Both fonts included here.  Just comment out one of them
   //dmd.selectFont(System5x7);
   dmd.selectFont(Arial_Black_16);
   char msgThree[] = "Scrolling Text for message 3";
   int msgThreeLength = 28;
   dmd.drawMarquee(msgThree,msgThreeLength,(32*DISPLAYS_ACROSS)-1,0);
   start=millis();
   timer=start;
   ret=false;
   while(!ret){
     if ((timer+30) < millis()) {
       ret=dmd.stepMarquee(-1,0);
       timer=millis();
     }
   }
   
   // A delay of 1 sec before we start again
   delay(1000);
   
}


Hello all,
I am very new to this type of project.
Is there a way to modify the above code so that the letters are the lit LEDs and the background is fully dark?
Currently, the scrolling action makes the LEDs go dark. Apologies if this is on another thread elsewhere.

Additionally, and also apologies if I am missing from another thread, is there a way to use the above code but make it scroll for vertical displays? Meaning, for example, 3 DMD vertically so 16x96?

Happy to ask this over a DM, just been struggling searching the forum.

Thanks,
Goose

gebbypradana
Posts: 1
Joined: Wed Apr 18, 2018 8:50 am

Re: Help with scrolling Text

Post by gebbypradana » Wed Apr 18, 2018 9:03 am

cen someone help me to display 500 character in dmd panel ?

i'm using arduino mega 2560, all reading has done to eeprom with 500 character, but the display can not display it (based on my experience 125 character are works fine) but if the characters > 125 the arduino going to freeze..

Please help me ..
Thank you

Brissieboy
Posts: 127
Joined: Fri Sep 20, 2013 7:25 am

Re: Help with scrolling Text

Post by Brissieboy » Sat Apr 21, 2018 3:19 am

gebbypradana,
I know the DMD library is limited by use of a byte variable for the displayed string length so it will not be able to handle your long text without modification. It is not unsigned so the limit will probably be 127.
I am not sure about the DMD2 library as I have not delved very deeply into the internals of that one.
Have you considered breaking your string up into more realistic sizes and display them one after the other.

Post Reply