LED Matrix Programming in C#
A major part of my job is to manage the processing of 60 some odd external data feeds which are all fairly unique. These processes drive front end content and is a necessity for our core business. I am continually asked for statuses of each of these, it was time to display these on a ticker.
I bought a 4U2SEE LED Matrix on eBay for around $150, and much to my surprise it wasn’t difficult to get working with custom code.
4U2SEE LED Matrix Info and Specs:
2.1″ Characters
- 64 K pf Memory
- 8 Bit CPU
- 140 degree viewing angle
- Standard Aluminum enclosure
- Indoor Usage Only
- RS232 or RS485 communication with sign standard
- Programmable via hand-held remote controller or SIGMA 3000 software
- Three ways to mount the sign—hanging, side-mounted, and sitting
- Ethernet communication (Enhanced Version Only)
- 1024K of Memory (Enhanced Version Only)
- 32 Bit CPU (Enhanced Version Only)
- Available in Tricolor only
Taken from: Link: http://www.hyperionsigns.com/modules.php?name=NavSystem&sp_id=100
Although this sign does allow for Ethernet communication, I wanted to first write a windows form application to send text over the serial line as a proof of concept. I tried finding any API information on this sign and/or any advice on how to program it, but LED Matrices tend to be quite unique from brand to brand. In hopes to get some documentation I emailed the manufacturer and they sent me documentation listing all the HEX values that you could send to this sign and what they did. The protocol for this sign is called Simplified Jetfile II Protocol v2.4 and the documentation for this protocol can be found here.
I broke down the full array of bytes to send to the sign into chunks: BeginCommand, SizeCommand, ColorCommand, DisplayModeCommand, TextCommand, EndCommand, and a concatenated version of all of these commands:FullCommand.
1: string BeginCommand = "01-5A-30-30-02-41-42-06-1B-33-62-1C-";
2: string ColorCommand = mColor;
3: //colors = 30-37
4: string SizeCommand = "1A-30"; //30 is size param
5: string DisplayModeCommand = "0A-49-31"; //0A-49 is text moving -XX is display mode
6: string TextCommand = mCommandString;
7: string EndCommand = "03";
8: string FullCommand = BeginCommand + ColorCommand +SizeCommand+ DisplayModeCommand+TextCommand + EndCommand;
9: //4A is First Letter
10: //03 is the last command
11: //37 is color
12: /33 is display mode
13: //construct full command
Now that I had the protocol specifications I had to figure out how to communicate over a serial port using C#. After some research I came up with this code to communicate over the serial line:
1: public void Init()
2: {
3: sp = new SerialPort();
4: sp.BaudRate = 19200;
5: sp.DataBits = 8;
6: }
I needed to send my FullCommand as bytes, so I used NeilCK’s Hex Encoding class
1: ByteArray = HexEncoding.GetBytes(FullCommand, out discarded);
2: sp.Open();
3: sp.Write(ByteArray, 0, ByteArray.Length);
4: sp.Close();
And that’s it!