from the Automation List department...
Receiving data from a weighing scale using RS232 with VB 6 App
Communications systems and equipment. topic
Posted by CLD on 12 January, 2007 - 1:28 am
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?

Posted 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

Posted by Anonymous on 23 January, 2007 - 10:52 pm
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.

Posted by xmahmoud on 28 January, 2007 - 3:11 pm
please if u have the the module send it to me

Posted by AdvanLiew on 4 February, 2007 - 7:47 pm
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?

Posted by Anonymous on 17 February, 2007 - 12:12 am
I have the same problem. If anybody can help please. I've bin battling with this for a long time.

Posted by Sam B on 16 February, 2007 - 11:03 pm
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

Posted 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.

Posted by Anonymous on 25 February, 2007 - 10:41 am
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


Posted 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).

Posted by PG on 27 February, 2010 - 10:01 am

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.

Posted by M Griffin on 27 February, 2010 - 9:39 pm
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.).

Posted by Ankur on 30 July, 2012 - 3:24 am

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

Posted 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

Posted by Hemal on 31 July, 2012 - 3:34 am
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

Posted by Anish on 7 September, 2012 - 6:47 am
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 ?


Posted by HARRY HUNJAN on 1 June, 2007 - 11:06 pm
Pls help me by sending complete code.

Harry Hunjan

Posted by Gautham on 15 November, 2007 - 2:22 pm
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

Posted by hi on 3 December, 2007 - 11:45 pm
Dear sir,

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

Posted by iyn on 4 November, 2008 - 5:18 pm
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.


Posted by Ali on 24 February, 2010 - 11:46 am
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

Posted by swati on 12 March, 2010 - 9:01 pm
increase input length to 7-8 it will work

Posted 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.


Posted by Abhijit on 11 August, 2007 - 1:29 am
Can you provide details regarding which scale you have with regards to Manufacturer and Model?

Posted by vissu on 28 August, 2007 - 4:27 pm

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.

Posted by Ahamd on 1 March, 2010 - 3:54 am
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


Posted by alwi on 30 September, 2007 - 10:35 pm
just contact my email, ijust get a project with the same problem like you. i can send u the complete source.

Posted by Afzan on 3 January, 2008 - 5:36 pm
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?

Posted by xxx on 3 July, 2011 - 10:45 am
hey i found this e-in-vb.html

Posted by Raghu on 31 January, 2013 - 5:16 am
> hey i found this
> n-vb.html

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.

Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2014 Nerds in Control, LLC. All rights reserved.

Users of this site are benefiting from open source technologies, including PHP, MySQL and Apache. Be happy.

It shall be unlawful for any suspicious person to be within the
-- Local ordinance, Euclid Ohio
Advertise here
our advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive