I want to communicate between my Raspberry Pi and Arduino via Serial line (UART). Why? The RPI cost less than a Arduino Ethernet Shield and has more power. And because I can…
The main problem is, the RPI operates at 3.3V while Arduino operate at 5V. So you cannot connect the two devices together without voltage level shifter, right? Wrong! Seeedstudio’s Arduino clone Seeeduino can switch between 5V and 3.3V IO voltage, so you don’t need a voltage level shifter.
There are two options how to connect the two devices:
- Arduino USB connector
- UART
I dont want to use the USB option, because it adds the USB latency.
Perpare the RPI
I use the 2012-12-16-wheezy-raspbian image on my Model B RPI with 512mb.
This image use the UART port as a serial console. As I want to control the serial port myself I want to get rid of the serial console. Edit the file /boot/cmdline.txt and remove those
1 | console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 |
entries. Now open the file /etc/inittab and comment out the following line:
1 | T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100 |
Credit for this procedure: http://www.irrational.net. Now connect the GPIO line 14 (TX) and 15 (RX) and fire up minicom:
1 | minicom -b 115200 -o -D /dev/ttyAMA0 |
To verify everything works fine, just type some characters into the terminal and the should them in the terminal.
As next step, install the tool ser2net a “Serial to Network Proxy”. The RPI contains an old release of ser2net, so I compiled the latest version (v2.8-rc3) myself (./configure && make && make install). The config file of ser2net contains:
1 | 5333:raw:500:/dev/ttyAMA0:115200 8DATABITS NONE 1STOPBIT |
Listen on port 5333, disconnect TCP session after 500s inactivity.
The init script didn’t work, so I started ser2net manually:
1 2 | $ sudo ser2net -n -d Error on line 1, Unable to create TCP socket |
I did some research and found out, that this might be a code error. I inserted the IPv6 module
1 | $ sudo modprobe ipv6 |
and ser2net worked! I also reported the bug to the ser2net project.
Edit 30.01.2013:
The ser2net bug is already fixed in the head version (or any version older than version 2.8-rc3).
Connect Arduino and Raspberry Pi
I connected 4 Cables between the two devices:
1 2 3 4 5 | RPI Arduino 5V (Pin 2) 5V GND (Pin 6) GND TX (Pin 8) RX RX (Pin 10) TX |
So I power the Arduino with the RPI.

The next steps are, performance calculations! Have fun!




[...] I want to communicate between my Raspberry Pi and Arduino via Serial line (UART). Why? The RPI cost less than a Arduino Ethernet Shield and has more power. And because I can… The main problem… [...]
Hi,
I connected a real arduino uno like you connected yours (Only I added a level shifter). I did this before I read your post.
But I see I only get 3.8v from the 5v pins on the raspberry pi. (265mb model)
I hope that this will not destroys my plans. But I wonder if this is normal for the pi? and do you think this is a problem?
[...] I want to communicate between my Raspberry Pi and Arduino via Serial line (UART). Why? The RPI cost less than a Arduino Ethernet Shield and has more power. And because I can… The main problem is,… [...]
Hey,
I’m working on a project now in which I connect a Ublox to the raspberry pi and send the GPS data to a server. The problem I’m having is reading the serial data being sent from the Ublox to the RPI. I already freed up the UART port but when I tried checking to see if it was working it gave me an error saying ” -bash minicom: command not found”.
If you have any tips or tricks it would be greatly appreciated. Right now I only want to make sure the UART port is working but after I need to write a python script that reads the Ublox data, deciphers It and send it off to a server.
Best,
Daniel
so, why don’t you install minicom (sudo apt-get install minicom)?
In this line I see that minicom fires up the mini comm and 115200 is the baudrate but what is the -b -o -D?
minicom -b 115200 -o -D /dev/ttyAMA0
well “man minicom” would be an appropriate search term… see http://linux.die.net/man/1/minicom.