Page 1 of 1

Need help with a project

Posted: Sat Jul 14, 2012 9:37 pm
by stripesace
I've stumbled across freetronics, and it looks like it's going to satisfy an itch I have had for sometime, though as I'm learning about the products they have to offer. I understand enough about the software side of things that I think I can stumble my way through my project.

I'm wanting to create a 3 digit number sign. I'm going to the DMD and turn it on it's side and connect 3 of them together to make numbers 000-999, really quickly.

If someone would be willing to help consult me on parts/supplies, etc. it would be appreciated and I'd like to contribute to your hobbies' spending fund as a little way of saying thank you, though this community seems to pretty willing to help one another.

Re: Need help with a project

Posted: Sun Jul 15, 2012 2:27 am
by Aussie_Wombat
Hello Stripesace,

Parts list:
3 DMD's of course
1 Freetronics eleven (no network ) or etherten (network) or arduino clone
1 wall powerpack 5V 4A for the 3 dmd's. join all 3 to powerpack
1 wall powerpack 9V 1A for the arduino clone (unless powered by usb from computer)
an enclosure to mount it all in....
Software for the purpose of writing and/or changing the numbers on the dmd display.

I suggest using the line function from the dmd library to draw the lines for the numbers in the same format as an seven segment display, this way you can, as you have stated , lay the panels on their side to make a display 48 x 32.

Cheers Dennis

Re: Need help with a project

Posted: Sun Jul 15, 2012 9:11 pm
by stripesace

Thanks a bunch sir! I was looking to make this completely self-contained with no computer to drive it. This is where I started getting confused. Basically would want to take a telephone keypad and make the * key a "Show number" key and # key a "clear number and show nothing" key.

That way if I wanted, say, 123 up and then take it down for a bit and then show 23. i'd go 123*, # (to clear) and then the next time I hit 23* on the 23 would show on the display. I thought the LCD & KP shield had inputs for other button presses? I need to be able to punch these numbers up quickly, even if it was cycling Blank,0,1,2,3,4,5,6,7,8,9 for each digit and then hitting enter to show the number and enter again to turn it off.

Re: Need help with a project

Posted: Mon Jul 16, 2012 12:33 am
by Aussie_Wombat
I quickly wrote some code, to display the numbers on their side, by using the dmd.drawFilledBox() function. I found it drew ok to 2 panels, but when I set it to 3 panels it drew the numbers very slowly. 1 pixel per second. I haven't had a chance to investigate further, but maybe jon could answer that question? I will have to check out the dmd library code..


dmd_displayswide 1
dmd_displaysdown 3

Re: Need help with a project

Posted: Mon Jul 16, 2012 7:01 am
by Aussie_Wombat

Here is the code I made for the testing. It just cycles the number every second. I am sure you could modify it to suit your needs.
It does not matter whether you have the displays 3 wide x 1 down or 1 wide x 3 down. The code just seems to slow down.. to every 1/2 second , it draws 1 pixel. If I change it from drawFilledBox to drawLine, it does the same....
In the video note the last digit, the vertical bar is still being drawn, 1 pixel at a time..

If I set it to 2 wide x 1 down or 1 wide x 2 down then everything works ok....

My code does both, so change the DISPLAYS_WIDE and DISPLAYS_DOWN numbers yourself and try it..

My code Follows...

Code: Select all

#include <SPI.h>        //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include <DMD.h>        //
#include <TimerOne.h>   //

//Fire up the DMD library as dmd

  int startnumber = 0;
  int xmode= 0;
  int ymode =0;
   int segment[][4]={
  int numseg[][7]={


  Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
  called at the period set in Timer1.initialize();
void ScanDMD()

  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( 2500 );           //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)
   xmode = 32;
   ymode = 0;

  Arduino architecture main loop
void loop(void)
  startnumber+= 1;     //startnumber +1
  if (startnumber >999){

void displaynumber(int number)
 int digit3= number/100;
 int digit2= (number/10)-digit3*10;
 int digit1= number % 10;
       Serial.print(" , ");
      Serial.print(" , ");
       Serial.println(" ");
    for (int x=0; x <7 ; x++){
//     if (numseg[digit3][x]==1){
//     dmd.drawFilledBox(segment[x][0],segment[x][1],segment[x][2],segment[x][3],0);
//     }
// when adding in this code, change digit2's code to add xmode, and ymode. and change digit1's to 2*xmode and 2*ymode
     if (numseg[digit2][x]==1){
     if (numseg[digit1][x]==1){
As you can see I commented out digit3 for testing on 2 panels. Just follow the comment when adding digit3 (100's).

Cheers Dennis

I also have some code, I wrote to run on a maximite, firmware V3.2C which mirrors the vga to the dmd displays. The maximite IS a monochrome computer, 150 mm x 80 mm. It has sd card, usb, vga and ps2 keyboard. It uses MMBasic and uses the pic32 as it's chip of choice... with 128k ram. Tested 3 DMD's , and all works ok, video to follow.
Maximite , soon to be 8 colour.....
2 video's in divx format ... arquee.avi ... nvader.avi

Re: Need help with a project

Posted: Mon Jul 16, 2012 11:58 am
by Aussie_Wombat

That code I mentioned for the Maximite..

I added in the functionality you said about...
here is a short 6 mb video.. ... ite3x8.avi

and a picture of the maximite.
My Maximite
The MMBasic program was 6 Kb....most of that is the code for using the dmd panels..

Code: Select all

' A test program for a Freetronics DMD Panel that mirrors the vga memory to the dmd.
' This example code, uses 3 DMD panels. It utilizes the Line command to draw box's, similar
' to a seven segment display. It displays 3 digits. If the hundreds and tens digit equals zero
' then neither digit is displayed, only the units. 
' This test program must be used with the Maximite_3.2C_includes_spiDMD.hex file
' available to download from
' This program utilizes two commands added to Geoff Graham's MMBasic V3.2c code,
' added by Dennis Wyatt, SpiDMD() and MM.Video.

' code required for dmd panel usage

' These are the pins I used for the dmd panel

      DMD_A = 16         ' D6 on supplied DMDcon(nector)
      DMD_B = 15         ' D7 on supplied DMDcon(nector)
      DMD_OE = 14        ' D9 on supplied DMDcon(nector)
      DMD_CLK = 20       ' D13 on supplied DMDcon(nector)
      DMD_SCLK = 17      ' D8 on supplied DMDcon(nector)
      DMD_R_Data = 19     ' D11 on supplied DMDcon(nector)
      DMD_T_Data = 18     ' D12 on supplied DMDcon(nector)[not actually required]

' attach maximite ground to pin GND on DMDCon(nector)

' set pins for output and input
             Pin(DMD_A) = 0
              SetPin DMD_A , 8
             Pin(DMD_B) = 0
              SetPin DMD_B , 8
             Pin(DMD_OE) = 0
              SetPin DMD_OE , 8
             Pin(DMD_CLK) = 0
              SetPin DMD_CLK , 8
             Pin(DMD_SCLK) = 0
              SetPin DMD_SCLK , 8
             Pin(DMD_R_Data) = 1
              SetPin DMD_R_Data , 8
              SetPin DMD_T_Data , 2

          DisplaysWide=1       ' set up number of displays wide
          DisplaysDown=3       ' set up number of displays down

videomem= MM.Video  ' code added to source 3.2C by D Wyatt
videomemlo = videomem And &h0000ffff
videomemhi = ((videomem-videomemlo)\2^16) And &h0000ffff
SetTick 5 , dmd_display       ' set interrupt for dmd display

' end setup code dmd panel
Option base 0
Dim segment(8,4)
Dim numseg(10,8)
For count=0 To 6
For count2=0 To 3
Read a
Next count2
Next count
For count3=0 To 9
For count4=0 To 6
Read a
Next count4
Next count3

Do                                        'do...loop begining

text$=Inkey$                 ' read inkey$
If text$="q" Then End          'if q then quit
If text$="i" Then             ' get input
       Print @(100,100) " ";
       Input "Number to display ",dnumber
If text$="c" Then
       display=Not display
       If display = 1 Then
              digit1= dnumber Mod 10
              digit2= dnumber\10 Mod 10
              digit3= dnumber\100 Mod 10
       For x=0 To 7
              If numseg(digit1,x)=1 Then
                     Line (x1,y1)-(x2,y2),1,bf
             If digit2>0 Or ( digit2=0 And digit3>0) Then
              If numseg(digit2,x)=1 Then
                     Line (x1,y1)-(x2,y2),1,bf
             If digit3>0 Then
              If numseg(digit3,x)=1 Then
                     Line (x1,y1)-(x2,y2),1,bf
        Next x

Loop                 ' end of do....loop

' subroutine code required by dmd panel

Sub senddata1( a_pin , b_pin , displayrow , wide , down)
          Pin(DMD_A)= a_pin
          Pin(DMD_B)= b_pin
          Pin(DMD_OE) = 1
       junk1 = SpiDMD( videomemhi, videomemlo, displayrow, wide, down, DMD_T_Data, DMD_R_Data, DMD_CLK)
       Pin(DMD_OE) = 0
       Pin(DMD_SCLK) = 1
       Pin(DMD_SCLK) = 0
End Sub
' end subroutine code required by DMD panel

' code required by DMD panel, interrupt called every 5 ms, total of 20 ms for full display
  On dmdcount GoTo loop1,loop2,loop3,loop4
        senddata1(1,1,0,displayswide,displaysdown)     ' lines 1,5,9,13
        GoTo loopend
        senddata1(0,0,1,displayswide,displaysdown)     ' lines 2,6,10,14
        GoTo loopend
        senddata1(1,0,2,displayswide,displaysdown)     ' lines 3,7,11,15
        GoTo loopend
        senddata1(0,1,3,displayswide,displaysdown)     ' lines 4,8,12,16
' end code required by DMD panel

Data 1,1,14,3
Data 15,1,30,3
Data 28,1,30,14
Data 15,12,30,14
Data 1,12,14,14
Data 1,1,3,14
Data 14,1,16,14
Data 1,1,1,1,1,1,0  '0
Data 1,1,0,0,0,0,0  '1
Data 1,0,1,1,0,1,1  '2
Data 1,1,1,0,0,1,1  '3
Data 1,1,0,0,1,0,1  '4
Data 0,1,1,0,1,1,1  '5
Data 0,1,1,1,1,1,1  '6
Data 1,1,0,0,0,1,0  '7
Data 1,1,1,1,1,1,1  '8
Data 1,1,1,0,1,1,1  '9

Cheers Dennis...