Using the Raspberry Pi’s serial port

DB-25Yes, that is a DB-25 plug I found in a box of old stuff. Anyway, I wanted to connect a GPS via a serial interface to a Raspberry Pi. Somehow it had escaped my attention that there is a handy serial port available on the Pi’s connector – I had been wondering what /dev/ttyAMA0 was!

There is a problem though. By default Raspbian configures /dev/ttyAMA0 as a console port (it starts a shell on it). raspi-config has a Serial option on its Advanced Options menu that allows this to be turned off (needs a reboot to kick in however). Then it should work fine. It’s very handy having screen installed:

sudo apt-get install screen

as it can be used to check serial port operation very easily:

screen /dev/ttyAMA0 9600

was what I needed for the GPS running at 9600 baud for example.

On some systems, it’s also necessary to add the user to the dialout group. To check the current user’s groups enter:


If dialout isn’t one of them, do one of the following:

sudo adduser <username> dialout


sudo usermod -a -G dialout

Both seem to do the same thing. Log out and log in again to kick in the group membership.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.