RS232 and
Instrumentation

As with all 'papers', the best foundation is a real-life case study. Here we refer to a situation where someone had a timer fed into a PC over a 23 metre cable. The comms between the PC and timer were, to say the least, very shaky.

Earthing:

It may appear strange to begin with earthing, but it is an area not understood by many as being an area where things usually go wrong.

Instruments, especially sensitive ones like temperature transmitters, do not appreciate any form of ground loop current. This usually develops with the PC being earthed as well as the instrument. The problem is they are often not on the same earth (unless right next to each other!).

On this installation the earth on the arrangement was broken and 5 volts AC found between the two grounds, yet when measured as current it only came to 1mA. The instrument was guaranteed to be earthed, the PC was stated as being on a 'dedicated supply'. This clearly indicated a ground problem, but not one that would cause a comms issue.

If there was a genuine 5V between the two grounds then the current would be extremely high (as the resistance on - in this cascase - a piece of 23m cable is but a few ohms max). What was happening is the instrument's ground was providing the one and only ground the computer got. It appeared the dedicated circuit may well have had a missing earth.

If ground currents are suspected as being a problem then, at each end of the cable, wrap the cable around one of these "clip together" transformer cores as a means to create what is called a "common mode choke". Also wind a few turns on a "clip on" ferrite core too. This stops any high frequency component from entering the data stream. Please note that there is no need to do this "right at the PC/device" which would have a large heavy object hanging off the back. If done where the cable is secured (such as floor level) is more than sufficient.


Cable Length:

The next issue was the 23m piece of cable. This could very well be where the problem existed. The cable is long enough that if not wired properly could cause trouble. Many people don't realize just how important it is to wire long runs of RS232 with twisted pairs, preferably each pair is shielded although an overall shield is still better than nothing and found to still work very well.

The way this is wired is each signal will use one 'leg' of the pair, the other is wired between the two grounds. The shield should be wired between the two casings on the connectors (as long as the connectors are all metal!)

The next issue is to consider how much data flows between the PC and the device. If not a lot then drop the baud rate. For every time the baud rate is cut by half, the possibility of corruption is cut by four!


Non-RS232 Drivers:

One last thing to be careful of. Some devices do not use proper RS232 drivers. Instead they either use optically coupled circuits that use power derived from the PC port, or use the output from a CMOS IC (the output is only 0V and 5V instead of the proper -12V and +12V). This drastically affects the output drive of the device which is then easily affected by things like long cables. It may be worthwhile measuring the TX of the device and whether it complies in some form to the RS232 specification.




| | Ask a Question |

© 29.06.02