[Solved] Raspberry Pi connection - more than 4 USB devices or USB HUB

Hey guys. I have 5 different devices that I want to connect to Raspberry Pi (eg. 5x Arduino). In configuration.yaml i need to type USB port like:

mysensors:
gateways:
- device: ‘/dev/ttyACM0’
- device: ‘/dev/ttyACM1’
- device: ‘/dev/ttyACM2’
- device: ‘/dev/ttyACM3’

Questions:
1.How to connect Arduinos when I have 5 of them? I need to extent one USB port by USB Hub? How to configure?

  1. How to create persistence for all USB devices. It means that, when the power line is down, USB numbers sometimes changes (eg 1 is switched to 2 and so on…) … :frowning:
  1. as far I know there is no configuration required. just plug in the hub and plug the usb stuff into the hub and everything should work. At least that’s how my old RPi 2b worked.

  2. I personally use udev rules but there are other ways to do it.

Start by finding the info on the usb device:

ls -l /dev/serial/by-id

that will give you the id of the USB devices attached and their /dev/ location.

then using the /dev/ location of the desired USB device:

udevadm info -a -n /dev/ttyACM0

Replace ‘ttyACM0’ with the /dev/ of your USB device

I then modify the file etc/udev/rules.d/99-com.rules (or create one if it doesn’t exist) by adding the following lines using the info you found in the above command:

SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyUSB-ZStick-5G"

SUBSYSTEM=="tty", ATTRS{interface}=="HubZ ZigBee Com Port", SYMLINK+="zigbee"

Note: the above contains info for two USB devices. I found it was best to use the {interface} for the zigbee controller since that controller contains two USB radio’s in one device with the same product and vendor info. I just wanted to point out that you can define the devices in a few ways.

You make the symlink section whatever you want it to be. That is the persistent part. After you restart you can reference the USB devices using that /dev/.

Thank you I’ve managed this so far with the info:
ls -l /dev/serial/by-id`
Then in configuration.yaml I used my full Arduino USB name. Right now I have the following:

mysensors:
gateways:
## ARDUINO1
#- device: ‘/dev/ttyACM0’ # OLD PART COMMENTED
- device: ‘/dev/serial/by-id/usb-Arduino__www.arduino.cc__0042_55737313231351618140-if00’
persistence_file: ‘path/mysensors.json’ # NEW PART

and so on…