Ask Your Question

rosserial Raspberry Pi AMA0

asked 2018-03-31 15:59:51 -0600

danielros gravatar image

updated 2018-03-31 17:33:01 -0600

jayess gravatar image

Dear all, i would like to use a raspberry pi 3 and a arduino compatible expansion shield which can be pluged on the GPIO header, so i would like to use the serial interface. If i do so and starting roscore and after that the node:

rosrun rosserial_python /dev/ttyAMA0

I'm getting an error message back. But if i use a FTDI converter and connect them with the USB interface of the RPI and starting the node:

rosrun rosserial_python /dev/ttyUSB0

again, everything is working great.

So what should i do to be able to use the UART/Serial Interface of the RPi?

Key Facts:

I would be very much appericate about every reply - Thanks a lot.

edit retag flag offensive close merge delete



I'm getting an error message back

Please update your question with a copy and paste of the error.

jayess gravatar image jayess  ( 2018-03-31 17:31:14 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-04-03 16:58:40 -0600

Mark Rose gravatar image

I don't run rosserial any more because of its high memory usage on the Arduino, but I have used it successfully connected both to USB and to the UART. It's important to have voltage level conversion on the receive line from the Arduino. The Arduino will output TTL-level voltage on that line (0-5V), while the RPi only wants 0-3.3V.

My current robot uses an A-Star board from Pololu, which plugs into the GPIO pins on the RPi. It has on-board level conversion wiring points, which I'm using, and it works fine as /dev/ttyAMA0.

Be aware that by default the serial ports are only accessible by root. If you are not running as root then you need to add your RPi user to the "dialout" group, which is the group of the TTY devices.

edit flag offensive delete link more


can you please elaborate on this? do I have to change something in the arduino code for this to work?

Nelle gravatar image Nelle  ( 2018-08-09 01:30:33 -0600 )edit

Most Arduino-ish devices are 5V, while the Pi runs on 3.3V. The Pi input pins cannot handle 5V, so to use the UART you have to do voltage level conversion in hardware using a voltage divider or off-the-shelf component like this level shifter from Pololu.

Mark Rose gravatar image Mark Rose  ( 2018-08-09 16:27:35 -0600 )edit

You don't have to change anything on the Arduino side except to ensure that rosserial uses the UART. I think you have to edit ArduinoHardware.h, as indicated in this rosserial_arduino tutorial.

Mark Rose gravatar image Mark Rose  ( 2018-08-09 16:31:16 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-03-31 15:09:27 -0600

Seen: 1,505 times

Last updated: Apr 03 '18