How to change COM port in Ubuntu for Arduino connection?

I have an application on my laptop, where I collect some information from UNO and where Arduino is connected via COM5 only. When I connect UNO to my laptop, system gives ttyACM0, which is COM1. But I need COM5, which should be ttyACM4 I suppose. So, question is: how can I change manually ttyACM0 to ttyACM4 when connect UNO to laptop in Ubuntu?

Why can't you just type in ttyACM4 ?

Your question does not make a lot of sense without knowing what PC software is using the serial port.

...R

Robin2:
Why can't you just type in ttyACM4 ?

Type in where?

inzheneher:
I have an application on my laptop, where I collect some information from UNO and where Arduino is connected via COM5 only. When I connect UNO to my laptop, system gives ttyACM0, which is COM1. But I need COM5, which should be ttyACM4 I suppose. So, question is: how can I change manually ttyACM0 to ttyACM4 when connect UNO to laptop in Ubuntu?

Makes no sense.

Why do you need ttyACM4?

With Linux Mint, the Arduino IDE picked ttyACM0. It works fine. End of story.

inzheneher:
Type in where?

That's why I wrote the second paragraph in Reply #1

You know all about this problem - we don't. You have to tell us.

...R

Problem: Sometimes gets bound to "/dev/ttyACM0", other times to "/dev/ttyACM4", script fail.

Solution: Persistent names for usb-serial devices, make persistent name as "/dev/ArduinoUno".

sonnyyu:
...
Write Udev rules by using ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", to get permanent device name like "/dev/arduino_A70063Yc"

http://playground.arduino.cc/Linux/Udev#.UyT9g_ldV8E

sonnyyu:
Solution: Persistent names for usb-serial devices, make persistent name as "/dev/ArduinoUno".

I don't think that will work if you plug 2 Unos into a PC at the same time. Or if you have a single Uno and remove it without closing the Serial Monitor and then re-insert it.

...R

If you have a single Uno and remove it without closing the Serial Monitor and then re-insert it

At Ubuntu (Linux) Udev will make sure device has persistent name, above situation is working fine.

I don't think that will work if you plug 2 Unos into a PC at the same time

Udev rule is base on idVendor and idProduct, since both Unos has same id and this method will fail.

However there are few workarounds:

Plan A: One Uno and one Mega, different idProduct will make Udev rule work.

Plan B: One Uno and one Uno clone, different idVendor will make Udev rule work.

Plan C: Programming USB-Serial IC's EEPROM, make IC chip has new idProduct.