Connecting to a Raspberry Pi via USB/TTL-Serial with Ubuntu Linux
One of the nice features of the Raspberry Pi are all the little pins, connecting something, exposing other things, …
Part of these GPIO ports are all ports necessary for a serial interface, although they are only low voltage (±3.3VDC) TTL signals whereas the „proper” serial port runs on ±5VDC. Additionally, there is also a pin where you can actually power the Raspberry Pi with 5V. :D
So why would you need that? Well, if you do not have a TV or spare monitor around (like for example in a Hackspace or Hosting Center), you will need different means to connect to your Pi. Us oldtimers can even remember the times when a serial port was the only way to connect to a machine. So we are going to use „the ancient ways” to connect our state of the art - no serial ports thanks to Mr. Steve Jobs - machines to the Pi.
So you are guessing that all you need on the hardware side is a converter to step the 3.3 Volts up to 5 Volts, and we are good to go, right? Right and wrong. If you want to talk with proper serial hardware like a Psion 5MX, then yes. There are already several converters available.
But if you just want to connect the Pi to a Computer/Laptop you can use a cheap USB to TTL Serial Cable (if you own a Hacklace, you probably already have one). Just connect it to the serial pins of the Raspberry Pi and the USB port of the computer and you can power the Pi via that cable and you get a „new” serial device on the computer which you can use to talk to the Pi. This will look like this:
On my Ubuntu 12.04 laptop, the connecting/connected device looks like this:
[ 12.633361] usbcore: registered new interface driver usbserial [ 12.633374] USB Serial support registered for generic [ 12.633425] usbcore: registered new interface driver usbserial_generic [ 12.633427] usbserial: USB Serial Driver core ... [ 12.668865] pl2303: Prolific PL2303 USB to serial adaptor driverm3@Sculley:~$ ls -l /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 Mär 1 22:11 /dev/ttyUSB0
Due to the security settings in Ubuntu Linux, a „normal” user is not allowed to access the serial ports directly. Although this in generally a good thing (never trust a user), it is not in your case. I mean, we know what we are doing, right? :D
In order to get us access to /dev/USB0, we have to add the user we are working with to the group „dialout” (yeah, the names are rather ancient). This is accomplished by
sudo adduser [the user you want to add] dialout
id -Gn
If the „id” command does not list „dialout”, you need to log off or reboot the machine for the change to take affect.
Once this is done, all that is left to do in order to connect to the Rapsberry Pi via the serial port, is to start „screen” with the right parameters:
screen /dev/ttyUSB0 115200
Just press
From here on, it should be obvious, what you can do. :D
Tagged as: howto, linux, raspberry, raspbian, screen, serial, terminal, ubuntu, usb | Author: Martin Leyrer
[Freitag, 20130301, 22:10 | permanent link | 0 Kommentar(e)
Comments are closed for this story.