1

I am writing a software that runs on the PC that has a Arduino 2560 connected to it via USB. This PC needs to communicate with multiple devices through RS232.

Is it possible to use the Arduino's 4 UARTs to communicate with 4 different hardware that uses RS232 serial communication, using just 1 USB connection between the PC and the Arduino 2560?

The Arduino 2560 will basically act as an interface for 1 USB to talk to 4 RS232 devices.

  • Technically USB device can be composite device, say with 4 USB-CDC (or VCP - virtual comport) devices. Arduino Mega has no native USB, but it is possible to use V-USB library that emulates USB 1.1 device at physical layer using just 2 pins (hardware UART will not be used). But there are some issues: 1) it seems for 1 VCP device 3 endpoints are needed and V-USB can't provide that many, so likely library modification will be needed; 2) for Windows driver - not sure if it is possible to use standard VCP drivers for a such composite device – Flanker Aug 8 '16 at 17:34
  • @Flanker Looks like it will be easier to use a USB to four channel RS232 module and connect Arduino to one of the four RS232 channels. – Nyxynyx Aug 8 '16 at 20:06
  • You might look at the FT4232H, though who knows what that will be like software wise. – Chris Stratton Oct 7 '16 at 4:15
1

No, but it is possible to use 3 of them. The reason being that one of them is the connection to the computer.

The hard part is in the programming. You will need not only a suitable sketch on the Arduino (the easy part), but also some software on your computer that presents three COM ports to the operating system and forwards the data through to the Arduino in a suitably packeted format, and receive data back and sent it on to the right COM port. Depending on your operating system that may be a very easy task (on Linux and OS X) or a complete and utter nightmare (Windows).

|improve this answer|||||
1

In Arduino terms:

Serial will be committed to receiving data from the PC.

Connecting Serial1, Serial2, and Serial3 via RS232 will be easy.

Adding a 4th Software Serial (or NewSoft Serial or AltSoft Serial) via RS232 will also be straightforward. If you need high speeds for the 4th port, than a UART with SPI (or I2C) interface to the Mega might be a better idea.

The only tricky part is putting in some info in the data from the PC so the Mega can re-send it to the correct port.

|improve this answer|||||
  • Dang it, I need to remember to look at the dates of posts! – CrossRoads Mar 7 '18 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.