8 inch RGB 7 segment display sample/test

newplumber

Senior Member
Hi

I was hoping to get this done sooner but miscalculated on how many wires it takes to grab 63 leds
but finally have it working and here is a little clip
https://www.youtube.com/watch?v=ML-9xy5qyk4

here is my first 3/4 code for the display from the clip
Code:
'This code is for testing a 8" display using 21 RGB leds  
'It uses a Picaxe 20X2 with three Max7219 ..and some wires 

#PICAXE 20X2 ' <-- best chip ever ...I mean ...BEST!!!! chip ever! 
#NO_DATA     ' makes downloading program faster
'#Terminal 38400
SETFREQ M64  ' Speed 

; SYMBOL Definitions
SYMBOL DIn_7219	= B.0 '---max pin = 1
SYMBOL Load_7219	= B.2 '---max pin = 12 
SYMBOL Clk_7219	= B.1 '---max pin = 13

; MAX7219 Registers - 
SYMBOL No_Op	= 0
SYMBOL Digit0	= 1
SYMBOL Digit1	= 2
SYMBOL Digit2	= 3
SYMBOL Digit3	= 4 ; for more digits, dig4 thru dig7 = 5 to 8 respectively
SYMBOL Digit4	= 5
SYMBOL Digit5	= 6
SYMBOL Digit6	= 7
SYMBOL Digit7	= 8 
SYMBOL Decode	= 9
SYMBOL Intens	= 10
SYMBOL ScanLim	= 11
SYMBOL ShutDwn	= 12
SYMBOL DigTest	= 15
SYMBOL Set_Off	= 0
SYMBOL Set_On 	= 1
SYMBOL No_Digits	= 7 	; Scan limit for digits 0 to 3 = 4
SYMBOL Dec_Digits = $00	; decode digits 0 to 3 according to "code B"
SYMBOL DigBlank	= 15	; "Code B" value to black a digit

; Define variables
SYMBOL Data_7219	         = b0
SYMBOL Register	         = b1
SYMBOL Display_Brightness  = b2	; 0 (=1/32 PWM on time) to 15 (=31/32 PWM on time)
Symbol Dat1                = b3
Symbol Digit_Num           = b4
Symbol blue                = b5  ' blue  color variable
Symbol green               = b6  ' green color variable
Symbol red                 = b7  ' red   color variable
Symbol No_Clr              = b8  ' no    color led displayed
Symbol loop_t              = b9  ' loop times variable 

;===============================================
; Initialise the PICAXE Pins for communication with the MAX7219
;===============================================
Init:
	DIRSB = %00000111
	LOW Load_7219
	LOW Clk_7219
Display_Brightness = 0
GOSUB Initialise7219
	
	
;===============================================
; Main Program loop
;===============================================	

Main:
 No_Clr = 0

 gosub G_Nine  :gosub scroll_brightness
 gosub G_Eight :gosub scroll_brightness
 gosub G_Seven :gosub scroll_brightness 
 gosub G_Six   :gosub scroll_brightness
 gosub G_Five  :gosub scroll_brightness
 gosub G_Four  :gosub scroll_brightness
 gosub G_Three :gosub scroll_brightness 
 gosub G_Two   :gosub scroll_brightness 
 gosub G_One   :gosub scroll_brightness 
 gosub G_Zero  :gosub Scroll_Bright_zero 
 
 
Goto Main		   

Scroll_Brightness:
 For loop_t = 0 to 13	
    GOSUB Initialise7219		   
    Inc Display_Brightness : pause 300
 Next		   
   For loop_t = 0 to 13	
     GOSUB Initialise7219		   
     Dec Display_Brightness : pause 300
   Next
Display_Brightness = 0
GOSUB Initialise7219
RETURN		   		   
Scroll_Bright_zero: ' when number is at zero then scroll brightness to 14 and stay 
 For loop_t = 0 to 13	
    GOSUB Initialise7219		   
    Inc Display_Brightness : pause 300
 Next					   
  Pause 10000				   
    Display_Brightness = 0
    GOSUB Initialise7219
 gosub No_color  'clear display with leds on      
  Pause 40000
RETURN				   
G_Nine:		   
   green     = %00000000 ' green
   blue      = %00000000 ' blue
   red       = %00000000 ' red
   
     green     = %01111111 ' green 
  gosub Display_1'87654321
     green     = %10111111 ' green 
  gosub Display_2'87654321
     green     = %01111100 ' green 
  gosub Display_3'87654321		   
RETURN		   
		   
G_Eight:		   
   green     = %00000000 ' green
   blue      = %00000000 ' blue
   red       = %00000000 ' red
   
     green     = %11111111 ' green 
  gosub Display_1'87654321
     green     = %11111111 ' green 
  gosub Display_2'87654321
     green     = %01111100 ' green 
  gosub Display_3'87654321		   
RETURN		   
		   
G_Seven:		   
   green     = %00000000 ' green
   blue      = %00000000 ' blue
   red       = %00000000 ' red
   
     green     = %01110000 ' green 
     blue      = %01110000 ' blue   
  gosub Display_1'87654321 
     green     = %10001111 ' green
     blue      = %10001111 ' blue     
  gosub Display_2'87654321
     green     = %01100000 ' green
     blue      = %01100000 ' blue     
  gosub Display_3'87654321		   
RETURN		   
		   
G_Six:		   
   green     = %00000000 ' green
   blue      = %00000000 ' blue
   red       = %00000000 ' red
   
     green     = %11111111 ' green 
     blue      = %11111111 ' blue     
  gosub Display_1'87654321
     green     = %11111111 ' green
     blue      = %11111111 ' blue     
  gosub Display_2'87654321
     green     = %00011100 ' green 
     blue      = %00011100 ' blue     
  gosub Display_3'87654321		   
RETURN		   
		   
G_Five:		   
   green     = %00000000 ' green
   blue      = %00000000 ' blue
   red       = %00000000 ' red
   
     green     = %01111111 ' green 
     red       = %01111111 ' red     
  gosub Display_1'87654321
     green     = %10111111 ' green
     red       = %10111111 ' red    
  gosub Display_2'87654321
     green     = %00011100 ' green
     red       = %00011100 ' red    
  gosub Display_3'87654321		   
RETURN		   
		   
G_Four:
   green     = %00000000 ' green
   blue      = %00000000 ' blue
   red       = %00000000 ' red
   
     green     = %01110000 ' green 
     red       = %01110000 ' red     
  gosub Display_1'87654321
     green     = %10111000 ' green 
     red       = %10111000 ' red   
  gosub Display_2'87654321
     green     = %01111100 ' green
     red       = %01111100 ' red 
  gosub Display_3'87654321		   
RETURN		   
G_Three:		   
   green     = %00000000 ' green
   blue      = %00000000 ' blue
   red       = %00000000 ' red
   
     red     = %01111111 ' green 
  gosub Display_1'87654321
     red     = %10001111 ' green 
  gosub Display_2'87654321
     red     = %01111000 ' green 
  gosub Display_3'87654321		   
RETURN		   
G_Two:		   
   green     = %00000000 ' green
   blue      = %00000000 ' blue
   red       = %00000000 ' red
   
     red     = %10011111 ' green 
  gosub Display_1'87654321
     red     = %11001111 ' green 
  gosub Display_2'87654321
     red     = %01111100 ' green 
  gosub Display_3'87654321		   
RETURN		   
G_One:		   
   green     = %00000000 ' green
   blue      = %00000000 ' blue
   red       = %00000000 ' red
   
     red     = %01110000 ' green 
  gosub Display_1'87654321
     red     = %00001000 ' green 
  gosub Display_2'87654321
     red     = %01100000 ' green 
  gosub Display_3'87654321		   
RETURN
G_Zero:		   
   green     = %00000000 ' green
   blue      = %00000000 ' blue
   red       = %00000000 ' red
   
     green     = %11111111 ' green 
     blue      = %11111111 ' blue
     red       = %11111111 ' red
  gosub Display_1'87654321
     green     = %11111111 ' green 
     blue      = %11111111 ' blue    
     red       = %11111111 ' red   
  gosub Display_2'87654321
     green     = %01100000 ' green 
     blue      = %01100000 ' blue    
     red       = %01100000 ' red  
  gosub Display_3'87654321		   
RETURN

No_Color:		   
   green     = %00000000 ' blue
   blue      = %00000000 ' blue
   red       = %00000000 ' red
  gosub Display_1'87654321 
  gosub Display_2'87654321 
  gosub Display_3'87654321		   
RETURN
		   
Display_1:
Digit_NUM = 1 :DAT1 = green  :gosub First_D  :Digit_NUM = 2 :DAT1 = blue   :gosub First_D
Digit_NUM = 3 :DAT1 = red    :gosub First_D  :Digit_NUM = 4 :DAT1 = No_Clr :gosub First_D
Digit_NUM = 5 :DAT1 = No_Clr :gosub First_D  :Digit_NUM = 6 :DAT1 = No_Clr :gosub First_D				
Digit_NUM = 7 :DAT1 = No_Clr :gosub First_D  :Digit_NUM = 8 :DAT1 = No_Clr :gosub First_D
RETURN

Display_2:
Digit_NUM = 1 :DAT1 = green  :gosub Second_D  :Digit_NUM = 2 :DAT1 = blue   :gosub Second_D
Digit_NUM = 3 :DAT1 = red    :gosub Second_D  :Digit_NUM = 4 :DAT1 = No_Clr :gosub Second_D
Digit_NUM = 5 :DAT1 = No_Clr :gosub Second_D  :Digit_NUM = 6 :DAT1 = No_Clr :gosub Second_D				
Digit_NUM = 7 :DAT1 = No_Clr :gosub Second_D  :Digit_NUM = 8 :DAT1 = No_Clr :gosub Second_D
RETURN

Display_3:
Digit_NUM = 1 :DAT1 = green  :gosub Third_D  :Digit_NUM = 2 :DAT1 = blue   :gosub Third_D
Digit_NUM = 3 :DAT1 = red    :gosub Third_D  :Digit_NUM = 4 :DAT1 = No_Clr :gosub Third_D
Digit_NUM = 5 :DAT1 = No_Clr :gosub Third_D  :Digit_NUM = 6 :DAT1 = No_Clr :gosub Third_D				
Digit_NUM = 7 :DAT1 = No_Clr :gosub Third_D  :Digit_NUM = 8 :DAT1 = No_Clr :gosub Third_D
RETURN
 

Attachments

Last edited:

newplumber

Senior Member
And here is the last 1/4 of the code for the full code
Code:
First_D:   '------------------------First MAX7219 -----------------------
  Register  = %00000000 :Data_7219 = %00000000 :gosub ShiftTo7219:gosub ShiftTo7219				
  Register  = Digit_NUM	:Data_7219 = DAT1      :gosub ShiftTo7219:PULSOUT Load_7219, 1  
RETURN

Second_D:   '------------------------Second MAX7219 -----------------------
    Register  = %00000000 :Data_7219 = %00000000 :gosub ShiftTo7219
    Register  = Digit_NUM :Data_7219 = DAT1      :gosub ShiftTo7219				
    Register  = %00000000 :Data_7219 = %00000000 :gosub ShiftTo7219:PULSOUT Load_7219, 1
RETURN

Third_D:   '------------------------Third MAX7219 -----------------------
    Register  = Digit_NUM :Data_7219 = DAT1      :gosub ShiftTo7219
    Register  = %00000000 :Data_7219 = %00000000 :gosub ShiftTo7219:gosub ShiftTo7219:PULSOUT Load_7219, 1
RETURN

ShiftTo7219:
	SHIFTOUT Clk_7219, DIn_7219, MSBFirst_L, (Register, Data_7219)
RETURN

Initialise7219: ' 3 max7219s
 FOR b15 = 0 to 2
  Register = Decode  : Data_7219 = Dec_Digits         : GOSUB ShiftTo7219:PULSOUT Load_7219, 1 
  Register = Intens  : Data_7219 = Display_Brightness : GOSUB ShiftTo7219:PULSOUT Load_7219, 1
  Register = ScanLim : Data_7219 = 7                  : GOSUB ShiftTo7219:PULSOUT Load_7219, 1
  Register = ShutDwn : Data_7219 = Set_On             : GOSUB ShiftTo7219:PULSOUT Load_7219, 1
  Register = DigTest : Data_7219 = Set_Off	      : GOSUB ShiftTo7219:PULSOUT Load_7219, 1
 NEXT
RETURN

How I built it was I traced out a digit in plywood then routered it out but saved the segment corners so light doesn't pass thru
then placed RGB leds ...3 per segment ...and ....and.....simply wired them up...(<-- sounds so easy) :(
I still need to deflect the light a little to make it more smooth
well I am happy I have it working and again thanks to everyone on the forum

btw after reading some post on the forum about max7219 being fake I think i am using fake/china max7219s and .
at my first attemp to code the display ...only the 2nd max7219 was going berserk...so after replacing 2nd max7219 with three other max7219s
it kinda dawned on me that it wasn't the max problem .......of course naturally it was my code ....only took 24 hrs to figure it out but was happy when it did work
your friend
who has friends that know where power comes from
 
Last edited:

techElder

Well-known member
Unique construction with the choice of the serif on the font.

A little too much slant to the font IMHO, but that is so subjective. Looks like about 15 degrees. Half of that would be my choice, but you're doing all the work! :D

"need to deflect the light a little to make it more smooth" Short of adding more LEDs, there isn't a lot you can do about filling in the gaps. Paper is certainly too opaque and obstructs the light. I would try to make segment covers coated with thinned fluorescent paint.

Use an overall diffuse plastic panel to smooth the edges from view. A diffuse plastic panel can easily be created with a sandblaster (be gentle!) or a really fine grit sandpaper.

You've created something purty darn good. I like it.
 

lbenson

Senior Member
Good idea from Tex about diffused plastic. I used to diffuse some with an orbital sander and maybe 220 grit (YMMV).

Good to see someone who does electronics who also knows that a router isn't only a little box that you plug wires into. (Wires--so 1990s.)

Nice job.
 

newplumber

Senior Member
Thanks texas, lbenson
I will try the sanding plastic ...but paper is the only thing I had, it looks way colorful in real life
my phone camera seems to record led light in a horrible way. I should look into getting a better one

I guessed at the degree slant of the digit...after staring at a small one ...maybe when I attempt to make a big display I'll change it

Yes true Lance ...(router)...I use a rotozip with a wood bit...(sheetrock bits seem to turn red & smoke on me when using it for wood) :)

I was surprised in my code the big speed difference using shiftout since using a 20x2
like used this code first
Code:
ShiftTo7219:
	PULSOUT Clk_7219, 1 ; bit 15 is don't care - enable if two or more MAX7219 are cascased together
	PULSOUT Clk_7219, 1 ; bit 14 is don't care
	PULSOUT Clk_7219, 1 ; bit 13 is don't care
	PULSOUT Clk_7219, 1 ; bit 12 is don't care
	DIn_7219 = bit11 : PULSOUT Clk_7219, 1
	DIn_7219 = bit10 : PULSOUT Clk_7219, 1
	DIn_7219 = bit9  : PULSOUT Clk_7219, 1
	DIn_7219 = bit8  : PULSOUT Clk_7219, 1
	DIn_7219 = bit7  : PULSOUT Clk_7219, 1
	DIn_7219 = bit6  : PULSOUT Clk_7219, 1
	DIn_7219 = bit5  : PULSOUT Clk_7219, 1
	DIn_7219 = bit4  : PULSOUT Clk_7219, 1
	DIn_7219 = bit3  : PULSOUT Clk_7219, 1
	DIn_7219 = bit2  : PULSOUT Clk_7219, 1
	DIn_7219 = bit1  : PULSOUT Clk_7219, 1
	DIn_7219 = bit0  : PULSOUT Clk_7219, 1
	RETURN
but then used this code and A big difference of faster speed it made for me ,from the good examples of westaust55
Code:
ShiftTo7219:
	SHIFTOUT Clk_7219, DIn_7219, MSBFirst_L, (Register, Data_7219)
RETURN
 
Top