Today is...
Tuesday, November 21, 2017
Welcome to Control.com, the global online
community of automation professionals.
Featured Video...
Featured Video
A tutorial introduction to programming using the QuickBuilder Programming Environment.
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive
Read Weight from Mettler Toledo Scale via RS232
reading a weight from a Mettler Toledo Scale via RS232

Hi All,

How can i read a weight from a Mettler Toledo Scale via RS232

I have written the coding to read the data from serial port.

I am very new ..working to read the weight(mg) data from a mettler Toledo via RS232 using VB.Net

please help and pass me any coding or idea.

My mail id: asasamy@yahoo.com

Thanks in Advance


By Tom Chubb on 20 April, 2009 - 9:02 am
0 out of 1 members thought this post was helpful...

Try this: http://lmgtfy.com/?q=mettler+toledo+text+string
;)

The following link shows the structure of the ASCII string on page 13
onwards.
www.usedscales.com/8213.pdf
HTH

Tom Chubb
JCK Automation
tom@jck-automation.com
www.jck-automation.com

Hi,

I understand that you want to capture Mettler Toledo RS232 port weight data in a VB.NET application. And you are after source code for VB.NET.

To query the scale, you need to send an ASCII command:

S<CR><LF>

To process the returned weight:
<?><LF>S S 0.000 lb
<?><LF>S S 0.000 g

It would be best to extract the value and the units and then implemenmt a switch statement on the units toi convert to a standard weight.

I would suggest reading the captured string into a string seperator using space " " as the delimiter such that
str[0] = "<?><LF>S"
str[1] = "S"
str[2] = "0.000"
str[3] = "lb|g|kg|..."

then process the result

Which version of VB are you using? - I might be able to supply VB.NET 2008 code.

www.earthed.net.au admin@earthed.net.au

By Fred Loveless on 21 April, 2009 - 9:43 am

Ultimately what is your goal, i.e. what are you going to do with the data?

If you are using it in an automated process of some kind you might want to consider useing and OPC Server like Kepware's UCON Protocol Server. UCON stands for User Configurable. You can can create the request and response handling and then connect to the server via any SCADA Client or via VB.Net if you wish. the process is similar to the VB.Net code example that was presented.

Just another option to consider.

Fred Loveless
Senior Application Engineer
Kepware Technologies
http://www.kepware.com

By Lee Munyaradzi on 29 June, 2009 - 2:03 am

Hi,

> I understand that you want to capture Mettler Toledo RS232 port weight data in a VB.NET application. And you are after source code for VB.NET. <

I'm facing a similar problem. Could you please supply the vb .net code on how to read data from a scale via an RS232.

By Praveen Gaddam on 28 July, 2010 - 12:28 am

Hi

I am trying to do the same i.e., capture weights from mettler toledo Scale through RS232/USB.

Can you please provide the C# code sample for it?

Thank You,
Praveen

Hi,

I have the same problem, Can you supply the VB code. I have 2005 and 2008.

Thanks
donald [at] norpacexport.com

hi friends.. some one get the solution? please email me to jodanixxi@hotmail.com

Hi,

I have the same problem, Can you supply the VB.net code to me.Thanks
thrinmail@hotmail.com

Did anyone solve this, if you have can you email me the code too pls, matthewb@acapacific.com.au

Thx

By Yuri Greene on 6 December, 2011 - 5:01 pm

> Did anyone solve this, if you have can you email me the code too pls, matthewb@acapacific.com.au

This will read the weight on the mettler scale on the serial port. Put this Function in and call it.


Private Function get_lbs() As String
Dim buffer As New StringBuilder()
Dim comPort As New SerialPort("COM1", 9600, Parity.None, 8, StopBits.One)

comPort.Open()
comPort.Write(STX)
mytimer(1)
comPort.Write("P")
mytimer(1)
comPort.Write(CR)
mytimer(1)
Dim line As String = comPort.ReadExisting
comPort.Close()
Return isnum(Trim(line))

End Function

By Yuri Greene on 7 December, 2011 - 4:18 pm

> This will read the weight on the mettler scale on the serial port. Put
> this Function in and call it.


> Private Function get_lbs() As String
> Dim buffer As New
>StringBuilder()
> Dim comPort As New
>SerialPort("COM1", 9600, Parity.None, 8,
>StopBits.One)
>
> comPort.Open()
> comPort.Write(STX)
> mytimer(1)
> comPort.Write("P")
> mytimer(1)
> comPort.Write(CR)
> mytimer(1)
> Dim line As String =
>comPort.ReadExisting
> comPort.Close()
> Return isnum(Trim(line))
>
> End Function

You will also need this in the class

Public Shared STX = Chr(2)' ascii start of text
Public Shared CR = Chr(13) 'ascii Carriage Return

By trung2060 on 1 July, 2017 - 4:31 am

Sorry, but I don't know, why use: comPort.Write("P")

>> This will read the weight on the mettler scale on the serial port.
>> Put this Function in and call it.


>> Private Function get_lbs() As String
>> Dim buffer As New
>>StringBuilder()
>> Dim comPort As New
>>SerialPort("COM1", 9600, Parity.None, 8,
>>StopBits.One)
>>
>> comPort.Open()
>> comPort.Write(STX)
>> mytimer(1)
>> comPort.Write("P")
>> mytimer(1)
>> comPort.Write(CR)
>> mytimer(1)
>> Dim line As String =
>>comPort.ReadExisting
>> comPort.Close()
>> Return isnum(Trim(line))
>>
>> End Function

> Sorry, but I don't know, why use: comPort.Write("P")

"Request Displayed Weight after Stability"
here on page 6: http://www.scalemanufacturers.org/pdf/scalecommprotocol5199m1.pdf