Arduino to Smart Mo...
 
Notifications
Clear all

Arduino to Smart Motor

3 Posts
1 Users
0 Reactions
12.3 K Views
(@Tetsuya)
Posts: 3
New Member Guest
Topic starter
 

Hello,
I have a question though about controlling Animatics Smart Motors.

I normally use SMI program's macro function to send:
"
MP
A=10
V=180384
D=-40320000
G
"
Now I'm trying to use an Arduino board to send the same command so I can eliminate the need for the computer.

Setup is:
I'm sending simple ascii commands on the P4 RS232 board from moderndevice.com to a single smart motor with no program currently loaded on the motor.

Problem:
In the smart motor program I can see in the serial analyzer HEX view that it sends an 80 immediately one time before it sends the rest of my ascii commands.
I think that the 80 is to address the motor or tell it to listen to the following commands. (I see CH0,N,8,1 at the top of the terminal).
When sending commands from the terminal in the smart motor program it does not have the 0A or 0D line feed/Carriage return which shows up in HEX view when I hook up my arduino to the computer.

I'm not sure if I have an issue with slave/host modes in RS232.

My code I'm sending is:

void prerun(){
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
Serial.println("0ECHO_OFF");
Serial.println("0SADDR1");
Serial.println("1ECHO");
Serial.println("1SLEEP");
Serial.println("0SADDR2");
Serial.println("2ECHO");
Serial.println("2SLEEP");
Serial.println("0SADRR3");
Serial.println("3ECHO");
Serial.println("0WAKE");
Serial.println("MP ");
Serial.println("A=30 ");
Serial.println("V=330000 ");
Serial.println("D=-6000000 ");
Serial.println("G ");
changeTime = millis();

delay(300000);{
mainrun();
}
}
It looks the same as the macros I typically send with SMI when viewed in an ascii terminal like PUTTY
Thanks for any advice

I can send a screenshot of the output if needed.

 
Posted : 16/03/2012 4:55 am
(@csearcy)
Posts: 316
Reputable Member Guest
 

The Hex 80 (0x80) is a global address for all motors. Hex 81 is the address for motor1... Hex 82 is the address for motor2... etc.

All commands must be terminated with either a SPACE (Hex 20) or a CR (Hex 0D).
Note: the Line Feed character (Hex 0A) is not allowed.

 
Posted : 27/03/2012 7:56 am
(@Tetsuya)
Posts: 3
New Member Guest
Topic starter
 

I found it worked without addressing
simply sent:

MP
A=30
V=45096
D=-100000
G

All worked well the Serial board I bought had a mistake in the diagram so I had TX connected to TX.
I'm going to be trying to request torque "RT" and attempt to display min max torque on an LCD next.

Thanks for your reply Csearchy.

 
Posted : 27/03/2012 2:46 pm
Share: