ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

rosserial Raspberry Pi AMA0

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

danielros gravatar image

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

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 serial_node.py /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 serial_node.py /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

Comments

Welcome!

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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Comments

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 -0500 )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 -0500 )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 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 1,882 times

Last updated: Apr 03 '18