[Solved]cant read back data from Roboclaw with packet serial

I am sending control commands just fine to the Roboclaw 2x5A from an Arduino Mega. I can get the motors to start, change speed and stop just fine with packet serial using the example code provided with the library called PacketSerialEncoderSpeed. The speeds and encoder values look fine in the Windows Roboclaw configuration software but not when reading back the values (like the encoder’s value) from the Roboclaw using 2-way serial from Arduino. I am using the example code provided with the library called PacketSerialEncoderSpeed. When I use a command like ReadEncM1, the valid parameter is only valid about 1 in 1000 times and even then I get a crazy large value like 6003453798787634 with the motors running slowly. It is like this for parameter I try to read from the Roboclaw. Writing all commands works just fine.

I need some help getting good parameter reads back from the Roboclaw please.

-Arduino Mega, serial pins connected to 15 and 14.
-I ran the Roboclaw setup program and set the modes to packet serial, 9600 baud.
-Successfully ran calibrations and saved.
-Windows config software says version 1.5 and I used it to update the firmware on the RoboClaw.

Solved both problems

#1) Not able to read data was solved by using this library which uses hardware UART instead of software serial.


#2) Junk 10 digit numbers were negative numbers that the unsigned integer variables in the example code could not handle. This is a bug in the example code someone should fix.


I am glad you were able to figure out the issue. Thanks for letting us know. If you have not already, you might also want to let the manufacturer, Ion Motion Control, know about the problems you had with the example code.

- Grant

The RoboClaw people (IonMotion) have updated their firmware, libraries and examples. They work with UART now.