How to enable USB-Serial Port adapter (RS-232) in Ubuntu Linux
|
|
Though some might argue that Serial port are things in the past, it is still the most popular port for those who are into electronic DIY. Building electronic device with serial port interface is cheaper than buiding one that uses USB. That is the reason why people still sell USB-Serial adapter to those electronic DIY enthusiast.
Here’s how to enable USB-Serial port adapter in Ubuntu Linux (with credit to Freeman from RepRap forum)
First plug in the USB-Serial Port adaptor to one of your USB port. Wait for a couple of second, then run “dmesg”. You should see these message at the end of dmesg output.
usb 1-1: new full speed USB device using uhci_and address 2
usb 1-1: configuration #1 chosen from 1 choice
After that, unplug the device and type “lsusb”. You will see a list of output similar to this.
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 007: ID 03f0:4f11 Hewlett-Packard
Bus 002 Device 006: ID 05e3:1205 Genesys Logic, Inc. Afilias Optical Mouse H3003
Bus 002 Device 004: ID 15d9:0a33
Plug in the USB-Serial Port converter back, and run “lsusb” again, and you shall see an additional line, like this.
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 007: ID 03f0:4f11 Hewlett-Packard
Bus 001 Device 002: ID 4348:5523 --- --- --- (notice the additional line!)
Bus 002 Device 006: ID 05e3:1205 Genesys Logic, Inc. Afilias Optical Mouse H3003
Bus 002 Device 004: ID 15d9:0a33
Now we know the vendor id and the product id of the USB-Serial Port converter, this will enable us to load the linux kernel module “usbserial” to activate the device, like this :
sudo modprobe usbserial vendor=0x4348 product=0x5523
Run “dmesg” again and you shall see lines similar like this :
usbserial_generic 1-1:1.0: generic converter detected
usb 1-1: generic converter now attached to ttyUSB0
usbcore: registered new interface driver usbserial_generic
As you can see, the new serial port device is mapped to /dev/ttyUSB0. You can instruct Ubuntu to load this module automatically by include the line : “usbserial vendor=0×4348 product=0×5523″ inside “/etc/modules” file.
Bonus: What application benefits from usb-serial port adaptor?
For starters, there are modems which uses RS-232 serial port. Some home-made devices includes Infrared remote control which uses LIRC which also depends on the serial port.
I use the adaptor to hook up my morse keyer in order to send morse code through the internet using Xchat CWIRC plugin. The site has an excellent circuit diagram to build such interface.
You can see my home-made morse code oscillator here : My Homemade Morse Code Practice Oscillator
Where can I get USB to Serial port converter?
You can get it from your local computer stores or order it online !
- TRENDnet USB to Serial Converter
- Cables Unlimted USB 2.0 to Serial DB9 Adapter
- Lighthouse USB to Serial Port Converter
- Sabrent SBT-USC6M Hi-Speed USB 2.0 to Serial (9-pin) DB-9 RS-232 Adapter Cable (BLUE)
Keep updated with this website! : Subscribe to your email
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
Recommended Reading
- FFMpeg based FLV to 3gp batch converter scripts
- How to Boot Linux from USB Drive
- How to : Dial-Up internet connection with Ubuntu
- How to convert OpenXML docx files to OpenDocument odf in Windows and vice versa
- How to Setup Skype USB Phone to use with Ekiga (under Ubuntu)
- Ubuntu 10.04 fix for USB Drive not mounting on pc with Floppy Drive



November 1st, 2008 at 2:35 am
“How to enable USB-Serial Port adapter (RS-232) in Ubuntu Linux” is very well written and enabled me (complete newcomer) to get COM2 recognised by the SeaClear.exe navigation program running under wine. Unfortunately the prog. is not receiving and NMEA input from my GPS, and any advice on what I should do next would be appreciated. Other problem – using nano I added the “usbserial vendor…” line to the “/etc/modules” file, but couldn’t work out how to save the addition. Could you help, please? Thanks a million.
December 31st, 2008 at 9:15 am
Perfect instructions to get my USB serial converter running.
Thanks
January 9th, 2009 at 8:27 am
Instructions were “spot-on” for install my Belkin USB/Serial adapter. Thank you!
January 17th, 2009 at 12:14 am
Great instruction, it did help me a lot. Thanks.
January 30th, 2009 at 6:02 am
Thanks very much… I really needed it… please some more of this fine tricks.. much appreciated.
April 3rd, 2009 at 4:18 am
Amazing info.
I was wondering if somebody could tell me how to map ttyusb# to a ttys# and make it persistant.
June 29th, 2009 at 10:11 pm
I was windering is any body knows how the ttyUSB0 is related to a com port or how to set
July 10th, 2009 at 7:43 pm
@Toby
I’m assuming your talking about under wine?
If so it’s very easy, add the following to wine.conf
[serialports]
Com1=/dev/ttyUSB0
Obviously you can change Com1 to 2 3 4 etc
July 22nd, 2009 at 3:12 am
newer versions of wine don’t have or use a wine.conf or winerc…
from the WineHQ site (http://www.winehq.org/docs/wineusr-guide/misc-things-to-configure), here’s how you do it:
ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com1
or…com2, com3, etc.
July 28th, 2009 at 3:58 pm
Thx for the intruction. I need it.
Gracias por la ayuda. La necesitaba.
October 1st, 2009 at 2:00 am
Thanks! Your clear instructions were easy to follow, and they work!
So what is the right way to make this happen on every boot?
October 1st, 2009 at 11:40 am
the correct way is written on the blog post, as follows:
“As you can see, the new serial port device is mapped to /dev/ttyUSB0. You can instruct Ubuntu to load this module automatically by include the line : “usbserial vendor=0×4348 product=0×5523? inside “/etc/modules” file.”
October 18th, 2009 at 6:23 am
Thank you very much!
What could be the substitute of ‘usbserial’ in ubuntu 9.04?
this module is no longer available from the command shell.
November 19th, 2009 at 1:43 am
George, usbserial is not supposed to be run from the command shell. rather, it should be included in the /etc/modules file, read the article slowly and carefully.
March 18th, 2010 at 10:24 am
thx dude, this kicks butt! I got my bit whacker up and running on ubuntu in no time flat thx 2 ur info.
http://www.schmalzhaus.com/UBW/index.html
March 28th, 2010 at 12:52 am
good job!!!
Thanks!! it’s very usefull…. :))
June 10th, 2010 at 12:15 pm
hope someone can help me – how can one statically assign usb serial so they map to the ttyUSBX everytime. i have 4 of these usb serial dongles and I have configured ser2net for specific tcp port to ttyUSBX (so i can telnet to the console of switches)… but once i restart PC; for eg usb serial dongle 1 which is ttyUSB0 may on next reboot may become ttyUSB1 and thus when i telnet to that port actually have consoled to another unit (as ser2net config file maps specific TCP port to ttyUSB). thanks for your help in advance.
September 3rd, 2010 at 2:49 am
I’m having trouble configuring arduinoBT
I tried to do the same steps that this site but I had no success.
obs: I’m using Ubuntu 4.10 LTS 32bits
and the following error appears:
ubuntu32bits@ubuntu32bits-laptop:~$ lsusb
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 003: ID 03eb:2104 Atmel Corp. AVR ISP mkII
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 03f0:3d17 Hewlett-Packard LaserJet P1005
Bus 002 Device 002: ID 5986:0137 Acer, Inc
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
command:sudo modprobe usbserial Atmel = 0x03eb RS232= 0×2104
FATAL: Error inserting usbserial (/lib/modules/2.6.32-24-generic/kernel/drivers/usb/serial/usbserial.ko): Unknown symbol in module, or unknown parameter (see dmesg)
dmesg
17308] usb 4-2: config 1 interface 0 altsetting 0 endpoint 0×82 is Bulk; changing to Interrupt
[ 297.317317] usb 4-2: config 1 interface 0 altsetting 0 endpoint 0×2 is Bulk; changing to Interrupt
[ 297.344460] usb 4-2: configuration #1 chosen from 1 choice
[ 1332.091589] usbserial: Unknown parameter `Atmel’
[ 1492.323389] usbserial: Unknown parameter `Atmel’
[ 1511.087014] usbserial: Unknown parameter `Atmel’
[ 1726.664078] usbserial: Unknown parameter `Atmel’
[ 1745.794821] usbserial: Unknown parameter `Atmel’
[ 1789.904073] usb 2-1: new high speed USB device using ehci_hcd and address 3
[ 1790.056180] usb 2-1: configuration #1 chosen from 1 choice