Automating Content for Led matrix panel with Huidu

In this post i would like to share my one of the experience in automating the content creation for LCD Panel.

hd2014

Recently one of my neighbour requested is there a way to automate his LED display with daily thoughts as he is manually creating the daily thoughts through the LED Panel Controller software called HD provided by a Chinese company called Huidu. I am pretty sure that the tool may store the manually created items somewhere in the persistent path and with just few tweaks we can able to automate this. I agreed and started analyzing the way it works.

He is expecting a solution to import the daily thoughts which he is already created in an excel file to the LED Software through some utility as it currently doesn’t supports.

Workflow of LED Panels :

 

hd2014_ide

 

LED Panels uses a matrix format to render the required content (no constrain with the language).  The LED Controller Software HD2014 provides a interface through which we can add the content to be displayed and can be synced with the date and time. This including repeating intervals as well. Once the content is created, the software allows one to export and save them to a USB stick. This USB stick can be connected to the LED Panel device which has the necessary information for the Panel to render the content at the appropriate time. The latest software can be downloaded from this Url http://download.huidu.cn/download/Update/HD2016_V6.0.1.rar

Proposed Solution :

– Identify the path where the content is stored by the software and explore the data structure
– Write a simple program (C# Windows Application) to import a excel file and generate manually a .hd3 file with the same structural standards
– Import the generated .hd3 file to the native LED HD application and export them to USB stick
– Ensure LED Panel still able to recognize the content.

Where the Content is Stored by HD ?

The HD2014 provides the interface for basic editing and creation of content. Currently it doesn’t support for editing or importing a batch of items. The content are stored in this folder with an extension of .hd3. C:\Users\<username>\AppData\Roaming\HD2014\ProjFile\Screen-1.hd3. This .hd3 file is a plain XML which contains the detailed information of the created content. Along with the content information it also contains additional information which is very specific to the hardware settings.

This XML stores the created content (english or tamil) in a different format (ASCII) instead of plain text in 2 separate nodes. One node has the content title and date information and the other node contains the actual ASCII values of the content

<Attribute Name=”Content”>04505603204903205103204901301004505703205003204803204
80320500320480320490130101141181150130100600050000000140010090831…….</Content>

Here a sample partial content of the XML file

<!–?xml version=”1.0″ encoding=”UTF-8″?–>
<!–HD2014 v2.0.88–>

<Node Level=”2″ Type=”1″>
  <Attribute Name=”BorderType”>0</Attribute>

  <Attribute Name=”name”>#THOUGHTS_E_TITLE#</Attribute>
  <Attribute Name=”timeEnd”>86399</Attribute>
  <Attribute Name=”timeStart”>0</Attribute>

  <Node Level=”3″ Type=”1″>
    <Attribute Name=”AreaH”>32</Attribute>
    <Attribute Name=”AreaW”>192</Attribute>

    <Attribute Name=”Content”>#THOUGHT_CONTENT#</Attribute>
    <Attribute Name=”CustomerBorderData”></Attribute>
    <Attribute Name=”CustomerBorderDataLength”>0</Attribute>
    <Attribute Name=”DataLength”>#DATA_LENGTH#</Attribute>

    <Attribute Name=”name”>Single-line text-1</Attribute>
    <Attribute Name=”useBG”>0</Attribute>
  </Node>

</Node>

Implementation & Program Code in C# :

The following logic is used to convert the given text to a decimal content and the result is replaced in the corresponding node “Content” in the XML. I have not gone into detail of the code to import the excel file,reading the file and creating the XML from a sample template etc. Please contact me if you are looking for a detailed source code of this application.

 

Example :

Content :

Make Your Mind Your Best Friend

ASCII Equivalent :

00770000970001070001010000320000890001110001170001140000320000770001050001100001
00000032000089000111000117000114000032000066000101000115000116000032000070000114
00010500010100011000010000

public static string GetFormattedContent(string text)

{

         StringBuilder output = new StringBuilder();
          var charvalues = text.ToCharArray().ToList();
          foreach (var value in charvalues)
          {
              decimal decValue = value;
              var decString = decValue.ToString();
              decString = decString.PadLeft(4, ‘0’);
              decString = decString.PadRight(6, ‘0’);
              output.Append(decString);
          }

       return  output.ToString()
}

led-manager

The application takes the excel file and Month as input and generates the .hd3 XML file. The Month & Year is needed for my requirement as each line item in the excel needs to have a separate node for that given date in the .hd3 file. This way the application is successfully deployed in my neighbours place and he is happily using this utility to automate the daily thoughts on the LED Panel.

AuthorNirmal

Technical Geek - Gadget Enthusiast - Loves Programming C#,PHP & IOS - Blogger About