Pages: [1]   Go Down
Author Topic: Reading Output From a Digital Balance (scale)  (Read 1473 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 5
Posts: 233
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying to read the output from a Veritas 123 digital balance, the output I want to read is the stream that it sends to a serial printer.  The output from the balance is a DB-9 connector in RS232 format.  I take Pin #2 (the transmit pin) of the DB 9 from the balance and put it on pin 13 (R1IN) of the MAX232 IC and take pin 12 (R1OUT) on the MAX 232 and connect it to pin 2 on my UNO and use SoftwareSerial to set pin 2 for receive and 3 for TX without input on 3.  I have the rest of the MAX232 set up as it says in the datasheet.  I am not concerned with sending the balance any commands so I have not taken the TX from UNO to the RX on the balance.

When I command the balance to print out its current reading I get the following:
32
32
32
32
32
48
46
48
48
32
71
78
32
13
10
And if I put 5.31 grains on the scale I get a different string here it is I have taken the LF/CR out so it does not take so much screen to read
32 32 32 32 32 53 46 50 57 32 71 78 32 13 10

The number of characters seems to be correct as the very sparse manual says there are 15 characters when in the weight mode. Here is the definition of what the format in this mode is supposed to be:
Transmission format
String transmitted is composed by the following 14 characters:
 First character: weight sign (blank or -)
 second/ninth character: weight or other data
 tenth/twelfth character: weight unit symbol
 thirteenth character: stability indicator
 fourteenth character: carriage return
 fifteenth character: line feed
Eventually non-significative zero are spaces.


Here is the code that I am using to test the setup.


Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);  // pin 2 for receive 3 for tx


void setup() 
{
  Serial.begin(9600);  // Serial Monitor
  // set the data rate for the SoftwareSerial port  The scale
  mySerial.begin(4800);

}

void loop()
{
  if (mySerial.available())
  {
    Serial.println(mySerial.read());
  }
}



The balance only sends data out when I tell it to print and both the systems use a 4800 baud rate so I do not think this is noise or gibberish I just don't seem to have it in the correct format.

Does anyone out there have any hints for converting this?

Thanks

wade
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 289
Posts: 25697
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
32 32 32 32 32 53 46 50 57 32 71 78 32 13 10
Space, space, space, space, space, 5, decimal, 2, 9 ...carriage return line feed

  http://www.asciitable.com       
« Last Edit: October 08, 2012, 03:41:35 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Full Member
***
Karma: 5
Posts: 233
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

AWOL,

Thanks for the answer to what I see now was a very basic question.

wade
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

AWOL,

Thanks for the answer to what I see now was a very basic question.

wade

You can connect this balance directly to a PC and open serial port to immediately see everything AWOL had to explain to you smiley-razz  smiley-wink. How much was that balance? I want one if it's not too expensive.
Logged


0
Offline Offline
Full Member
***
Karma: 5
Posts: 233
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The balance was about $259 where in MN are you?

wade
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The balance was about $259 where in MN are you?

wade

A bit expensive for me. I'll have to look for cheaper solutions. I'm in a place where people have drinking problems on Thursday nights. It is also famous for drivers having to take U-turns to get to places and produces fair amount of granites.
Logged


Pages: [1]   Go Up
Jump to: