Arduino RS-232 Translator.

Hello All, I am considering making an Arduino RS-232 ‘translator’. What I mean by that is, Where I work we are in the process of implementing a new business software system and I am having problems getting our parcel scales in the shipping department to communicate with the new software. These scales all use RS-232 interface, and I know the scales are definitely not faulty because I can read data from them in hyper-terminal and we never had a problem with them in the old software. I am pretty confident the Serial Settings (COM, Baud, Parody, etc) are good as well because I confirmed in hyper-terminal. I configured the new software to the serial setting and was still unable to get it to communicate.

When I contacted the software vendor they informed me their software only supports NCI scales (Something they never told us in advance ><), unfortunately all the scales we have are Fairbanks. I pulled the user manuals for both scales from the web and compared the serial data format. I found the following which I think might key to the problem…

The NCI Scales work as follows…

W<CR>  //Sent Serially from PC to Scale initiating a request

//Scale Response
<LF>xxxx.xxuu<CR>
<LF>hh<CR><ETX>
//Results
//Returns decimal weight with units plus scale status.

Alternately, the fairbanks scales work as follows…

<CR>  //Sent Serially from PC to Scale (no preceding W character)

//Scale Response
xxxx.xx <SP> <l or k> <b or g> <SP> <G or g> <R or r> <SP> <SP> <CR> <LF> <EOT>

So my thinking is, the new business software is serial sending ‘requests’ and are unable to get a response from our scale, and even if I was able to get past that point, the data would not be in the correct format anyhow. So i got to thinking, if I built an Arduino with 2 serial ports (‘input’ & ‘output’) to act as a go-between, I could give our scale the request data it wants and give our software the data it wants in the correct format with the Arduino handling all the translating.

I just ordered a few of the MAXX3322, is it possible to have an Arduino communicate with 2 devices over RS232 simultaneously? Does anyone see any major showstoppers for my plan.

I apologize in advance for posting this BEFORE i have tried anything, I normally like to exhaust all my attempts before bugging others for help, but this problem was just discovered today, and the Maxx 3322 IC’s i ordered won’t be here for a bit. Every day the scales in our shipping department are down is a day of slowed/lost productivity.

Thank you for your consideration.

Why not get an arduino with multiple serial ports already, or one of the clones based on the ATMega644/1284 (2 serial ports)? Then don't have to deal with more external hardware. http://sanguino.cc/

Why not get an arduino with multiple serial ports already, or one of the clones based on the ATMega644/1284 (2 serial ports)?
Then don’t have to deal with more external hardware.

Because there is a BIG difference between having 2 TTL level serial ports and having 2 RS232 serial ports.

The external hardware (absolutely required) is to get the RS232 signal to TTL levels for the Arduino to handle.

@Damage65
For the volume of serial data that you are probably going to be dealing with, NewSoftSerial can be used to create a software serial port on any Arduino (except the Mega, which has 4 TTL serial ports already).

You can have the Arduino get data from the scales using the hardware serial port (pins 0 and 1) and talk to the computer’s serial port, using any other pair of pins, using 2 MAX232 circuits.

Or, you can have the scales talk to the Arduino on a pair of pins, and have it talk to the PC, using the USB cable/interface, requiring only one MAX232 circuit (for the scales).

You're right, I tend to forget that real RS-232 uses much higher voltage swings (up to +/- 15V). Am not even sure what levels come out of my laptops USB port, need to put a scope on that and look sometime.

This fellow has a nice RS-232 to TTL adapter cable made up using the MAX232A chip. I suppose this would be comparable to others that hack cell phone USB cables.

http://www.seattlerobotics.org/encoder/aug97/cable.html

Is that the same part? I am not getting any google hits on MAXX3322.

Theoretically, it's certainly doable.

Possible problems: - hardware handshaking on the RS232 lines. doable, but more complex - overflows/lost data, if you use software serial and the system is full duplex - incorrectly/poorly/un- documented scale features It's possible you can even use the Arduino as an RS232-USB adapter, and only connect the true RS232 port on the scale side. (This depends on the software.)

I hope you really meant to get a MAX3322, and didn't get it by mistake. The 3322 is a SMT package with itty bitty pins. The MAX232 is sort of the "standard", but there are lots of clones and variants.

-j

It looks like you are really motivated to find a solution, so you probably will eventually get there.

Windows or Linux based software? If Linux, I suggest an attempt to create a process to intercept the communication each way, modify it and pass it along. The same is possible in Windows, but no knowledge or skills here.

The first and most important step is to obtain some sort of serial port monitor software and use it to monitor the attempts to communicate, both query and response. This will but you miles ahead and let you know what the challenges are, and how your attempts at a solution are working out. It will let you know what handshaking procedures you must contend with. It doesn't look like the channel is going to be overwhelmed with traffic, so you can probably side step the handshake issues with jumpers.

Eltima has some packages. their freeby teaser my be enough for our needs. It might be possible to create a virtual serial port for the software to connect to and process the data from the real serial port and pass it to the virtual port and visa versa.

Ask them

JC