Hi there fellow arduino users!
I am doing a project at university and have never used an arduino system before.
Basically I have the setup in the picture, the red board will have an extrusion nozzle attached.
I need the stepper motor attached to the acrylic tube to accelerate with const acceleration, effectively drawing extruded filament out of the nozzle faster and faster. Then I need the stepper motor on the top of the frame (attached to the extruder frame) to accelerate slowly, so the the plastic that is being extruded onto the acrylic tube doesn't overlap. Due to the time constraints on the project and my limited experience in coding, could someone point me in the right direction or give a skeleton code I could play with to get the acceleration right?
A stepper motor is driven by a series of step pulses. You are in full control of how much time elapses between pulses so you can design any acceleration regime that you require.
You may also find some useful stuff in the AccelStepper library. However it is not intended for closely coordinated movements between two motors - for example if you want motorA to make 87 steps in the same time that motorB make 472.
Robin2:
You may also find some useful stuff in the AccelStepper library. However it is not intended for closely coordinated movements between two motors - for example if you want motorA to make 87 steps in the same time that motorB make 472.
If you use the callback variant and write a Bresenham's line algorithm that is fully possible with very little effort
the sketch shows a simple x/y device. the one plane is linear, the second is rotary.
the rotary can be thought of as a flat plane, whose borders ajoin.
for a printer that neither adds nor removes material, the two planes can be considered theoretically flat.
is there some special reason that one has to rotate at a fixed rate ? it greatly complicates the other axis.
in the early days of a fax machines, one would put the document on a drum and the single point scanner would move to a point, then while the drum rotates, signal the bits on that (rotating)plane, then move to the next point, etc. the printer would do the exact same, but putting ink on the corresponding dots.
Unfortunately there is a special reason the acrylic tube rotates with a const acceleration.
The end out come is basically extruded filament that is essentially would around the acrylic tube at an increasing rate.
The theory behind the experiment is that when extruding plastic using other techniques (injection moulding etc) if you use a certain minimum shear rate, then the polymer structure becomes highly orientated in the form of a "shish kebab" structure. So the experiment should tell me the shear rate at which the polymer structure becomes orientated. I can then use this info to assess whether its feasible to obtain this orientation during an FDM print, if it is I can release the info to the online community on how to increase stiffness and strength greatly in FDM printed parts.
I've just got to get some code to work for the experiment first!
To all others, thanks for the links, I will be taking a look at those now and trying to figure something out.
nilton61:
If you use the callback variant and write a Bresenham's line algorithm that is fully possible with very little effort
Getting the steppers to work in a co-ordinated way is not difficult. However AFAIK the AccelStepper library does not facilitate that. See @mikem's comment here
No, the library does not facilitate that directly but since it provides a callback option you can run two synchronized motors with the same acceleration profile. Here is a example of what i mean. In this sketch two motors are stepped so that their step ratio y/x = 4/3
#include <Streaming.h>
#include <AccelStepper.h>
enum {xStep = 8, xDir, yStep, yDir};
AccelStepper stepper(forward, backward);//use callback option
//k=dY/dX sets angle of movement
int dX = 3;
int dY = 4;
long xPos;
long yPos;
long cValue = dX-dY;
unsigned long mark;
void setup(){
Serial.begin(115200);
for(int i = xStep; i <= yDir; i++) pinMode(i, OUTPUT);
stepper.setMaxSpeed(100);
stepper.setAcceleration(20);
stepper.moveTo(500);
mark = millis()+500;
Serial<<"started"<<endl;
}//setup()
void loop(){
// If at the end of travel go to the other end
if (stepper.distanceToGo() == 0) stepper.moveTo(-stepper.currentPosition());
stepper.run();
if(millis()>=mark){
Serial<<"x:"<<xPos<<" y:"<<yPos<<" ratio:"<<((double)yPos)/((double)xPos)<<endl;
mark += 500;
}//if(timemark)
}//loop()
void forward(){
digitalWrite(xDir, 1);//x-axle forward
digitalWrite(yDir, 1);//y-axle forward
pulsePin(yStep);
yPos++;
cValue += dX;
if(cValue>0){
pulsePin(xStep);
xPos++;
cValue -= dY;
}//if(cValue>0)
}//forward()
void backward(){
digitalWrite(xDir, 0);//x-axle reverse
digitalWrite(yDir, 1);//y-axle reverse
pulsePin(yStep);
yPos--;
cValue -= dX;
if(cValue<0){
pulsePin(xStep);
xPos--;
cValue += dY;
}//if(cValue>0)
}//backward()
void pulsePin(byte pin){
digitalWrite(pin, 1);
delayMicroseconds(1);
digitalWrite(pin, 0);
}//pulsePin()