Welcome, Guest
Messages posted to this category need to be reviewed by the moderator before it gets posted.
  • Page:
  • 1
  • 2

TOPIC: Sending commands through Arduino with RS232 Shield

Sending commands through Arduino with RS232 Shield 2 months 2 weeks ago #2371

Dear All,

I am trying to use arduino along with RS232 shield. Before using arduino along with rs232 shield, CLass5D style motors motor wire was connected through usb with laptop and send the "RPA " command using termite terminal to know the position of motors and it does work.

Next i used the following code to send the same command through arduino. The Tx light blinks but motor do not send back the data.

To check if the RS 232 is pushing the commands, the RS232 shield and usb from arduino was both connected to laptop. After uploading the sketch, the RS 232 does show the commands in the terminal with Tx blinking light.

The motors are not responding to the RPA command through RS232 shield? Is there any command i can use to know position of motor 1 only through RS232 command line?

Kindly find the follwing code and attached rs232 shield diagram.

#include <SoftwareSerial.h> //we have to include the SoftwareSerial library, or else we can't use it
#define rx 3 //define what pin rx is going to be
#define tx 2 //define what pin tx is going to be
SoftwareSerial mySerial (rx, tx); //3 is TX, 2 is RX
String m;
void setup()
{
pinMode(3, INPUT);
pinMode(2,OUTPUT);
Serial.begin(9600,SERIAL_8N1); // setup serial with computer
mySerial.begin(9600);
Serial.write("Sending the command RPA\r");
mySerial.write("RPA \r\n");
m=mySerial.readString();
Serial.println(m);

}
void loop()
{
//while(mySerial.available() > 0)
m=mySerial.readString();
Serial.print(m);
}
Attachments:
The administrator has disabled public write access.

Sending commands through Arduino with RS232 Shield 2 months 2 weeks ago #2372

  • mmeyer
  • mmeyer's Avatar
  • OFFLINE
  • Moderator
  • Posts: 19
  • Thank you received: 6
  • Karma: 1
Hello,

I believe your issue is in the formatting of the commands/characters sent. I have not used the termite terminal before, but my guess is that it has a built-in ASCII/hex converter, while Serial write in Arduino may not. If you open the Serial Sniffer (View > Serial Data Analyzer) in our SMI software, you will see that what is actually being sent to the motor is 52 50 41 20 when you issue "RPA". This is how you will want to communicate. I would check what's actually being sent/received if possible.
The administrator has disabled public write access.

Sending commands through Arduino with RS232 Shield 2 months 2 weeks ago #2373

Hello,
thanks for the quick reply, I tried using

mySerial.write("52 50 41 20 \r\n");

motor did not responded back, The Rx light on arduino did not blink at all.

Thanks and regards,
Amrinder Singh
The administrator has disabled public write access.

Sending commands through Arduino with RS232 Shield 2 months 2 weeks ago #2374

  • mmeyer
  • mmeyer's Avatar
  • OFFLINE
  • Moderator
  • Posts: 19
  • Thank you received: 6
  • Karma: 1
That would seem that Arduino handles serial writes correctly with ASCII characters. Perhaps the discrepancy is in the method of reading. Have you tried read() rather than readString()?
The administrator has disabled public write access.

Sending commands through Arduino with RS232 Shield 2 months 2 weeks ago #2375

I would not think so because i do not see flashing light on my Rx pin which means that motor never responded back. If the Rx light flashes and there is no data displayed that would prove that method of reading is wrong.

Tried the read() but it gave -1 which means that no data is available on the port.

When the motors are restarted, it shows some messages in the termite terminal window that lens are in home position. When motors are connected to RS232 shield, motors do not communicate (as Rx do not blinks).

How can i make sure that motors are communicating with the RS232 shield because so far i am not able to see any receiving data (flashing light on RS 232 shield Rx flashes with the incoming data) from motors.

Is there a arduino library available for class 5 animatic motors to know the position of only master or slave as RPA shows the position of both motors?
The administrator has disabled public write access.

Sending commands through Arduino with RS232 Shield 2 months 2 weeks ago #2376

  • swalters
  • swalters's Avatar
  • OFFLINE
  • Moderator
  • Posts: 13
  • Karma: 0
There is no library. Please consider using the serial.print() as opposed to the write functions and specifying the exact type data being sent.
Did you restart it?
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.288 seconds
Powered by Kunena Forum