Programmatically In...
 
Notifications
Clear all

Programmatically Initializing Smart Motors on Power Up

5 Posts
1 Users
0 Reactions
6,086 Views
(@diglesia)
Posts: 2
New Member Guest
Topic starter
 

I currently have seven SMI motors daisy chained, all of which are communicating on RS232 and am looking for help on how to automate the initialization task programmatically. Functionally everything works as intended, however, on power up the motors all display the red LED. So far the only way to resolve this to green is to open the SmartMotor PlayGround and manually perform the following steps:

  • Connect Motor
  • Clear Flags
  • Disable Software Limits
  • Disable Hardware Limits (Left/Right)
  • Disconnect Motor
  • Connect Motor

At this point the LED is green and the motors function fine. I have tried globally addressing the motors and resetting the errors and disabling the software limits using several permutations/combinations of

0 UCI UDI Z Zr Zl Zs ZS SLD G

which works only if the motors seize (LED = red) during an operation. It does not work on initial power up. I would like to emulate what the SmartMotor Playground is sending to the motors without having to manually repeat this process each time. I am masters student and am passing my work on to the next generation of students, so I need to make it robust.

This post is similar to that posted by bknittel titled "RS232 Communication Lockup" three weeks ago. Using a 'serial sniffer' to catch the commands being sent to the motors. However, this doesn't seem like the right approach.

Any help would be much appreciated.

Duncan

 
Posted : 11/12/2015 3:48 pm
(@diglesia)
Posts: 0
New Member Guest
 

Since posting this question I had time to poke around and I found a solution to my question. I followed similar logic to what bknittel used in the post titled "RS232 Communication Lockup", by downloading a 'serial sniffer' (FREE Serial Analyzer) to catch the communication between the host computer and the smart motors on RS232. The following code resulted in correctly initializing the motors upon initial power up (along with my guess as to what it means):

0 MP A=500 A=500 P=0
UCI UDI SLD
ZS
END S
G

The first line sends a global address (0) to all the motors on the COMM line of interest and throws them into position mode (MP) with default acceleration (A=500) and position (P=0). Next, for my purposes I need to disable the software and hardware limits during operation, however when I clicked on either of the three check boxes in the SmartMotor Playground, it always sent them as a cluster of three commands that essentially acted as binary toggle states for the check boxes.

COMMAND DISABLED ENABLED
Software Limits SDL SDE
Hardware Left UDI UDM
Hardware Right UCI UDP

With the hardware and software limits disabled I then cleared all the flags on the motors (ZS) and sent a script terminator (END S) before pushing all commands to the motors (G). When I entered go (G) all motors toggled to green LED status.

Sorry for answering my own question on your forum but I hope this helps others who are having similar complications. I'm sure I overlooked something important so please reply and let me know how I could further improve this process.

Thanks,

Duncan

 
Posted : 11/12/2015 6:51 pm
(@diglesia)
Posts: 0
New Member Guest
 

Since posting this question I had time to poke around and I found a solution to my question. I followed similar logic to what bknittel used in the post titled "RS232 Communication Lockup", by downloading a 'serial sniffer' (FREE Serial Analyzer) to catch the communication between the host computer and the smart motors on RS232. The following code resulted in correctly initializing the motors upon initial power up (along with my guess as to what it means):

0 MP A=500 A=500 P=0
UCI UDI SLD
ZS
END S
G

The first line sends a global address (0) to all the motors on the COMM line of interest and throws them into position mode (MP) with default acceleration (A=500) and position (P=0). Next, for my purposes I need to disable the software and hardware limits during operation, however when I clicked on either of the three check boxes in the SmartMotor Playground, it always sent them as a cluster of three commands that essentially acted as binary toggle states for the check boxes.

COMMAND DISABLED ENABLED
Software Limits SLD SLE
Hardware Left UDI UDM
Hardware Right UCI UCP

With the hardware and software limits disabled I then cleared all the flags on the motors (ZS) and sent a script terminator (END S) before pushing all commands to the motors (G). When I entered go (G) all motors toggled to green LED status.

Sorry for answering my own question on your forum but I hope this helps others who are having similar complications. I'm sure I overlooked something important so please reply and let me know how I could further improve this process.

Thanks,

Duncan

 
Posted : 11/12/2015 8:14 pm
(@csearcy)
Posts: 66
Trusted Member Guest
 

The only other thing I can think of that the Playground and SMI do is the ECHO command. The default on power-up is ECHO_OFF.

 
Posted : 11/12/2015 8:23 pm
(@terminalcity)
Posts: 0
New Member Guest
 

I use an Arduino Mega to do this, which has a function to initialize the motor on startup. The Mega uses Serial port # 1, which is connected to a standard MAX232A type RS-232 interface chip, which is in turn connetced to the motor. Not sure if this will be of any help, but here's the code.

void initMotor() {                         
    Serial1.print(128);                 // global warning
    Serial1.println("WAKE Z");           // wake up gearhead
    delay(2);
    Serial1.write(128);
    Serial1.println("OCHN (RS2,0,N,9600,1,8,C)");    // just in case, open the RS232 control port
    delay(2);
    Serial1.write(128);
    Serial1.println("BAUD9600 TALK OFF ");         // set baud, talk, turn off servo
    delay(2);
    Serial1.write(128);
    Serial1.println("UCI UDI");                  //Confiugure limit switch inputs
    delay(2);
    Serial1.write(128);
    Serial1.println("MP");                      // set to position mode "MP"
    Serial1.println("AMPS=1000");               // limit motor to 100% current capacity 
    Serial.println("finished initializing motor...");
    delay(100);                        // wait a bit
  }
 
Posted : 04/01/2016 7:26 pm
Share: