Today is...
Monday, June 25, 2018
Welcome to, the global online
community of automation professionals.
Featured Video...
Featured Video
EtherCAT with CTC’s master lets your multivendor network play well together...
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive
Receiving data from a weighing scale using RS232 with VB 6 App
I have a digital weighing scale I need to connect to the PC using RS232 communication port.

I have a digital weighing scale I need to connect to the PC using RS232 communication port. Every time I weigh an object, automatically the result/weight will display in the the texbox control in Visual Basic Application that I made. I need your help for the complete source code that will communicate to the weighing device and what control shuold I use to communicate and how?

By Robert Scott on 12 January, 2007 - 10:26 pm

Start by reading the manual for your particular scale. Each brand of scale is different (Mettler, Sartorius, etc.) That will tell you how to parse the output.

Robert Scott
Real-Time Specialties
Embedded Systems Consulting

You can use "mscomm control" to receive data from weight scale using rs232. The onComm event is used to receive data from serial port, and for more help follow the link:

Pls send feedback to me.

please if u have the the module send it to me

I use to receive data via a timer for continous looping sequence output to a textbox. Things do goes bad, as it flicking all the way. I using a indicator from AD series which read data from load cell of a truck weight bridge. It there's any way to stop this flicking without effecting the continous loop?

I have the same problem. If anybody can help please. I've bin battling with this for a long time.

In putting the light... Most of all the electronic weighing scales are equiped with the RS232 monitor, and nn your application you need to place a MSCommunicator to your Windows form or User control from your toolbox. These two objects will communicate, and you can handle the
hand shaking between the two object in your form by checking the MSComm1.PortOpen. From here you can take a decision. In most cases it is better to use the timer in monitoring the above mentioned object. I will send you the real code if you email me on Sam.Nkosi @ webmail. co. za

By EMD Productions on 19 February, 2007 - 10:39 pm

Start searching for especific scale serial output format. Using MSCOMM32 control from VB6 like:

MSComm1.CommPort = 1
MSComm1.Settings = "9600,N,7,2"
MSComm1.InputMode = comInputModeText
MSComm1.InputLen = 0 'all buffer from port
MSComm1.NullDiscard = True
'Use in Sub MSComm_OnComm() all string conversion and port reading.

If you need more I can send more. Write me.

Hi, the main problem im having is that the data input from the scale indicator to the mscomm contol is that the reading (weight) is not in a readable text and it flows throught there its not a fixed variable, the scale output is ascii. i received this information from the scale manufacturer. because i am very new to the mscomm control and not too good with this typr of coding pleas can any1 help me make heads or tails of how to put the codeing together.

1. Shekel Merav models 1000, 2000, 3000, 3001, 4000 and Caesar 2000, 3000, 3001,5000/1/3. Models use digital board 'Tiger', 'Arnav'.

2. The Merav has serial communication RS-232 to computer and printer.

3. The communiction is bi directional from indicator to computer and vice versa.

4. There are three communication modes:
4.1 Response to weight request - "W" 57 H from host.
4.2 Continuous weight transmmision.
4.3 Manual transmmision - (Print).

5. The indicator has additional 2 features.
5.1 Zero the display in response to - Z - 5A
5.2 Set the Tare in response to - T - 54.

6. Programmable Baud Rate: Tiger 600 - 9600 Arnav 600 - 2400

7. Programmable Parity: 0 - space
1 - EVEN
2 - Mark
3 - ODD

8. 7 or 8 data bits, 1 stop bit.

9. The data is transmitted in ASCII code.

10. Data String:
10.1 Positive weight  (+) XXX.XXX CR
10.2 Negative weight  (-) XXX.XXX CR

11. Connector D type 25 : Pinout: Pin 2 - Data in
Pin 3 - Data out
Pin 7 - GND

12. Commector D type9: Pinout Pin 2 - Data out
Pin 3 - Data in
Pin 5 - GND


By Michael Griffin on 25 February, 2007 - 7:14 pm

I have done weigh scales with Python rather than MS-VB, so I can't give you cut and paste code examples. However, I assume from your description of your problem in your first sentence that you don't know how to extract the number from the ASCII text output.

With the type of scales I have worked with, the text output before and after the weigh reading is not always exactly the same, so it required a pattern matching algorithm to extract the weight. I used a regular expression to find and extract the weight, which was then easy to convert from text to an integer. I don't know what sort of regular expression library support you have in MS-VB6, but in Python it took only half a dozen of lines of code to read the scale.

One other point is that the scale output didn't have any message delimiters, so the only way to tell if the scale was done sending was to wait for a fixed period of time and then try to extract the weight. This worked fairly well provided you wait longer than the minimum time you really need. You probably need to set up a test to print out the exact message from the scale, and then try shorter and shorter time delays until you start cutting the message off (then double this time to have a margin).


you may be able to help me, basically I need python scripts to help read a voltage reading...I have a Rs232 connected to a circuit, that will read force...(weight of a human)...I need a python script that will output the data, but having troubles in doing so... If you could assist, that would be great.

You will need the Pyserial serial port library. If you are using Linux, it is usually in your repository, so you can install it from your package manager. (The Debian package name is python-serial, which of course will be the same for Ubuntu).

If you are using MS Windows, you can download it from here:

The Linux version may work on Mac OS/X, but I don't anything about that.

Documentation is here:

The documentation is very good, so make sure to have a close look at it.

A brief summary though is you need to do the following:

First, configure the serial port. See the examples for that. The details of the configuration will depend on what you are trying to do.

Next, you read the serial port. How you do that depends on whether you are doing a "blocking" or "non-blocking" read. A blocking read will wait until it reads the specified number of bytes. A non-blocking read will just read what is currently available in the buffer. You make it blocking or non-blocking by how you set the time-out value (no time-out waits forever, a specified time-out will stop waiting after the set time).

If you are writing a simple command line program that just waits for input, then prints it and exits, then you may want to use blocking reads.

If you are writing a GUI program, then you want to use non-blocking reads and use a timer to "wake up" the program on regular intervals to check the serial port. When you are using non-blocking reads you need to check if the data is complete so you can if necessary concatenate the reply fragments until you accumulate a complete reply. The best way to do this depends on what the data is supposed to look like.

If you have more questions, then provide some more detail of what you are trying to do so I can direct the answers more precisely. It's actually pretty easy, but the details will depend on things like:

1) what the data looks like (fixed length, variable length, binary, ASCII, known delimiter or not, etc.),

2) how the overall program is supposed to work (simple script, large GUI program, log to a file, etc.).


i want to know how can i connect my weigh scale such that if the certain weight is reached my motor stops working..???

By Eamonn Wallace on 30 July, 2012 - 9:11 am

> i want to know how can i connect my weigh scale such that if the
> certain weight is reached my motor stops working..???

Some indicators have limits relays or setpoint relays you could use those if your indicator has them.

With an app you need to read the weight value from the indicator and when it "hits" a predetermined level you send a "signal" to the motor or interrupt the power supply

How you read the weight value depends entirely on the type of indicator

Eamonn Wallace

While it can be done through PC it works out much more expensive. It would be best if you buy an indicator with relay contacts and setpoint facility which can be easily used by you . We do manufacture these acuweigh at g mail .com

Hi M Griffin
I am trying to get a reading from my weiging scale using Python GUI.
I am using a Kern pfb weighing scale with the following specs: baudrate : 9600, 8 bit, parity_none. And it displays in ASCII.

Would you be able to send me your code, so I could refer to it and work on it please ?


By HARRY HUNJAN on 1 June, 2007 - 11:06 pm

Pls help me by sending complete code.

Harry Hunjan

Dear Sir/Madam,

Please make your codings more precise with steps
to be followed for designing and as well as coding. Opening & Closing Ports, Sending & Receiving/Reading RS232 codes, etc...

What if the weighing scale is replaced with a
Audio Visual Device having RS232 port?

Thanks & regards

Dear sir,

I want to receive data from rs232 to text box in visual basic studio.

I know my input is rs232, but I don't know it is in which format, baudrate. Could you please help me to capture the data transmission using VB 6?

When I use mscomm1 it is receiving some characters only.


Dear Sir:

I read your post. on 16 February, 2007 - 11:03 pm. You told another person how to develop program to read and display information from a weighing indicator. Therefore, I thought you could help me too.
I have exactly the same problem. I am a beginner and would like to develop the same application using Visual Basic 2008. However, I really don't know how to start. i have worked hours with the software but I didn't make it. I am wondering if you could tell how I should do and maybe you could also give me a source code. Please find attached the technical manual of the indicator. The serial ports specifications can be found in pages 23 and 24.

Best regards

increase input length to 7-8 it will work

By abhijeet roy on 10 February, 2012 - 4:38 am


I am able to get continues data from digitizer to pc through RS232. I need to get data in request mode. I mean whenever i will press enter key the digitizer data will come to the system....for that what is the vb6 code. pl. help me.


This is how to read data on serial port.

Can you please tell me how could we send data through RS 232 serial port to out door display unit by using vb 6 code.
thanks and regards

>Start searching for specific scale serial output format.
>Using MSCOMM32 control from VB6 like:
>MSComm1.CommPort = 1
>MSComm1.Settings = "9600,N,7,2"
>MSComm1.InputMode = comInputModeText
>MSComm1.InputLen = 0 'all buffer from port
>MSComm1.NullDiscard = True
>'Use in Sub MSComm_OnComm() all string conversion and port

Can you provide details regarding which scale you have with regards to Manufacturer and Model?


I am also trying the same thing with 2005.
What am I looking for? I have a weighing scale which will give lt, wt, depth, ht, etc. I have a system with .net 2005. Using RS 232 cable I am trying to get those data from scale to my application. Using serial port class I am configuring the com and then I am taking the data from the scale.

Problem facing me:
Step 1: In my .net Windows application, I click an Activate button. In this I had written a code to:
a. Send a request to scale
b. Scale will send an acknowledgement as * to my application.
c. Then user will keep a weight in scale and click Print button in device.
d. In my application I kept a message button which user can click to perform above step.
e. Then I am getting the bytes of data to my application and am storing that information in my database.

Now problem is:
On 2nd time if user has kept another weight in scale and user clicks a Print button then it's not getting that data. I kept a while (True) loop.

How can I achieve this in my application? Is there any way to achieve that 2nd, 3rd... data from scale without restarting com port repeatedly?

If you have some code for this and can give it to me, it will be very helpful to me.

Hi Dear

My name is AHmad from South Africa, I am also trying to use DS-788 weighing scale, in my vs 2003 application I can read the data in continous mode, now I want to read the data using some hand shaking signal.

pls tell me what is format should I send to computer to read the data
from DS-788 weighing scale. THx


just contact my email, ijust get a project with the same problem like you. i can send u the complete source.

I want to build a system that receives data from a weighing scale. What type of electonic weight scale is suitable? And can I have coding?

hey i found this

> hey i found this

The above link is no more exists.

If the source file exists with any one, please email the source file to my email ID :

Please consider this as urgent.

Thanks in advance.