Roboclaw to *Hardware Serial on Arduino Mega instead of Software Serial

General discussion of using Roboclaw motor controllers
Post Reply
jorchard
Posts: 6
Joined: Fri Mar 10, 2017 7:51 am
Roboclaw to *Hardware Serial on Arduino Mega instead of Software Serial

Post by jorchard »

Hello folks, I'm up two walls!

1. can someone please show me how to declare and initialize a hardware serial object? I want to use a direct connection from an Arduino Mega to the Roboclaw using Serial1, instead of software serial.

2. even when I attempt to upload the PackertSerialEncoderPosition example to an Arduino Mega which implements Software serial, I get the error below:
avrdude: Version 6.3, compiled on Dec 16 2016 at 13:33:19
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

Using Port : COM3
Using Programmer : wiring
Overriding Baud Rate : 115200
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

avrdude done. Thank you.

An error occurred while uploading the sketch

Thanks for any useful suggestions you can throw my way.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Roboclaw to *Hardware Serial on Arduino Mega instead of Software Serial

Post by Basicmicro Support »

1. The packetserialbareminimum example shows how to use a hardware serial port instead of the software serial port. If you are still unsure how to do it please call or email support@ionmc.com

2, This is a programming problem(eg a problem writing the code to the Arduino) and has nothing to do with the program itself. It appears you have a problem with your arduino hardware/cable or possibly power. You should contact arduino support(most likely their forums) to figure out what is going on.
jorchard
Posts: 6
Joined: Fri Mar 10, 2017 7:51 am
Re: Roboclaw to *Hardware Serial on Arduino Mega instead of Software Serial

Post by jorchard »

Thanks for the help! I'm in the clear now and have a little more to get going.
...

3. I can control a motor through the Roboclaw standard serial (from an Arduino Mega)..using simple ForwardM1...commands, BUT am yet to figure how to send a COMMAND that will result in a specific rotational distance like 30 degrees. I see I can move motor forward or backward, increase/decrease speed but can't seem to decipher the function behind the position control slider on the IonMotion software.

4. are the PID settings configured on IonMotion and saved on to the memory of Roboclaw board used when using simple serial? I find that the motor is not as responsive as I had tuned it to be on IonMotion. Any thoughts on this?

5. even when I set the mode of use to Packet Serial (on IonMotion), the Arduino Mega being used seems to receive NO data from the Roboclaw. Is my assumption that an Arduino and such micros cannot handle a full packet serial on their simple 2-pin serial connections?

Thanks again for your assistance!
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Roboclaw to *Hardware Serial on Arduino Mega instead of Software Serial

Post by Basicmicro Support »

3. You have to be using encoders and have tuned the PID settings to use the position command. Specifically you are looking to use M1AccelSpeedDeccelPosition, M2AccelSpeedDeccelPosition or MixedAccelSpeedDeccelPosition commands if you have tuned the position PID.
If you are using velocity only control you need to use the distance commands, but they have a catch if you are trying to use them to move and stop at a particular part. Here is a post that explains how to calculate distance for velocity commands.

http://forums.ionmc.com/viewtopic.php?f ... ulate#p158

Post Reply