USB native port - Serial connection


I am trying to establish connection between Arduino Due and another serial port device, so that Arduino Due would control this device without PC.

I have already established communication with this device with Matlab using this code:

function test_TEC
handles.TEC1.port = 'COM8';
handles.TEC1.con = serial(handles.TEC1.port);
    set(handles.TEC1.con,'DataBits', 8);
    set(handles.TEC1.con, 'InputBufferSize', 1024);
    set(handles.TEC1.con,'OutputBufferSize', 1024)

%Check for any error codes on TEC1
        status = status(1:end-4);
        if isempty(status)
            fprintf('TEC1: No connection.\n')
function val = getStatus(con)
val = fscanf(con,'%s')

function setFan1Mode(con, val)
command = strcat('$R16=',val)

Now I want that Arduino Due sends a command to this divice throug serial port, but I do not now how establish communication or how to send data to the divice correctly.

I used this code:

void setup() {

void loop() {
  String msg1 = "$S?"; // this is command to get status from divice.
  String msg2 = "";
  if (SerialUSB.available() > 0)
    while (SerialUSB.available() > 0)
      msg2 = char (;
  Serial.println(msg2); // Printing on PC Serial Monitor

I have also managed to send this commant to PC through USB Native port and also send data to Arduino with Serial monitor.

But when I am try to send command to external serial divice I do not get any answer.

For comunication I am using USB OTG converter from micro USB to USB type A and than a USB to RS232 converter.

I would be very thankful if someone could give me some advice.

SerialUSB.begin() only establishes a connection with a host PC. You want your Due to be the host. The standard Arduino USB Host library allows you to host mice and keyboards but nothing else.

I thought that someone had asked this question recently but I can't find the question or the answer. Googling for "Arduino Due USB serial host" doesn't return any useful information. There's probably a key word that I don't know.

If you just want a simple plug-and-play solution, it seems like the only answer I can find right now is a USB host shield

If you feel up to it, this would be a useful addition to the Arduino Playground.

Well, thank you for you explanation.

What if change serialUSB port for Serial port in pins 0 and 1? In that case I wanted to use MAX232 converter to RS232 port.

Will ther still be a problem with host divice or is this only for USB protocol.

I found a website where someone communicates over Serial communication between two Arduinos.

I think that comunication between Arduino and other Serial device (not PC) should be possible since it is a basic level of communication.

OK, that's a different question.

Yes, you can use any of the hardware serial on the Due to talk to another RS232 device, so long as you have the MAX232 chip as a level converter. Sometimes your device is "3.3V TTL serial" which means it is using low voltage and can be connected directly to the Due. 5V TTL serial can't be directly connected, so I would recommend you choose one of the 5V Arduino boards for that case.