DMD Notes

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Brissieboy
Posts: 93
Joined: Fri Sep 20, 2013 7:25 am

DMD Notes

Post by Brissieboy » Sat Jan 18, 2014 7:02 am

I made some notes while I was playing with the DMD and thought they might also be of some value to others, so I tidied it up a little. I hope it is OK. Corrections, comments, additions welcome.

UPDATE:
Corrected the information in the attached file on screen RAM index calculation by adding info for multi-dimensional DMD arrays.
Attachments
DMD Notes.txt
(13.31 KiB) Downloaded 1748 times
Last edited by Brissieboy on Mon Jan 26, 2015 3:23 am, edited 1 time in total.

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

Re: DMD Notes

Post by stryker » Sat Jan 18, 2014 11:08 am

Nice work. I especially read with interest your note about the OE line not having an explicit start state. I often wonder why these DMDs fire up with random lit LEDs on them and there's the simple explanation right there. I might hack our present controller board to provide that pull-down resistor - and will remember that for any future revisions.

Any chance you're keen on documenting how the fonts work? I've had a tilt at making some custom typefaces (2 DMDs tall, and a full 16px high type without vertical spacing) but have so far avoided revisiting it with equal parts procrastination, and getting distracted.
:?

Cheers !
Geoff

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

Re: DMD Notes

Post by Brissieboy » Sun Jan 19, 2014 1:06 am

stryker,
You need to be a little careful here with a 16 pixel high font. If you want to have the descenders (as used on lower case g, j, p, q, y) you need to have a couple of pixels available below the bottom line of the other 'normal' characters. That effectively reduces the font size. Of course you could define the characters so that they did not have descenders but they don't look as nice.
I have made my own 16 pixel font that uses ALL the available height of the DMD, but I did not need lower case in this font. I only defined the characters from space (0x32) to underscore (0x5F). This was to get the largest display possible for my primary display which only needed a very limited number of characters on-screen at a time - when I need to do other things I change fonts.
As I worked out how it all goes together, I added some details in comments to the font file which may be helpful and I have attached a copy here. I used a very crude excel spreadsheet to do the translation from visual display to data to minimise errors in this part of the process.
Attachments
MyBigFont.h
(14.02 KiB) Downloaded 1600 times

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

Re: DMD Notes

Post by stryker » Sun Jan 19, 2014 5:38 am

Thanks for sharing this. For my purpose I only need a handful of upper case alphas and 0 through 9 so expect this will be perfect. Thanx! Geoff

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

Re: DMD Notes

Post by stryker » Thu Feb 13, 2014 10:29 am

Hi,

Small update after the real world got in the way of this project - it does look great. Thanks for the annotations in that file too.

Cheers ! Geoff

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

Re: DMD Notes

Post by Brissieboy » Mon Jan 26, 2015 3:26 am

Updated the DMD notes attachment in the original post to show correct calculation of screen RAM index for multi-dimensional DMD arrays. Original was only true for 1 DMD high.

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

Re: DMD Notes

Post by stryker » Fri Jan 29, 2016 1:11 pm

Hi,

A year after your post here I've finally got around to making a 2 DMD tall font. Currently our project draws the limited characters we need using rectangles and dots, but this should give a better outcome. Thanks again for the annotated example from which to learn Brissyboy.

My32x15Font is proportionally spaced with characters a max 15 wide. This should allow 4 characters across a 2x2 DMD array for a scoreboard. I tried starting with an imported Windows font, but I found as you did that this wasn't worth the trouble and ended up creating the characters in a spreadsheet which I've also attached here, in case anyone finds it useful. There is so little documentation on how fonts work I thought it best to add it here so we have it all in the one place.

The spreadsheet has a worksheet for each character, put a 1 where you want a lit LED or a 0 where you don't in the 32x20 matrix at the top, fill in the width in the blue box below that, and it will provide you the hex value for the width, and the required font data at the bottom which you can just copy and paste into the font header file. Follow the instructions already present in MyBigFont.h and the rest is pretty straightforward.

I also hacked one of the DMD demos to run through the typeface. For some reason the forum doesn't allow upload of files with .ino suffix, so will put that here...

Code: Select all

#include <SPI.h>        //
#include <DMD.h>        //
#include <TimerOne.h>   //
#include "My32x15Font.h"
#include "Arial_black_16.h"

//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 2
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

void ScanDMD() {
  dmd.scanDisplayBySPI();
}

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)
}

void loop(void) {
  dmd.clearScreen(true);
  dmd.selectFont(Arial_Black_16);
  dmd.drawMarquee("My32x15 font test", 17, 31, 0);
  long start = millis();
  long timer = start;
  boolean ret = false;
  while (!ret) {
    if ((timer + 30) < millis()) {
      ret = dmd.stepMarquee(-1, 0);
      timer = millis();
    }
  }

  for (byte b = 32; b < 96; b++) {
    dmd.clearScreen(true);
    dmd.selectFont(Arial_Black_16);
    dmd.drawChar(20, 0, char(b), GRAPHICS_NORMAL );
    dmd.selectFont(My32x15Font);
    dmd.drawChar(0, 0, char(b), GRAPHICS_NORMAL );
    delay(500);
  }
  delay(500);
  dmd.clearScreen(true);
  
  dmd.drawMarquee("! \"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", 64, (32 * DISPLAYS_ACROSS) - 1, 0);
  start = millis();
  timer = start;
  ret = false;
  while (!ret) {
    if ((timer + 30) < millis()) {
      ret = dmd.stepMarquee(-1, 0);
      timer = millis();
    }
  }
}
And while these DMDs are too bright for a cameraphone to do them justice here's a video from that sketch above (link to youtube), showing the attached version of the font.

Cheers!
Geoff
Attachments
MyGiantFont.ods
(313.2 KiB) Downloaded 591 times
My32x15Font.h
(26.49 KiB) Downloaded 681 times

hipsi
Posts: 10
Joined: Mon Aug 08, 2016 3:24 am

Re: DMD Notes

Post by hipsi » Thu Sep 15, 2016 6:52 am

I'm putting together a 3x3 sign at the moment and will need to display numbers from 0 - 999. Thus I'm looking to create a number font that is 48px high and obviously no wider than 32px (a bit less to allow for gap between). How hard is it to modify this spreadsheet to allow for this?

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

Re: DMD Notes

Post by stryker » Thu Sep 15, 2016 9:55 pm

Modifying the spreadsheet is easy enough but I've not been able to drive 9x DMD display modules with a single Arduino.

hipsi
Posts: 10
Joined: Mon Aug 08, 2016 3:24 am

Re: DMD Notes

Post by hipsi » Fri Sep 16, 2016 12:56 am

I havent done anything special. Here it is https://youtu.be/pi1ce9BEBHA

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest