Welcome, Guest
Username: Password: Remember me
Messages posted to this category need to be reviewed by the moderator before it gets posted.

TOPIC: Arduino to Smart Motor

Arduino to Smart Motor 6 years 5 months ago #451

  • Tetsuya
  • Tetsuya's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
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.
The administrator has disabled public write access.

Re: Arduino to Smart Motor 6 years 4 months ago #464

  • csearcy
  • csearcy's Avatar
  • OFFLINE
  • Moderator
  • Posts: 459
  • Thank you received: 77
  • Karma: 23
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.
The administrator has disabled public write access.
The following user(s) said Thank You: Tetsuya

Re: Arduino to Smart Motor 6 years 4 months ago #465

  • Tetsuya
  • Tetsuya's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
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.
The administrator has disabled public write access.
Moderators: hsummer, csearcy
Time to create page: 0.242 seconds
Powered by Kunena Forum