USB Host Shield to USB to RS232 converter

Hi,

I would like to send ascii strings from arduino leonardo to a usb host shield to a (usb to RS232) converter and then to a laser which uses RS232. (I tried to use a RS232 shield, had no luck).

Prior to trying to communicate with the laser I want to make sure I have the strings sending from start to end ok, I will connect the devices in the following arrangement:

PC1 --> Arduino --> USB host --> USB to RS232 converter --> RS232 plug into PC2

I will use terminal programs at PC1 and PC2 to check that the communication is working.

To start this, I need to know how to use the USB host shield, it appears to be full of more advanced features. There are a lot of example codes for tasks other than what I am trying to do and they vary a lot between each example. If anyone is familiar with the USB host shield, could you please point me to the most relevant example.

Before you can point me in the right direction, I need to provide the hardware details:

  1. Arduino that I'm using is Leonard
  2. USB host shield is duinotech usb host shield https://www.jaycar.com.au/arduino-compatible-usb-host-expansion-board/p/XC4456
  3. Library that I am using: USB Host Shield Library 2.0 - Arduino Libraries
  4. USB to RS232 converter: https://www.jaycar.com.au/usb-to-db9m-rs-232-converter-1-5m/p/XC4834

So far I've plugged the shield into the leoardo and the USB to RS232 converter into the USB host shield. I then ran the "USB_desc" example provided in the library.
It provided back the following details about the attached USB to RS232 converter:

Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0200
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 08
Vendor ID: 0403
Product ID: 6001
Revision ID: 0600
Mfg.string index: 01
Prod.string index: 02
Serial number index: 03
Number of conf.: 01

Configuration descriptor:
Total length: 0020
Num.intf: 01
Conf.value: 01
Conf.string: 00
Attr.: A0
Max.pwr: 2D

Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 02

Endpoint descriptor:
Endpoint address: 81
Attr.: 02
Max.pkt size: 0040
Polling interval: 00

Endpoint descriptor:
Endpoint address: 02
Attr.: 02
Max.pkt size: 0040
Polling interval: 00

Addr:1(0.0.1)

Your help is greatly appreciated.
Thanks

What is the point for using the Arduino?

You can easily buy a USB-to-RS232 converter and communicate with the laser.

I want to have the laser setup in a remote or inaccessible location (No room for a laptop and someone won't be there every day to take a reading), the arduino will turn the laser on and off once per day, receive the reading from the laser and then send a txt msg using a 3G shield.

I've got the txt messages working with the 3G shield.

jockwr:
I want to have the laser setup in a remote or inaccessible location (No room for a laptop and someone won't be there every day to take a reading), the arduino will turn the laser on and off once per day, receive the reading from the laser and then send a txt msg using a 3G shield.

I've got the txt messages working with the 3G shield.

You connection diagram shows no 3G shield. How does it fit in the picture?

You connection diagram shows no 3G shield. How does it fit in the picture?

Hi,

It's really irrelevant to my original question. At the moment I just want to confirm that I can send ASCII strings from PC1 to PC2 through the usb host shield and usb to RS232 converter.

To do that I need to configure the USB host shield correctly and that's where I need guidance, I don't really know where to start or which example in the library to look at.

After I successfully send ASCII strings from PC1 to PC2 using the connection diagram mentioned in the original post will I start using the 3G shield.

One step at a time, first confirm I can send strings of text through from PC1 to PC2. Then we'll add/change the hardware to include laser and 3G sheild.

To any new readers, I still need help if you are able to assist.

Thanks,

Are you clear on UART to UART communication?
basically things like UART1_RX <---- UART2_TX, and UART1_TX -----> UART2_RX. On an Uno, UART1 is a USB bridge (the chip is the little sister of Leonardo's chip) and UART2 is the ATmega328. This crossover needs to happen for the two UART's to communicate.

If you have two Leonardo boards you may be able to program each with a USB/UART bridge firmware, and then crossover their UART lines to communicate from PC1_USB-Leo1_UART= RX/TX== crossover== TX/RX= Leo2_UART-PC2_USB.

RS-232 defines the voltage levels used, but the UARTS are just running at 5V so they are not RS-232. If the Leonardo UART output was given to an MAX232 chip then the levels become RS-232 (which I have not seen in years). The crossover can happen at the RS-232 levels also PC1_USB-Leo1_UART= RX/TX= MAX232== X@RS232== MAX232= TX/RX= Leo2_UART-PC2_USB, which is what a null modem cable use to do.

If you need an extra serial port for the laser, consider using software serial https://www.arduino.cc/en/Reference/SoftwareSerial. Or use a Mega or Due for extra hardware serial ports. You may need a Max232 and DB9 connector.

USB host is very complex and few people use it.