Weighbridge device integration with Dynamics AX

Recently I got chance to work on Integration project where I need to integrate the Weighbridge device with dynamics ax. This was the hardware interfacing project, where I have used the API to read the serial port. The serial port was connected with the Weighbridge device and sending the weight information to that port.

Business needs

I have developed this software for a steel company where they have trucks coming with the weight. Weighbridge software captures the weight of the truck and stores in weighbridge software that we have developed in Dynamics AX 2009. Later we again capture the weight as the trucks goes out after unloading the material. So by netting out the two weights we would be able to get the material weight that is coming.

What is Weighbridge device and for what use it is?

If anyone would like to know what is that device and what is the use of that device. “A weighbridge is a really useful tool for measuring the maximum load which can be carried by a vehicle or other device”


We have developed the weighbridge software in AX, (see picture below) that capture and records the weight of material coming in. The capture buttons are used to capture the weight from Serial Port, the interfacing logic is written in that. 

The weighbridge software is normal AX software the important thing is the Serial Port interfacing logic, which I have shown below. I have to use the .Net SerialPort classes in AX to develop the interfacing logic.

Happy Daxing, let me know if you have anything to ask in here.


14 Responses to Weighbridge device integration with Dynamics AX

  1. vikrant singh says:

    hi Amir,
    I too have same type of problem we are developing software for a dairy here we have weigh bowl where the milk is collected and weight is taken and a milk analyzer which tests the milk for its fat content now these two devises are integrated with ax and we are able to get reading on local machine but the clients requirement is to get the reading over WAN . This device is connected through serial port can you share your expertise with us and come up with some suggestion
    thanks and regards

    • Amir Nazim says:

      Hi Vikrant,

      You might be facing because your com port might not be mapped while you are on WAN. what we have did is that we also have WAN structure, where clients are accessable through RDS. only to weighbridge users we have used the remote desktop and while taking the remote we have published the ports, there is an option while taking the remote desktop, then after that you would be able to take weight on the software running on remote.

      • Vikrant says:

        Hi Amir,
        Thanks Buddy for your help. Now can you please help me or suggest me some link where i can learn how to map any port the way we need and how to publish it while taking on RDS . Any help will be highly appriciated.Pls revert soon…

      • Amir Nazim says:

        Hi Vikrant,

        there is an option while u take the remote “mstsc”. please check the link. Also can you try accessing the port through hyper terminal, it is available as tool in windows 7 or in XP.
        remote desktop

  2. Vikrant says:

    Hi Amir ,
    This what exactly we have done but then also we are unabel to get the weight we have tested it on hyper terminal as well. whan we click the get weight button a dll is envoked which reads the data from device but we are getting this error ” ‘CLRObject’ could not be created” when we try to take weight on remote client using RDS . man we are in big trouble pls come up with some solutions……

    Thanks and regards

    • Amir Nazim says:

      it is difficult to suggest you any solution like that, there could be many reason for CLR exception. check your exception log.

  3. Vikrant says:

    Hi Amir,

    Buddy we have tried this but its not working . Buddy we are geting some error CLR object could not be created . We are not even abel to take print out on the local machine when we are using Remote app. Tell me if yu need more details we badly need the solution to this problem

  4. mladenml says:

    Hi Amir,

    Can this be done in Axapta 3.0?
    We have the same problem with capturing the weights of the trucks over serila port 😦

    • Amir Nazim says:

      well, i am not really sure on Ax3.0 but i believe it should run, as it is the ,.net API used in AX. the code in the blog is not final, u need to play arround according to condition to implement your own requirement,
      let me know if u need any more help

  5. Ahmad says:

    Hi Amir ,
    one thing i want to know why u have used comport name as “@SYS39398” insted of directly using “COM1”

  6. Karan says:

    Hi Amir,

    Can you please tell me how can we integrate weigh bridge machine with AX 2009 and what are the tools available for this ?

    Is it possible to this or not? I just know that there are some classes in AX 2012 which helps in reading the data from ports but I think those classes are not available in Ax 2009?

    Kindly help me in this as I am new to integration and I need to integrate weigh bridges with AX 2009.

    Thanks and regards.

    • Amir Nazim says:

      This blog is with Ax 2009, API or classes itself not available in AX for serial port reading, but we have the privilage to use the .net class in AX, like i have shown in that blog.

  7. Muhammad Khairi says:

    hi amir,

    currently i’m using ax2009 & i’ve tested your code to send sms, but no sms sent. no error come out.
    However, if i command using hyperterminal, is successfully sent sms.

    this is my code :

    port= new System.IO.Ports.SerialPort();



    port.WriteLine(“AT” + num2str(char2num(“Z”,1),1,0,1,2));
    port.WriteLine(“AT+CMGF=1” + num2str(char2num(“Z”,1),1,0,1,2));
    _command = “AT+CMGS=\\” + “‘0133409936′” + “\\” + “\\r”;
    port.WriteLine(“TEST” + num2str(char2num(“Z”,1),1,0,1,2));


    Question : 1. am i wrongly type my code?
    2. is that correct to convert command ctrl+z into num2str(char2num(“Z”,1),1,0,1,2)?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: