Go Down

Topic: Interfacing Arduino with Allmotion EZ4Axis motor control board and RS485 (Read 1 time) previous topic - next topic

martellyer

Dear Community,

My team is trying to interface an Arduino Duemilanove with an AllMotion EZ4Axis motor control board http://www.allmotion.com/EZ4AXIS_data_sheet.pdf using an RS485 converter https://www.sparkfun.com/products/12965.

We are trying to control two Portescap Linear Actuators http://www.portescap.com/sites/default/files/20dam_k_specifications.pdf that are plugged in to the motor 1 and motor 2 terminals of the EZ 4Axis control board.

We currently have the RS485 connected to the AllMotion control board through the A and B ports on the H1 portion of the RS485.

We are unsure on how to use SoftwareSerial to send commands to the motors through these boards. We tried the code below but it failed to upload.

Could you help us figure out how to send commands to the motors using the Serial Software?




Code: [Select]
//this code is intended to send one motor to position 10000
#include <SoftwareSerial.h>

float leftpos = 0.0;//inializing vairable

SoftwareSerial serial(10,11);//sets rx, tx pins
void setup()
{ Serial.begin(9600);
}

void loop()
{     leftpos = 10000.0;  // desired motor position
     serial.print(leftpos); //send desired motor position through tx port
}

PaulS

Quote
We tried the code below but it failed to upload.
Some evidence and clarification is needed. You clicked Upload, and something happened. Step by step, what happened?
The art of getting good answers lies in asking good questions.

AChap

When uploaded arduino reported the following errors:  not in sync: resp-0xf8 then stk500_recv(): programmer is not responding.
It was then unable to upload the code.

We have tried some of the suggestions we found on the internet such as resetting and powering the arduino board using 9V. Without the RS485 shield it uploads fine.

Both help with this error as well as information about using the serial software correctly would be great!

Just to clarify we are using windows 8.1 and arduino 1.6.2

AChap

I am from the same research team. After doing some research here is the new code we tried which solved the uploading problem however we are still unsure if the ASCII commands are being given to the linear actuator correctly. (The ASCII code it self is correct it just may not being sent in the right format)

The motors are fully contracted before running the code. The fully contracted position is what we set to be absolute position 0.

Code: [Select]

//this code is intended to send both motors to absolute position 10000
char pos= '/1A0,0,0,0R'; //initializing variable

void setup()
{ Serial.begin(9600);
}

void loop()
{     pos ='/1A10000,10000,0,0R' ;  // desired motor position
      Serial.write(pos); //send desired linear actuator position through tx port
}

We have also tried sending commands using serial software through digital pins 2 and 3 using the following code:

Code: [Select]

//this code is intended to send both motors to absolute position 10000
#include <SoftwareSerial.h>
char pos= '/1A0,0,0,0R';//inializing vairable

SoftwareSerial mySerial(2,3);
void setup()
{ Serial.begin(9600);
}

void loop()
{     pos ='/1A10000,10000,0,0R';  // desired motor position
      mySerial.write(pos); //send desired linear actuator position through tx port
}


Each time we use an oscilloscope on the A and B outputs of the RS485 and find approximately 1.5 and 3V peak to peak sinusoidal output. (We are unsure if this is the desired output). The connection of the RS485 to the EZ4AXIS board does not appear to be an issue. However, when we scope the inputs to the linear actuators we see a constant 9V going into the A+ and B- connections and 0V into the others. 

mahoma


PaulS

Code: [Select]
char pos= '/1A0,0,0,0R';
Which ONE key did you press to get the ONE character in the single quotes?

@mahoma:
Pretend that we can't see the hardware you have (because we can't), that we can't see your code (because we can't), that we have no idea what the code does (because we don't), and that we have no idea what you expect it to do (because we don't). Tacking onto a post where the OP never bothered to answer the questions posed is NOT a good idea. Especially when all you say is "I have the same problem".
The art of getting good answers lies in asking good questions.

mahoma

@PaulS:

Thanks for your response. People who act are the ones who make the difference.

I have used motor drivers before but  never EZ4axis and this is the only thread that talks about it.

I am wondering if the serial communication between Arduino and Ez4axis possible.

Thanks

PaulS

Quote
I have used motor drivers before but  never EZ4axis
At least you know what a EZ4axis is. If you post a link, maybe we can learn what it is, too, and be in a position to help.

Quote
I am wondering if the serial communication between Arduino and Ez4axis possible.
Serial communication is possible. Whether that thing, whatever it is, speaks the same language as the Arduino is another matter.
The art of getting good answers lies in asking good questions.

Go Up