ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Arduino zero rosserial tutorial

asked 2018-11-08 05:26:34 -0500

gab27 gravatar image

updated 2018-11-18 03:08:00 -0500


I have an arduino zero, connected to native port, Arduino IDE 1.8.7, Ubuntu 18.04 and ROS melodic.

I did the rossserial arduino tutorial Hello World, to publish something to a ros topic. link text

My commands:


separate terminal

rosrun rosserial_python  _port:=/dev/ttyACM0 _baud:=57600

The command window shows this:

[INFO] [1541675538.966820]: ROS Serial Python Node
[INFO] [1541675538.978137]: Connecting to /dev/ttyACM0 at 57600 baud
[INFO] [1541675541.090206]: Requesting topics...
[ERROR] [1541675556.094888]: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

If think I have tried nearly everything. deinstall and install it, switched the computer off and on, tried with multiple baudrates (it is not hardcode in the .ino file, since I use the file form the tutorial, checked the usb port, tried commands, #define USE_USBCON, ros::spinOnce(), tried to set the baudrate in the .ino file: nodehandle.getHardware()->setBaud(57600);

Nothing works and more surprisingly if I do the same procedure with an Arduino Uno it works. They should have the same architecture?

Does someone know where the mistake could be?


edit retag flag offensive close merge delete


I am having a very similar issue, but with Arduino Due (see issue link). Maybe the same cause? No solution found yet...

gaetanauvray gravatar image gaetanauvray  ( 2018-11-09 09:47:43 -0500 )edit

I try since two weeks and no solution in sight.. Could be that it is the similar issue, but I don't know. But after you push the reset button it works? not in my case.

gab27 gravatar image gab27  ( 2018-11-09 14:24:11 -0500 )edit

@gab27 Could you share the solution that worked for you, please. Im stuck exactly at the same issue on Ubuntu 20.04 and ROS noetic

gixsy gravatar image gixsy  ( 2022-04-19 16:16:22 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2020-11-15 22:27:07 -0500

Lin Zhao gravatar image

it's the problem in ArduinoHardware.h, check melodic version, it's fixed now after enable #define USE_USBCON

edit flag offensive delete link more


This worked for me! After looking everywhere for why I couldn't get it to work. I'm running an Adafruit Feather M0 Express, I think this fix should work for all SAMD boards.

haiben gravatar image haiben  ( 2022-02-25 13:26:02 -0500 )edit

This did not work for an Arduino Zero board!

gixsy gravatar image gixsy  ( 2022-04-19 16:14:45 -0500 )edit

answered 2018-11-12 23:28:32 -0500

Aviad gravatar image

Hi, check if there are some "Serial" (for example: Serial.begin) command in the arduino code. you can't communicate with both ros and serial. comment the Serial's commands and try again.

good luck

edit flag offensive delete link more

answered 2018-12-05 06:49:04 -0500

updated 2018-12-05 16:53:28 -0500

EDIT: I may have found it?

I find that the MKR Zero is expecting to communicate with ROS on its Serial1 object, which is exposed on Pins 13/14, rather than the Serial object exposed on the onboard USB connector. And, when I connect a USB/TTL cable to those pins, and launch with _port:=/dev/USB0, the demo code works as intended.

In troubleshooting, I looked at the library code in ros_lib/ArduinoHardware.h and added Serial.print() statements to my code to see which compiler directives are being executed. It appears that USBCON is #define'd and USE_USBCON is not. This logical combination compiles the statement "iostream=&Serial1". The resulting behavior is as I describe above.

= = = = This (below) was my previous answer = = = = Same problem here. If anyone has success, please share!

(I use the tutorial code as is; and it has no Serial.begin(). Thanks anyway for the suggestion!)

My hardware is the Arduino "MKR Zero", and the software environment is ROS Kinetic on Ubuntu 16.04LTS.

I, also, have demonstrated the tutorial code with the Arduino Uno as well as other Arduino variants. Of course, it is not strictly true that the Zero has "the same architecture" as the Uno. For example, you realize that the Arduino IDE must be -- and mine has been -- updated to handle the new "board type."

FWIW: I have other ROS 'sketches' which do run on the Uno, all of which fail on the Zero (with the same error type). I bought the Zero because the Uno's RAM was inadequate for any but the most trivial ROS functionality.

edit flag offensive delete link more

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-11-08 05:26:34 -0500

Seen: 1,517 times

Last updated: Dec 05 '18