DMD Notes

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
User avatar
stryker
Posts: 253
Joined: Sat Jan 14, 2012 2:44 pm

Re: DMD Notes

Post by stryker » Fri Sep 16, 2016 3:59 am

Nice. Is that using DMD2?

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

Re: DMD Notes

Post by hipsi » Fri Sep 16, 2016 4:27 am

That's the original DMD Library. (Not the modified one for flipped panels).

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

Re: DMD Notes

Post by hipsi » Wed Oct 12, 2016 11:08 am

Geoff,

I've tried using your spreadsheet to create a 16px high font like Brissieboy's but it doesn't seem to work. Is there any reason I wouldn't be able to use your spreadsheet to do a 16px high font? Do I need to alter the value total size of the font? Here's the font code.

cheers,
Trav

Code: Select all

#include <inttypes.h>
#include <avr/pgmspace.h>

#ifndef MY16FONT_H
#define MY16FONT_H

#define MY16FONT_WIDTH 10
#define MY16FONT_HEIGHT 16

const static uint8_t My16font[] PROGMEM = { 						// the name here 'My32x15Font' must be used to refer to this font
    0x04, 0x90, 													// size     the total size of the font in bytes   = 1168 bytes
    0x0A, 															// width          not actually used in this case but is set to en width (width of 'n' character)
0x0C,																	//                but being non-zero indicates that it is a variable width font and
																	//                and the character width table is present.
    0x10, 															// height         max height of the characters = 32
    0x30, 															// first char     hex value of the first character (space)
    0x07, 															// char count     the number of characters in this font

    // char widths 

	0x0A, 0x0A, 0x0A, 0X0A, 0X0A, 0X0A, 0X0A,
	

    // font data
	//	col0................col1....................col2....................col4....................col5....................etc	
0xFC, 0xFE, 0x07, 0x03, 0x03, 0x03, 0x07, 0xFE, 0xFC, 0x00, 0x3F, 0x7F, 0xE0, 0xC0, 0xC0, 0xC0, 0xE0, 0x7F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 48 - "0"
0x08, 0x0C, 0x0E, 0xFF, 0xFF, 0xFF, 0x0E, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // 49 - "1"
0x06, 0x07, 0x03, 0x03, 0x03, 0x83, 0xC7, 0xFE, 0x7C, 0x00, 0xF0, 0xF8, 0xDC, 0xCE, 0xC7, 0xC3, 0xC1, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 50 - "2"
0x06, 0x07, 0x03, 0x83, 0x83, 0x83, 0xC7, 0xFF, 0x7E, 0x00, 0x60, 0xE0, 0xC0, 0xC1, 0xC1, 0xC1, 0xE3, 0xFF, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 51 - "3"
0xFF, 0xFF, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0x03, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 70 - "F"0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 76 - "L"
0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x3F, 0x7F, 0xE0, 0xC0, 0xC0, 0xC0, 0xE0, 0x7F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // 85 - "U"


    
};

#endif
stryker wrote: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.

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

Re: DMD Notes

Post by stryker » Wed Oct 12, 2016 1:45 pm

I think you'll get what you want if you change A49's formula to

Code: Select all

=CONCATENATE(A43,A44)
so it only uses the first 16 rows rather than the full 32.

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

Re: DMD Notes

Post by hipsi » Fri Oct 14, 2016 1:08 pm

Thanks mate, that did the trick

mohitsachan33
Posts: 4
Joined: Fri Oct 14, 2016 9:26 am

Re: DMD Notes

Post by mohitsachan33 » Sat Oct 15, 2016 5:21 am

hi
Can you tell me how to control this with the help of NodeMcu(ESP8266-12E).
I'm able to display the string but not for scrolling the string.
Plz help me.
thanks.

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

Re: DMD Notes

Post by stryker » Wed Oct 19, 2016 6:53 am

hipsi wrote: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?
Hi Trav,

I've hacked the spreadsheet to make a font up to 48 pixels tall with max 20 wide. There's only one sheet, but if you copy it to make your others, and then I found using 8 as a template to make your 0, 9, 6, 5, 2, b, d, E, B & D etc you'll find each character gets easier as the work progresses.

Normal caveats around no testing, no warranty, and you get what you pay for apply :D

Geoff
Attachments
MyEpicFont.ods
48 tall by up to 20 wide font spreadsheet
(16.74 KiB) Downloaded 121 times

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

Re: DMD Notes

Post by hipsi » Thu Oct 20, 2016 3:03 am

No only are you a gentleman and a scholar, I would go so far as to say you're a champ also! Thanks Geoff ;)

ir.vean
Posts: 3
Joined: Fri Dec 23, 2016 6:35 am

Re: DMD Notes

Post by ir.vean » Thu Feb 16, 2017 6:41 am

* Font size in bytes : 1663 :?: :?:
how to calculate the number of bytes of the font size?

shahzadsialvi
Posts: 2
Joined: Fri Jul 21, 2017 10:49 am

Re: DMD Notes

Post by shahzadsialvi » Fri Jul 21, 2017 11:01 am

stryker wrote:
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
Thank you very for your cooperation on the forum n I appreciate your work & dedication to help others.
With reference to your code and big font header file, I want to know how did you attach the two p10 modules? Series or parallel ? It will be really helpful if you plz upload the hardware description also.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests