Go Down

Topic: Another Arduino + Serial Stepper Question (Read 403 times) previous topic - next topic

anchan

Hello,
I am having an awful time with such a simple thing.  If anyone can help, it would be so much appreciated.

I am using an Arduino Mega + this stepper drive:
http://www.automationdirect.com/adc/Shopping/Catalog/Motion_Control/Stepper_Systems/Stepper_Drives_-z-_Power/STP-DRV-80100

It's a really cool drive.  Just send serial, using their "SCL" syntax, and it just works. See page 9 of the manual for commands, and page 75 for basic setup.
http://www.automationdirect.com/static/manuals/surestepmanual/scl_manual.pdf.

I've used these drives all day with PLC's and no problem.  The drive also works just fine with the supplied setup application.  But with an Arduino, all I get after sending a command is a blinking light pattern indicating a COMM error.

My code starts off with:
void setup() { 
  Serial3.begin(9600);
some other non serial stuff here
}

and then on button press, initiates the following:
Serial3.print("FL20000\r");
I've tried all kinds of variations:
Serial3.println("FL20000");

Serial3.print("FL20000");
    delay(10);
     Serial3.print('\r');

Any suggestions?  I'm pretty sure I didn't cross the Rx and Tx.  I tried both ways several times, and I am clear on how that should work.  Thanks to anyone who responds.

PaulS

Quote
I'm pretty sure I didn't cross the Rx and Tx.

But you haven't told us what you have connected, where. You have connected grounds, right?

Are you using a MAX232 between the device and the Arduino? It looks to me like the device expects to be connected to a PC's serial port, which is NOT TTL serial, like the Arduino.

anchan


But you haven't told us what you have connected, where. You have connected grounds, right?


Ok, right.  Attached is my wiring diagram.  There is too much info on there, which is why I didn't post it. I also use a custom shield, so didn't want to confuse anyone. The serial pins connect directly to the stepper drive.   Definitely, all grounds are connected.

Anyway, the drive came with a special cable- DB9 on one side and RJ11 on the other to connect to the drive. I cut the cable (I have a few extras), and by doing a continuity test I determined which were tx and rx and gnd.  I confirmed this by doing another test with the RJ11 side, as indicated on page 75 of the SCL manual. I connected the tx, rx, and gnd from that cut cable directly to the arduino Serial3 pins D14 and D15.  I did this cable cut method to get the drive working with a PLC (as instructed by AutomationDirect) on several occasions, and worked like a charm. I used this PLC:
http://www.automationdirect.com/adc/Shopping/Catalog/Programmable_Controllers/CLICK_Series_PLCs_(Stackable_Micro_Brick)/PLC_Units/C0-01DR-D.

>>>>>>
Are you using a MAX232 between the device and the Arduino? It looks to me like the device expects to be connected to a PC's serial port, which is NOT TTL serial, like the Arduino.
<<<<<

I was of the understanding that an Arduino could communicated directly with a computer.  And if that is the case, I figured that the Arduino could connect directly to the stepper drive just as well.  I have the Arduino connected directly to the stepper drive, no MAX232 between.Thanks so much for replying to my question.  I've done a lot of hardware work, but I'm fairly light on serial communication protocols.

Here's some more info on the drive. 
http://www.automationdirect.com/static/manuals/surestepmanual/surestepdrive2_datasheet.pdf

PaulS

Quote
I was of the understanding that an Arduino could communicated directly with a computer.

It can. Through a serial to USB connection, NOT directly to a serial port.

Quote
And if that is the case, I figured that the Arduino could connect directly to the stepper drive just as well.

Then the stepper drive wouldn't have come with a DB9 connector. The DB9 connector is to connect directly to a serial port. Serial output is +/- 12 to 15V, inverted from TTL serial, which is 0 or 5V.

Quote
Here's some more info on the drive. 

Which says that it is a RS232 device (+/- 12 V), not a TTL device.

anchan

Well, I think you guys nailed it.  Thank you for responding, and I am glad I posted! I'll look around and see if I can find a TTL to 232 converter.  I see a bunch that work the other way around.  But I'll look for the correct one.  If you have one to recommend, let me know.
Thanks again.



Quote
I was of the understanding that an Arduino could communicated directly with a computer.

It can. Through a serial to USB connection, NOT directly to a serial port.

Quote
And if that is the case, I figured that the Arduino could connect directly to the stepper drive just as well.

Then the stepper drive wouldn't have come with a DB9 connector. The DB9 connector is to connect directly to a serial port. Serial output is +/- 12 to 15V, inverted from TTL serial, which is 0 or 5V.

Quote
Here's some more info on the drive. 

Which says that it is a RS232 device (+/- 12 V), not a TTL device.

PaulS

A MAX232 chip converts from RS232 to TTL and from TTL to RS232. That is needed if communication is to be 2 way.

Go Up