Welcome! Log In Create A New Profile

Advanced

Electronics and software combination questions

Posted by jmaeding 
Re: Electronics and software combination questions
September 12, 2013 02:45PM
@Johnrpm, following is the key section from my test sketch (with apologies for the layout - blame Gedit)

Basically the loop repeats until the time defined in moveTotalMicros expires and during that time it causes a motor to step at the intervals defined for each motor in rptInterval. All these values have been calculated on the PC such that, say, one motor will take 200 steps in the same time that another takes 47. This corresponds to one line of GCode.

At the end of each line another part of the program gets a new line from the serial buffer and then asks the PC to send another line while the first one is being executed.

...R

//=======================================
void motorDrive() {

		curMicros = micros();
	
		if (mMoves == 0) {
			Serial.print("StartMoveZ");
			mMoves = 1;
			startMoveMicros = curMicros;
			for (byte m = 0; m < motorCount; m++) { // for each of the motors
				motors[m].nxtInterval = curMicros + motors[m].rptInterval;
//				Serial.println(motors[m].nxtInterval);
			}
//			Serial.print("Z");
		}
		else {
//			mMoves++;
//			if (pcData.pcVars.cmdType == 'c') {
//				Serial.print(curMicros - startMoveMicros);
//				Serial.print("  ");
//				Serial.print(motors[0].nxtInterval);
//				Serial.print("Z");
//			}
		  for (byte m = 0; m < motorCount; m++) { // for each of the motors

		    // set the stepPin low if appropriate
		    if (motors[m].pulseHigh && curMicros >= motors[m].nxtLow) {	
		      digitalWrite(motors[m].stepPin, LOW);
		      motors[m].pulseHigh = false;
//		      msteps[m]++;
		    } //  if (micros() - motors[m].lastMicros

		    // is it time to step this motor
		    if ((curMicros >= motors[m].nxtInterval)) { // is it time to step this motor
		      // the PC will have figured out that this step won't happen
		      //   before the previous step is complete
//		      Serial.print("StepTimeZ");
		      digitalWrite(motors[m].stepPin, HIGH);
		      motors[m].pulseHigh = true;
		      motors[m].lastMicros = micros();
		      motors[m].nxtLow = motors[m].nxtInterval + pulseWidth; //motors[m].rptInterval / 2;
		      motors[m].nxtInterval += motors[m].rptInterval;
					msteps[m]++;
		    } // if (countVal % motors[m].rptInterval == 0)
		  } // for (byte m = 0;

		  if (curMicros - startMoveMicros > moveTotalMicros) { // i.e. this movement is complete
		  
		  	for (byte m = 0; m < motorCount; m++) { // for each of the motors
		  		digitalWrite(motors[m].stepPin, LOW);
		  		motors[m].pulseHigh = false;
		  	}
		  	
//		  	Serial.print("Movement CompleteZ");
//		  	Serial.print("MSTEPS ");
//		  	Serial.print(msteps[0]);
//		  	Serial.print(" ");
//		  	Serial.println(msteps[1]);
//		  	Serial.print("Curmicros1 ");
//		  	Serial.println(curMicros1);
//		  	Serial.println(scndMicros);
//		  	Serial.print(mMoves);
//		  	Serial.print("Z");
		  	countVal = 0;
		  	mMoves = 0;
		    countInProgress = false;
		    getLineFromPC();
		    Serial.print("Data requested after moveZ");
		  }
//    unsigned long endMicros = micros();
//    Serial.print("Move Loop ");
//    Serial.print(endMicros - startMicros);
//    Serial.print("Z");
	}
}

Re: Electronics and software combination questions
September 12, 2013 03:17PM
Can we get a look at the lathe that you're going to convert?


- akhlut

Just remember - Iterate, Iterate, Iterate!

[myhomelessmind.blogspot.com]
Re: Electronics and software combination questions
September 12, 2013 04:46PM
The lathe is one of these Chester Cobra Lathe which is a Sieg c1 in yellow paint.

I am using these stepper motors because they were the cheapest I could fine with enough torque.

I make no pretence that any of this is cutting edge stuff smiling smiley The lathe itself is an extravagance because I don't use it much and converting it to CNC and 3D printing is an even greater extravagance - but fun.

...R
Re: Electronics and software combination questions
September 12, 2013 05:03PM
I recently bought the chester champion v20, very nice, those motors may struggle a bit maybe,especialy if you want rapid moves, have you tested the code, with motors connected to the drive boards, or LED's.

Edit, although its a small lathe I would suggest a minimum of 2amp motors and drives to match, preferably bigger,
especialy on the saddle.

Edited 1 time(s). Last edit at 09/12/2013 05:07PM by johnrpm.


Random Precision
Re: Electronics and software combination questions
September 12, 2013 05:42PM
Robin2 Wrote:
-------------------------------------------------------
> I am using these
> [url=http://www.hobbytronics.co.uk/motor-control/s
> tepper-motors/stepper-motor]stepper motors[/url]
> because they were the cheapest I could fine with
> enough torque.

I am wondering how you decided those motors have enough torque?

> I make no pretence that any of this is cutting
> edge stuff smiling smiley

Hopefully the lathe does have a cutting edge... smiling smiley
Re: Electronics and software combination questions
September 13, 2013 03:55AM
I measured the torque needed to turn the screws and bought motors with more torque, and they work.

...R

bobc Wrote:

>
> I am wondering how you decided those motors have
> enough torque?
>
Re: Electronics and software combination questions
September 13, 2013 04:50AM
that seems odd, don't you want motors that can handle the torque at say 1000pps ( pulses per second) or higher? torque falls off quite quickly as speed of steps increase on a stepper.

Edited 2 time(s). Last edit at 09/13/2013 05:37AM by jamesdanielv.
Re: Electronics and software combination questions
September 13, 2013 12:05PM
The motors work fine at 600pps with a 12v supply. I haven't yet tried the motors powered by 24v and attached to the lathe. The controllers can take 30+v..

And I should have said that I couldn't find any advice about how to figure out the size of motor needed, so measuring the torque was the best I could think of.

...R

Edited 1 time(s). Last edit at 09/13/2013 12:23PM by Robin2.
Re: Electronics and software combination questions
September 16, 2013 11:35AM
Irish_Steve Wrote:
-------------------------------------------------------
> working out what a strange hex
> string really means when it comes out of a "black
> box" network driver can be incredibly frustrating,

Or the industrial machine error codes where you count the number of flashes and there is only a single LED for it.

1 General fault
......
35 Input sensor 2 fault
36 Failure on pump 2
and so on

As for GCode interpretation
GT2 pulley, 20 teeth pitch 2mm = 40mm per revolution
2.5 revolutions will equal 100mm travel
200 step motor * 16 micro steps * 2.5 = 8000 steps/second to get 100mm/sec travel
16,000 actually cause you need to turn the bit on and off for a step pulse
* 3 for each axis uses 48,000 instructions per second
Now going off a 8051 controller which is significantly older and slower then the current AVR
12Mhz at 12 steps per machine cycle gives 1,000,000 instructions per second
Decoding gcode text files is very basic
Re: Electronics and software combination questions
September 16, 2013 06:03PM
"8000 steps/second to get 100mm/sec travel" equates to 80 steps per mm.

My setup will have 200 steps per mm without microstepping - but obviously very much less than 100mm/sec.

...R
Re: Electronics and software combination questions
September 17, 2013 09:59AM
This is the same for use of the arduino. we are using a standard platform, that has had hundreds of thousands of man hours into its development and use.
Re: Electronics and software combination questions
September 17, 2013 01:37PM
micromelt Wrote:
-------------------------------------------------------
> This is the same for use of the arduino. we are
> using a standard platform, that has had hundreds
> of thousands of man hours into its development and
> use.


Sorry, I don't understand - perhaps because I am new to Reprap.

What do you mean by "this"?
Who are "we"?
What is the "standard platform"?

...R
Sorry, only registered users may post in this forum.

Click here to login