Just received my new 32x32 RGB matrix!

Post here to let others know of a project you're working on.

Moderators: Chuckt, Garth, bitfogav

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Just received my new 32x32 RGB matrix!

Post by brad » Thu Jun 06, 2013 10:07 pm

I posted a few days ago about great prices on LED matrix displays. Well mine just arrived today! 32x32 Pixels of RGB goodness in a mini 16cm x 16cm form factor!

Here it is running on one of my PICnDuino's
20130606_215732.jpg
20130606_215732.jpg (320.37 KiB) Viewed 16959 times
I have some big plans for this little guy - a new game system no doubt.

For those interested, here's the swordfish code that you use to get something drawn on the display.

First of all, you set up 32 longwords (a longword can hold 32 bits). For red, green and blue:

Code: Select all

Dim OutputDataRed(32) As LongWord 
Dim OutputDataGreen(32) As LongWord
Dim OutputDataBlue(32) As LongWord
Then give some Nicknames to the port pins to make them easier to use (These names line up with the names on the pins of the 32x32 matrix display)

Code: Select all

Dim RedData0 As PORTB.0
Dim RedData1 As PORTB.1
Dim GreenData0 As PORTB.2
Dim GreenData1 As PORTB.3
Dim BlueData0 As PORTB.4
Dim BlueData1 As PORTB.5
Dim Latch As PORTB.6 
Dim OutputEnable As PORTB.7
Dim RowA As PORTC.0
Dim RowB As PORTC.1 
Dim RowC As PORTC.2
Dim RowD As PORTC.3
Dim CLK As PORTC.4
And here's the code to actually draw stuff on the screen:

Code: Select all

Sub DrawGraphics()
    For Y = 0 To 15
        TempData0 = OutputDataRed(Y)
        TempData1 = OutputDataRed(Y + 16)       
        TempData2 = OutputDataBlue(Y)
        TempData3 = OutputDataBlue(Y + 16) 
        TempData4 = OutputDataGreen(Y)
        TempData5 = OutputDataGreen(Y + 16)
        For X = 0 To 31
            RedData0 = TempData0.bits(31 - X)
            RedData1 = TempData1.bits(31 - X) 
            GreenData0 = TempData2.bits(31 - X)
            GreenData1 = TempData3.bits(31 - X) 
            BlueData0 = TempData4.bits(31 - X)
            BlueData1 = TempData5.bits(31 - X)
            CLK = 1
            CLK = 0
        Next
        RowA = Y.bits(0)
        RowB = Y.bits(1)
        RowC = Y.bits(2) 
        RowD = Y.bits(3)
        Latch = 1
        Latch = 0  
        OutputEnable = 0
        DelayUS(200)
        OutputEnable = 1
    Next
End Sub
If you want to draw something on the screen, you just fill your outputdatared, outputdatagreen and outputdatablue arrays with a whole heap of 1's and 0's.

For example, if you wanted to draw what you see in the image above, you would have that data stored in an array like this:

Code: Select all

const MyDataRed(32) as longword = (%00000000000000000000000000000000, %01111100000000000000000000000000, %01000100000000000000000000000000, %00000100000000000000000000000000, %00000100000000000000000000000000, %00000100000000000000000000000000, %00011100000000000000000000000000, %00111100000000000000000000000000, %00000010000000000000000000000000, %00000010000000000000000000000000, %00000010000000000000000000000000, %00000010000000000000000000000000, %00100110000000000000000000000000, %00111100000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00011100000001110000000000000000, %00110011000110001000000000000000, %00000001000000001000000000000000, %00000011000000001000000000000000, %00000110000000001000000000000100, %00000111110000001000100000000100, %00000000011000001000100000000100, %00000000001000010000100000001100, %00000000001000110000011100111000, %00000000110000100000000011100000, %00011111100001100000000000000000, %00000000000001111111000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000)
const MyDataGreen(32) as longword = (%00000000000000000000000000000000, %00000000011110000000000000000000, %00000000110011000000000000000000, %00000000100001000000000000000000, %00000000000000100000000000000000, %00000000000000100000000000000000, %00000000000001100000000000000000, %00000000000001000000000000000000, %00000000000011000000000000000000, %00000000000010000000000000000000, %00000000000110000000000000000000, %00000000001100000000000000000000, %00000000011000000000000000000000, %00000000011111111100000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000001110000000000000000, %00000000000110001000001001000000, %00000000000000001000001001000000, %00000000000000001000001001000000, %00000000000000001000000000000000, %00000000000000001000000000000000, %00000000000000001000000000000000, %00000000000000010000000000000000, %00000000000000110000000000000000, %00000000000000100000000000000000, %00000000000001100000000000000000, %00000000000001111111000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000)
const MyDataBlue(32) as longword = (%00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000110000100000, %00000000000000000000001001000000, %00000000000000000000000111000000, %00000000000000000000000011000000, %00000000000000000000000100110000, %00000000000000000000001100011000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00011100000000000000000000000000, %00110011000000000000001001000000, %00000001000000000000001001000000, %00000011000000000000001001000000, %00000110000000000000000000000000, %00000111110000000000000000000000, %00000000011000000000000000000000, %00000000001000000000000000000000, %00000000001000000000000000000000, %00000000110000000000000000000000, %00011111100000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000)
Then to display it on the screen, you need to copy all of that data into your outputdatared, outputdatagreen and outputdatablue arrays:

Code: Select all

sub CopyImageDataIntoOutputArrays()
    for x = 0 to 31
        outputdatared(x) = mydatared(x)
        outputdatagreen(x) = mydatagreen(x)
        outputdatablue(x) = mydatablue(x)
    next        
end sub

Hope that helps for now. I'll be posting my adventures as they come about :)

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Just received my new 32x32 RGB matrix!

Post by bitfogav » Fri Jun 07, 2013 1:59 am

The board looks really neat, mines just left Hong Kong :lol: thanks for sharing the code, it will get me up and running in no time.. Would it be much to ask if you could share a picture of the back of the module with the connections of wiring it all up?
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Just received my new 32x32 RGB matrix!

Post by brad » Fri Jun 07, 2013 9:50 pm

Did you get in touch with James? He's very helpful!

Here's a couple of pics for you (please forgive the bad photo's, I took them through a desktop magnifying glass / light and it warped the images)

Here is the HUB75 pinout as you look at it in this follow photo - I tried to color code the wires as much as possible (I.E. the reddata connections are red etc...)

REDDATA0 | GREENDATA0
BLUEDATA0 | GROUND
REDDATA1 | GREENDATA1
BLUEDATA1 | GROUND
ROWA | ROWB
ROWC | ROWD
CLOCK | LATCH
OUTPUT ENABLE | GROUND
20130607_213541.jpg
20130607_213541.jpg (120.7 KiB) Viewed 16946 times
And here's one of the whole of the back of the unit:
20130607_213549.jpg
20130607_213549.jpg (121.83 KiB) Viewed 16946 times
Also, here's the complete code to get one static 32x32 image drawn on the screen (this is using a PICnDuino - maxed out at 64Mhz which = 16MIPS) The code uses 1,527Bytes of program memory and 445Bytes of SRAM (mainly due to the screen buffers for 32 long words of red, green and blue)

Code: Select all

Device = 18F25K20    'Automatically brings in device file 18F25K22.bas
Clock = 64           '64MHz (top speed)
Config FOSC = HSPLL   'tells PIC to use external high speed (crystal) oscillator, medium power
                                                               
Include "utils.bas"      ' we are including an extra file here which allows us to use shortcuts  

' Constant Arrays
const MyDataRed(32) as longword = (%00000000000000000000000000000000, %01111100000000000000000000000000, %01000100000000000000000000000000, %00000100000000000000000000000000, %00000100000000000000000000000000, %00000100000000000000000000000000, %00011100000000000000000000000000, %00111100000000000000000000000000, %00000010000000000000000000000000, %00000010000000000000000000000000, %00000010000000000000000000000000, %00000010000000000000000000000000, %00100110000000000000000000000000, %00111100000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00011100000001110000000000000000, %00110011000110001000000000000000, %00000001000000001000000000000000, %00000011000000001000000000000000, %00000110000000001000000000000100, %00000111110000001000100000000100, %00000000011000001000100000000100, %00000000001000010000100000001100, %00000000001000110000011100111000, %00000000110000100000000011100000, %00011111100001100000000000000000, %00000000000001111111000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000)
const MyDataGreen(32) as longword = (%00000000000000000000000000000000, %00000000011110000000000000000000, %00000000110011000000000000000000, %00000000100001000000000000000000, %00000000000000100000000000000000, %00000000000000100000000000000000, %00000000000001100000000000000000, %00000000000001000000000000000000, %00000000000011000000000000000000, %00000000000010000000000000000000, %00000000000110000000000000000000, %00000000001100000000000000000000, %00000000011000000000000000000000, %00000000011111111100000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000001110000000000000000, %00000000000110001000001001000000, %00000000000000001000001001000000, %00000000000000001000001001000000, %00000000000000001000000000000000, %00000000000000001000000000000000, %00000000000000001000000000000000, %00000000000000010000000000000000, %00000000000000110000000000000000, %00000000000000100000000000000000, %00000000000001100000000000000000, %00000000000001111111000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000)
const MyDataBlue(32) as longword = (%00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000110000100000, %00000000000000000000001001000000, %00000000000000000000000111000000, %00000000000000000000000011000000, %00000000000000000000000100110000, %00000000000000000000001100011000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00011100000000000000000000000000, %00110011000000000000001001000000, %00000001000000000000001001000000, %00000011000000000000001001000000, %00000110000000000000000000000000, %00000111110000000000000000000000, %00000000011000000000000000000000, %00000000001000000000000000000000, %00000000001000000000000000000000, %00000000110000000000000000000000, %00011111100000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000, %00000000000000000000000000000000)

' Variable Arrays
Dim OutputDataRed(32) As LongWord 
Dim OutputDataGreen(32) As LongWord
Dim OutputDataBlue(32) As LongWord

' Variables
Dim X As Byte
Dim Y As Byte
Dim TempData0 As LongWord
Dim TempData1 As LongWord
Dim TempData2 As LongWord
Dim TempData3 As LongWord
Dim TempData4 As LongWord
Dim TempData5 As LongWord

' Port Setup
Dim RedData0 As PORTB.0
Dim RedData1 As PORTB.1
Dim GreenData0 As PORTB.2
Dim GreenData1 As PORTB.3
Dim BlueData0 As PORTB.4
Dim BlueData1 As PORTB.5
Dim Latch As PORTB.6 
Dim OutputEnable As PORTB.7
Dim RowA As PORTC.0
Dim RowB As PORTC.1 
Dim RowC As PORTC.2
Dim RowD As PORTC.3
Dim CLK As PORTC.4

' Sub Routines
Sub SaveGraphics()
    for x = 0 to 31
        outputdatared(x) = mydatared(x)
        outputdatagreen(x) = mydatagreen(x)
        outputdatablue(x) = mydatablue(x)
    next
End Sub

' All we need to do is store 32 long words in our output data registers, and this routine will take care of displaying them on the screen!
Sub DrawGraphics()
    For Y = 0 To 15
        TempData0 = OutputDataRed(Y)
        TempData1 = OutputDataRed(Y + 16)       
        TempData2 = OutputDataBlue(Y)
        TempData3 = OutputDataBlue(Y + 16) 
        TempData4 = OutputDataGreen(Y)
        TempData5 = OutputDataGreen(Y + 16)
        For X = 0 To 31
            RedData0 = TempData0.bits(31 - X)
            RedData1 = TempData1.bits(31 - X) 
            GreenData0 = TempData2.bits(31 - X)
            GreenData1 = TempData3.bits(31 - X) 
            BlueData0 = TempData4.bits(31 - X)
            BlueData1 = TempData5.bits(31 - X)
            CLK = 1
            CLK = 0
        Next
        RowA = Y.bits(0)
        RowB = Y.bits(1)
        RowC = Y.bits(2) 
        RowD = Y.bits(3)
        Latch = 1
        Latch = 0  
        OutputEnable = 0
        DelayUS(200)
        OutputEnable = 1
    Next
End Sub

' Start Of Program...
TRISB = %00000000
TRISA = %00000000                   
TRISC = %01100000

' Main Loop
While True()
    SaveGraphics 
    DrawGraphics
Wend  

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Just received my new 32x32 RGB matrix!

Post by bitfogav » Sat Jun 08, 2013 4:08 am

Thats great stuff Brad, and thanks for posting the code aswell.. I can't wait to try it out.. :lol:
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Just received my new 32x32 RGB matrix!

Post by bitfogav » Sun Jun 16, 2013 2:55 am

Ive got mine up and running now!! so impressive these 32x32 RGB displays :lol:
3232matrix.jpg
3232matrix.jpg (77.65 KiB) Viewed 16922 times
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Just received my new 32x32 RGB matrix!

Post by brad » Tue Jun 18, 2013 9:34 pm

That picture looks very familiar... :)

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 4 guests