Rosanswers logo

Hi all,

I have a problem with rosserial_arduino. The demo hello world program compiles fine in the arduino IDE.

#include <ros.h>
#include <std_msgs/String.h>

ros::NodeHandle  nh;

std_msgs::String str_msg;
ros::Publisher chatter("chatter", &str_msg);

char hello[13] = "hello world!";

void setup()

void loop()
  str_msg.data = hello;
  chatter.publish( &str_msg );

The problem that I have is that ros can't connect to the arduino.

When I run this "rosrun rosserial_python serial_node.py /dev/ttyACM0" I get the error:

[INFO] [WallTime: 1399983521.604184] ROS Serial Python Node
[INFO] [WallTime: 1399983521.617853] Connecting to /dev/ttyACM0 at 57600 baud
[ERROR] [WallTime: 1399983538.726124] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

When I run this "rosrun rosserial_server serial_node /dtyACM0" I get these messsages:

[ INFO] [1399983906.306684433]: Opening serial port.
[ INFO] [1399983906.306988104]: Starting session.
[ WARN] [1399983907.309690537]: Sync with device lost.

I also have added my user to the usergroups dialout and tty. That fixes the problem that I can access the port without admin(sudo) right.

I use this in combination with an Arduino Micro but it's the same as an Arduino Uno but then a bit smaller.

I hope you can help me with my problem.

Originally posted by Daniel_2210 on ROS Answers with karma: 166 on 2014-05-13

Post score: 3

Original comments

Comment by Daniel_2210 on 2014-05-20:
I have already reinstalled ROS now and that still didn't fixed it.


1 Answer 1


Rosanswers logo

I have fixed it. What you need to do is.

The "Hello World" example seems to be working fine. The only change you must to your Arduino code on Micro or just the normal one, I only have a Micro is to add

#define USE_USBCON

just before

#include <ros.h>

That's it.

Originally posted by Daniel_2210 with karma: 166 on 2014-05-21

This answer was ACCEPTED on the original site

Post score: 12

Original comments

Comment by JP_TCC on 2014-05-24:
Solved my problem! Thanks!

Comment by dmngu9 on 2015-06-30:
i dont understand the micro define usbcon that you mention. can please explain in more details?

Comment by ozsln on 2016-06-27:
I can confirm that this solution work in my case as well. My system is Ubuntu 14.04, ROS Indigo and Arduino Micro. I followed the tutorial @ http://wiki.ros.org/rosserial_arduino/Tutorials/Arduino%20IDE%20Setup

Comment by webvenky on 2016-07-12:
This works. Thank you.

Comment by kev1nnsays on 2016-07-17:
Found out why this works. See line 54 of Arduinohardware.h : http://docs.ros.org/jade/api/rosserial_arduino/html/ArduinoHardware_8h_source.html . We're suppose to specify the connection type associated with the hardware that rosserial is communicating with.

Comment by toddsampson on 2017-01-10:
Thanks! We were going nuts when we switched to Micro and started getting an unrelated error about version incompatibility between the ROS lib and rosserial.

Comment by Marc_B on 2020-08-30:
Wow, exactly the fix that I needed.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.