Adding a 2nd USB Serial Port to Arduino Uno

have been working with Arduino now for many years and recently purchased the Sparkfun USB Host Shield DEV-09947.

My goal is to use the 2nd USB Port to read the USB serial input coming from an external Victron battery monitor. I purchased a USB cable for that device. On the Uno I wish to retain D0/D1 for Serial Monitor debugging and monitoring so I do not want to use the Arduino's built in USB port.

I have interfaced several Victron solar devices to a host Windows computer via USB -- reading the various USB comX: ports and capturing the serial data broadcast by these solar devices, e.g., BMV-12, MPPT, etc.

Now I have a Victron device in a remote location that cannot be wired directly to the USB Hub on the computer.

I purchased the USB Host Shield to read the Victron Serial input on an Arduino Uno WiFi R2 and transmit it via UDP to the computer. I have coded UDP transmission routines successfully and they are working on a dozen or so other Arduino sensors in my project ... so no help needed there.

From the hardware perspective, I have studied the schematic of the shield. I am aware the SS, MOSI, MISO and SCLK lines from the Max3241E are brought into the Uno, but don't know how to use this information.

I have been researching this for a week or so and cannot figure out how to read the SF USB Host Shield serial input on the Arduino Uno. I have used SoftwareSerial in the past but need a shield with the second USB port. Is there a sample sketch I can look at? Or perhaps a different shield is needed.

and if i need USB on same board i take USB module:

Thanks Kolaha, will try this.

raspberyPI B+/2/3/4 has some USB ports, can collect & parse data and transmit to pc or broadcast own webpage or what ever

Why do you think you need a "shield"? Any USB-UART serial adapter will work with SoftwareSerial on the Uno. Don't try to go over 38400 Baud.

Please post a link to the device you wish to interface via USB.

@jremington True but it can't act as a host.

this devices working with 19200

The title of your post is "Adding a second USB Serial Port to Arduino Uno".

That has nothing to do with adding a USB Host Shield, so what is your real question?

Interfacing to: BMV-712 Smart - Victron Energy
Using cable: VE.Direct to USB interface - Victron Energy

I'm kind of married to the Uno since all my code and routines (UDP etc.) debugged, tested, debugged, and in production. I thought a USB shield was the way to go, plug in the shield, the USB cable and read the port. Minimize the soldering. Apparently that functionality not supported by the USB shield. Should I move to DB9 and a serial port interface or go with Koala's suggestion above? Thanks again for all your help.

I interfaced to 6 of these devices on a Windows USB hub and to be honest it wasn't rocket science. Opened the file and read the port:

  ComFile := CreateFile(DeviceName, GENERIC_READ or GENERIC_WRITE, 0, nil,    OPEN_EXISTING,
    FILE_ATTRIBUTE_NORMAL,
    0);
   if ComFile = INVALID_HANDLE_VALUE then
      MemoStatus.Lines.Add('   Comm Port Invalid handle')
   else
      MemoStatus.Lines.Add('   Comm Port Opened'); ...

I see now, thanks.

The plan is to use a special interface cable to convert the serial output of the BMV-712 to USB client device, then use a USB host shield to recover the serial output. To save some soldering.

Look at the XR20M1170 it is a I2C/SPI UART WITH 64-BYTE FIFO. That will do what you want.

Or the
SC16IS752 / SC16IS762
a Dual UART with I2C-bus/SPI interface, 64 bytes of transmit and receive FIFOs, IrDA SIR built-in support. For two extra serial ports on the Uno.

Thank you folks. Will give it a try...

On the PC I can read this device on the MS Serial Monitor, my own Delphi programs, and even using the Arduino IDE’s own Serial Monitor.
temp1

To try to resolve this issue, I purchased from Amazon: WWZMDiB FT232RL FTDI Mini USB to TTL Serial Converter Adapter Module 3.3V 5.5V FT232R Breakout FT232RL USB to Serial Mini USB to TTL Adapter Board for Arduino.

Hooked it up as follows: VCC -> 5V; GND -> Gnd; RX -> Pin D3; TX -> Pin D2; Used the following script to read the serial input from the BMV-712; Nada, nothing.

#include <SoftwareSerial.h>
// HiLetgo CP2102 USB 2.0 to TTL Module Serial Converter
// HiLetgo TxD (yellow) => Ard D2
// HiLetgo RxD (Orange) => Ard D3

SoftwareSerial mySerial(2, 3); //RS232 RX, TX

void setup()
{
    // Open serial communications and wait for port to open:
    Serial.begin(19200);
    while (!Serial) {
     ; // wait for serial port to connect. Needed for Native USB only
    }
 
    Serial.println("Goodnight moon!");
 
    // set the data rate for the SoftwareSerial port
    mySerial.begin(19200);
}
 
void loop() 
{
    char CharInput;
    String TestSentence = "";
    Serial.println("Checking Availability");
    while (mySerial.available()) {
       CharInput = mySerial.read();
       TestSentence += CharInput;
    }
    Serial.println(TestSentence);
    delay (1000);
}

Next I purchased: HiLetgo CP2102 USB 2.0 to TTL Module Serial Converter Adapter Module USB to TTL. Hooked it up as follows +5 -> 5V; GND -> Gnd; RX -> Pin D7; TX -> Pin D6; Same sketch as above except changed the softserial pins to 6,7. Nothing. Don’t know what I’m doing wrong.

Ok Mr. Remington now I understand your point "Can't act as a host". By "Host" I assume you mean DTE.

I will address this in hardware, build an interface circuit to the VE Direct Port to optoisolate and convert to 5V serial. Then software serial should do the job.

Will keep you posted on progress.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.