Welcome! Log In Create A New Profile

Advanced

Arduino and commercial Breakout Board

Posted by Kvirre 
Arduino and commercial Breakout Board
May 08, 2011 04:52PM
Hi,

I have been working on an Arduino-based interface for a commercial Breakout Board complete with drivers.
(Commonly used with a real parallel-port and Mach3 SW)

During my work I have struggled to find the appropriate information, and I am now stuck ... =(
So I am hoping that my post is not out of topic for this forum, and that there could be a kind soul to help me out.

What I am trying to do:
Control the stepper drivers (CW230) through the DB25-port (parallel port - breakout board) using an Arduino UNO.

OBS.
I don't wish to run any G-code or nothing like that. I would only like to do a step forward and back.

What have I successfully done:
Connected the Arduino PIN's to the breakout board's parallel port.
Written a small test program, to step some steps of the engine.
.
..
// Move X - left [a]
if (incomingByte == 97) {
digitalWrite(dirPinX, LOW);
for (int i=1; i <= 500; i++){
digitalWrite(movePinX, LOW);
delayMicroseconds(spd);
digitalWrite(movePinX, HIGH);
delayMicroseconds(spd);
}
Serial.println("OK");
}
..
.

What is the problem?
Well, the engine moves .... but very slowly and not according to the iterations in the for loop.
i.e. one pulse (LOW>HIGH) does not correspond to one step?!

I actually get one turn, on 15000 pulses or so????

It seems like the drivers does not trigger on every pulse, but rather only a fraction of them?

Suspected issues:
1) The trigger levels are not set right
2) The stepper driver can_NOT be controlled in this simple manner? Since the standard setup with parallel port - Mach3
also sends control signals that I simply do not understand, and can't re-create?

----------------------------------------------------------------------------------------------------------------------------------

Here is the Hardware I am using (may or may not be useful info)
The breakout board is a BK-1 (or BK-3?) (Chinese product with very little information)
[smartautomation.en.alibaba.com]

Connected to 3 drivers (CW230)
[www.brundin.biz]

----------------------------------------------------------------------------------------------------------------------------------


Best Regards
//Martin
Re: Arduino and commercial Breakout Board
May 08, 2011 07:11PM
How are the driver boards configured in regards to microstepping? The board support 64 microsteps per full step, so 15000 steps per rotation is close to correct if the boards are configured for this (12800 would the the actual step count for a rotation at 64 microsteps assuming a 200 step/rotation motor).
Re: Arduino and commercial Breakout Board
May 09, 2011 02:54AM
Hmm,

You are quite right, it seems like this calculation is not a coincident?
But the driver is set on fullstep so there this should not be the issue.
I have also tried different step-levels, and it seems like the the driver itself compensates for that.

Meaning the same amount of pulses gives the same rotation, independent of the level om microstepping.
(Strange I would say, since one could assume that this would not be the case)

If I look in the CW230 driver specification, there is one section that deals with the pulses:
CP +、CP -:Stepping pulse input+5V (Rising edge effective , rising edge duration >10μS)

Could it be that the Arduino is to fast when switching logical level?

-------------------------------------------------------------------------------------------

I have tried to understand the way that Mach3 speaks to the drivers (the normal case) the DB25 port (parallel port)
to find my answer and found this:

"The "Signals"
The signal lines coming from the computer operate on 5V DC supplied by
the computer communication port, and is a square wave form called a
Transistor-to-Transistor Logic (TTL) signal. This signal is
essentially a series of small pulses from 0V to +5V that represent 0’s
and 1’s in a binary computer language. This signal is a form of a
Pulse-Width Modulated (PWM) signal where the length of the pulse is
varied to indicate information
. The width of the pulse determines the
binary code sent; either a “0” or a “1” as communicated by the
computer and interpreted by the motor driver. More on the signals may
be found in the signals page"


Ref: [www.cncroutersource.com]

It did not really help me, but may be someone out there could better understand the meaning of this.

Thanks again!
Re: Arduino and commercial Breakout Board
May 11, 2011 06:58AM
I am probably out of my depth here, but could it be that the pport signal is staying high long enough for the arduino to
read the pulse multiple times???, I would look at the signal with an oscilloscope if you have one, the pwm thing is news to me, I though it was just square pulses with variable mark space.


Random Precision
Re: Arduino and commercial Breakout Board
May 11, 2011 07:27AM
It could be that the Arduino can't sink 20ma to drive the opto couplers or because the reprap firmware outputs short pulses instead of 50/50 square waves on the step signal. Opto couplers tend to be slow.

Edited 1 time(s). Last edit at 05/11/2011 09:33AM by nophead.


[www.hydraraptor.blogspot.com]
Re: Arduino and commercial Breakout Board
May 11, 2011 08:51AM
You are quite right.

I tested with different pulse-lengths and it finally worked.
Tried different micro stepping lengths and allot of trail and error.
There is however the problem if you pulse to quickly, then the motor will "slip".

Finally I got something quite ok.
But, to go to higher speeds, I needed to accelerate the motors by gradually decreasing the pulse-length for each iteration.

Thanks
I know it has been a while, but could you post the arduino code you finally got working?
I am starting on the same app as you have done do you have any ode or notes that might help me?
Sorry, only registered users may post in this forum.

Click here to login