0

I wonder how to manage data from a lab device to my computer. Lab device has a RS232 serial port, but I can't connect it directly to my laptop with Ubuntu 22.04 so I need to figure it out how to handle it. I have already a kind of RS232 converter, like this one that I can connect to the laptop. Rs232 converter

so, let's say I can connect both devices. I know that my lab device communicates using ASTM to 9600 bauds, how can I connect it and record data to a file in a simple way?

9
  • 3
    You probably need a proper serial to ethernet converter such as uk.rs-online.com/web/p/serial-device-servers/1775510 the thing you have is likely to be just wiring for some special connection or device and does nothing to allow your computer to connect to it.
    – Mokubai
    Apr 18 at 13:10
  • 1
    Piggy-backing on @Mokubai, a breadboard connector like the one in the link would be recommended, but not from that link since the minimum purchase is 10. Those types of small breadboard converters are usually going to be cheaper than the alternative industrial-type converter boxes. If cost is a factor, an RS232 to USB breadboard or cable could also be used (FTDI has the most reliable USB-TTL chips) via a serial interface in PuTTY (max USB cable length is limited to ~6ft)
    – JW0914
    Apr 18 at 14:00
  • I once did a very similar project to yours - getting an older medical device talking ASTM out of a serial port to a TCP based ASTM server. We ended up using a Lantronix product. I don't remember all the details but it had internal configuration to keep the ASTM frames and corresponding ACKs correct.
    – Mark
    Apr 18 at 21:31
  • 1
    RJ-45 is just a plug shape. It says nothing about what sort of signals are being sent. (It was originally designed for multi-line office telephone systems.)
    – Mark
    Apr 18 at 21:44
  • @JW0914 for up to USB 2.0 (and USB<->232 converters don't ned more than USB 1.x speeds) it's not ~6ft, it's exactly 5m (though some of this can get eaten internally especially for desktops with front ports) or ~ 16ft. This is a hard limit based on signal timings, but it's per segment so there are active 5m extension cables readily available. Longer extensions exist, and show up as hubs; they often use RJ45 connectors and Cat5 cables between the 2 ends.
    – Chris H
    Apr 19 at 12:16

3 Answers 3

6

Those plugs are most likely (hard to tell from a picture) Cisco console cable plugs. They convert a DB-9 serial interface to a RJ45 receptacle , but NOT for use with a regular network cable. (They also exist in a DB-25 version.)
They are intended to use with a Cisco console cable (that has a RJ45 plug on 1 end and a DB-9 on the other) or a roll-over cable (RJ45 plug on both ends, but different pin-out than a network cable).

A Cisco console cable + a plug like yours connected to the other end make together a serial 3-wire null-modem cable.
A roll-over cable with 2 of these plugs (on each end) also makes a 3-wire null-modem cable.

That may be all you need. Provided that your lab-device needs a 3-wire null-modem cable, which is the most common case.
But some require a straight cable and in some (rare) cases you need a 5-wire null-modem (or straight) cable.

As modern computers, especially laptops, typically don't have a DB-9 serial port anymore, you may also need a USB to serial converter plug.

For short: There are a lot of variables here. Without more details about the devices involved and the exact nature of your plugs I can't get any more specific.

1
  • a number of such passive adapters are made to be used with regular straight-through network cables (not roll-overs), exactly because those are rather more common
    – ilkkachu
    Apr 19 at 12:55
3

As Tonny wrote, that adapter is most likely a Cisco RJ45-to-DB9 converter, which is a purely passive adapter. The RJ45 side is not Ethernet, it's just RS232 on a different type of connector (Cisco devices used to have console ports with an RJ45 connector rather than the more common DB9 or DB25 connectors).

If you have an RS232 port on your laptop, then you just need a cable. While this was extremely common a couple of decades ago, nowadays I believe it's quite rare to find a laptop with an RS232 port.

So what you need instead is more likely an RS232-to-USB (aka serial-to-USB) converter/adapter.

Once you have that, you should have a new character device for the serial port somewhere in /dev (details may vary, but probably some kind of /dev/tty-something).

If you just want to capture the data from the serial port to a file, you can just cat /dev/serial_port_device_name >filename.

If you need to change serial port settings you can use stty but beware that you must keep the port open while you do it, otherwise the settings will reverse to defaults right away.

If you want something more foolproof, you can probably write a short script using the language of your choice, or they may be additional tools to manage that.

Alternatively there are devices with serial ports and Ethernet connections (you would then usually use telnet or netcat to connect to the serial ports and capture the data), but these would be more expensive, and only useful if you need to capture data from a larger distance.

2
  • "Cisco devices used to have console ports with an RJ45 connector" -- so what do they use nowadays then? I haven't seen any recent Cisco hardware, but I'd be very surprised if they'd use DE-9 connectors (let alone the huge DB-25) in the 2020's
    – ilkkachu
    Apr 19 at 12:56
  • @ilkkachu I haven’t seen one for ages so I wouldn’t know. And given the wide range of devices they sell, many coming from acquired companies, I wouldn’t be surprised if it was not consistent. Though the most probable thing IMHO is that if there are devices without the RJ45 console, either they completely removed the console port (only keeping remote management) or they switched to some kind of USB interface. Too lazy to go check…
    – jcaron
    Apr 19 at 13:16
0

On the computer side, which should be enough to set up comms, pins are typically:

  • 2: RxD
  • 3: TxD
  • 5: Gnd

Check the specs of the lab device for those 3 pins (RS232 pinout)

1
  • 3
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Apr 18 at 14:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .