Programming a Reliance cool Muscle Motor

Hi ,

I am trying to program my motor using RS-232 to move with the following parameters
speed , S = 20
Acceleration , A = 100
Position , P = 10000
The default resolution is 1000 pulses/revolution the motor will rotate 10 times.
The motor manual url : http://www.rpmechatronics.co.uk/assets/uploads/1286265057cool-muscle-manual.pdf

At the moment it does not work .
Please find my code below . I have also attached the manual to use the motor . I am using Dynamic Mode Command

void setup() {
  
   //Servo drive port setup
  
    //Delay a short ammount before opening the port
    delay(100);
   
    Serial.begin(19200);	// opens internal port for debug use, sets data rate to 19200 bps
    Serial.println("Hello !!!");
    Serial.println("Debug Serial port working OK");
    
    
     //Open Serial port for servo drive (RS-232)
    Serial2.begin(19200,SERIAL_8N1);
   
}

void loop() {
      
    Serial2.print("P=");
    Serial2.print(10000);
    
    Serial2.print("S=");
    Serial2.print(20);
    
    Serial2.print("A=");
    Serial2.print(100);
    
    Serial2.print("^");
  }

At the moment it does not work .

The code does something. Perhaps not exactly what you want, but it does something. Don't you think it important to describe that?

I'm not sure what your motor is going to make of this:

    Serial2.println("Servo RS232 Port Working OK");

Should it be sent to Serial instead?

How do you convert the Arduino's Serial TTL signal to RS232 levels? Do you have a MAX232 breakout board?

Hi Paul ,
The code does establish a RS232 communication with the motor . And I was able to move it using the below code :
Changing parameters in the below code didnt change the motor's behavior and I believe it is not correct.
Hence I am trying to debug the problem using the first code I had posted . Would this help you?

//Servo Parameters

//Positions used in the drive
int iPosHome = 0; //home / safe position
int iPosTip = 498; //Mode where a tip is performed and also the uMode
int iPosuMode = 502; //Mode where the uMode moves between to and the iPosTip


void setup() {
  
  
  
  //Servo drive port setup

        //Delay a short amount before opening the port
        delay(100);
       
        Serial.begin(9600);	// opens internal port for debug use, sets data rate to 9600 bps
        Serial.println("Hello Anish !");
        Serial.println("Debug Serial port working OK");
        
        
        
        //Open Serial port for servo drive
        Serial2.begin(19200,SERIAL_8N1);
    
}

void loop() {
            
            callReturnToHome();
            //send the positions to the drive
            SendPositionsToDrive();
}


void SendPositionsToDrive(){
     
      //send the drive positions to the servo drive
   Serial2.print("p1=");
   Serial2.println(iPosHome);
   
   Serial2.print("p2=");
   Serial2.println(iPosTip);
   
   Serial2.print("p3=");
   Serial2.println(iPosuMode);
    
  }
  
 void callReturnToHome(){
   
   //tells the servo motor to move back to the home position "0"
   Serial2.println("]");
   Serial2.println("[3");
 }

Hi johnwasser ,
Yes I have connected it using a max232 board and the motor does function . Although not the way I want it to .

@wildbill : Sorry , i meant to remove tht

Hi
I did find that when I did type

S=20
A=100
P=10000
^

in Hyperterminal it did work just as I wanted (i.e) motor does 10 revolutions

and when followed by

]
[3

the motor go back to home position

Do you think I have entered the values in properly in arduino

anishh2003:
S=20
A=100
P=10000
^
]
[3

In the arduino you are sending:

]
[3
p1=0
p2=498
p3=502

Why the many differences?

Hi John ,
The differences are because the one with S , A , P is used for dynamic programming and mostly a quick check to see if the motor is working .
Whereas p1 , p2 ,p3 is what I will be using later on once I get my motor working properly. (And its because this part is someone else code ) - this I will have to change based on the whether I can get the code with S,A,P working .

The differences are because the one with S , A , P is used for dynamic programming and mostly a quick check to see if the motor is working .
Whereas p1 , p2 ,p3 is what I will be using later on once I get my motor working properly.

Why? If the motor expects S, A, and/or P, why would you send it p1, p2, or p3?