have the machine follow basic shapes, represented by the dotted coloured lines.
have the entire program run on a single board(uno, zero or due footprint) and a motor driver sheild on top or built into the board.
not realy relevent right now but, user wil supply input through touchscreen to tell machine what size and shape, and orentation. Squares and slots may be rotated up to 50degrees.
i have had a look at grbl, and am pretty impressed, but i think for what this machine has to do it is a bloated approach, and considering it uses x/y plane references, im not sure it would work to well for this approach.
a bit of background,
im no expert in maths, i usually let software figure stuff out for me.
while i have used 2 axis cnc machines, i have never gone into the g-code side of operation.
i have some questions some of the gurus may be able to answer for me.
may be the biggest project killer. in the attached picture teh biggest black box will house a magnet. is this going to interfere with an arduino.
where do i start with the math considering its not a simple x/y reference, and the desired location is the result of the 2 lead screws moving back and forth. (before anyone suggests an x/y coordinate machine would make the footprint to big).
order of operation
find centre point
account for rotation
account for shape type
things get a bit shady for me here, im not sure what to do next as far as how to store the positions into the arduino so the motors can act on it.
im not to concerned with tool offsets, other commands at the moment, just want to get the basic motion happenning.
but for reference,
some other commands that will come into it later, would be, adjust z axis, lead in, lead out, adjust start centre point, return to home.
any ideas welcome especailly to do with the math, and the order i should tackle this
i like that for a printer setup, you could make that fairly compact.
trouble is this machine wont be sitting on a bench, but be out in the field used my people who dont care because they dont have to spend money on tools. so it has to be compact and strong. and space is an issue so i think the original design is the way to go.
Any ideas where to start with the math for this??
Gcode is just a simple and convenient human-readable way of listing the moves that the tool should make. It is also a widely used system.
GRBL interprets Gcode and translates it into a series of X and Y (and Z) moves for stepper motors. AFAIK it assumes a physical machine like a regular router with linear axes at right angles to each other.
I suspect you machine has a very non-linear relationship between the movement of a lead screw and the movement of the tool so GRBL may not be able to cope. But that would not affect the instructions at the level of Gcode.
If you don't use GRBL you will have to write your own Gcode (or equivalent) interpreter. That is not especially difficult provided you know how your tool responds. Personally I would do the Gcode interpretation on a PC and just send the actual move data to the Arduino. That should greatly simplify the Arduino programming and make the interpreter easier to develop as well.
i couldnt see how to insert image, to be honest i didnt even know how to edit a post until just now.
definetly going to be running it through computer first to get machine movement correct. But final use will be enclosed in the machine itself. i dont think converting user input into machine code will be that hard, once te math is worked out.
ive been reading through grbl trying to figure out how it works, havent quite got my head around it yet. The whole macro thing (defines ) i havent used yet so a bit hard to trace.
Ive downloaded GrumpyMikes hole cutter sketch but havent had the time to go through it yet.
Im assuming both of you have gone through this process before from some of your posts.
i want to go down the road of write a simple version of grbl myself, just to learn if nothing else.
tell me if you think different,
order of operation,
define co-ordinate space
define centre point
define points in space (circle chords, square etc)
define speed/accel
convert to stepper movement
this is very basic but i want to get the order right before i get too carried away.
Grumpy Mike,
this would be an electromagnet, would this still apply?
joeblogs:
Im assuming both of you have gone through this process before from some of your posts.
I have written a Python program that interprets some Gcode codes and I have written a short Python program to control a small lathe based on movement data sent from the PC.
Personally I can't see any reason to interpret GCode on an Arduino - but then I am odd. I have never tried GRBL or tried to figure out its code.
rw950431:
The maths is non-trivial. My attempt below, probably has errors. There may be another way using trignometry but its unlikely to be any simpler
Both solutions of the quadratic are valid in this case. It corresponds to the linkage flicking to the "inside" position. (V-shaped instead of /-shaped) One of the practicalities of this will be setting up the software limits so that it can't do that flick. Then you will know which solution of the quadratic to choose.
I expect that this would not be difficult to program into an Arduino or PC to process the G-code.
Perhaps I should have used the word "useful" rather than "possible".
I was aware of what the other solution meant in terms of the position of the arms. Initially I thought that it was impossible to get to that position but I guess its possible that if you extend one of the lead-screws far enough out so that the 2 arms are in a straight line then start to reverse back the arms could bend back inwards instead of outwards and achieve the second solution. It would be 'unhelpful' to the proper operation if that were to happen though as the tool could come in contact with the lead-screws and the control software would be blissfully unaware. As you rightly say, limits need to be established to prevent this happening.
Its gnawing away at me that there is a simpler solution involving similar triangles but I just cant figure out how.
DrDiettrich,
inverse kinematics, had a quick look, and in my head this is the approach that was making more sense. it seems easier to figure out where you need to be and then get there, and because you arent there yet you can adjust accordingly etc. which i assume is what the planning part of grbl does.
i dont see the need for the use of g code at all, when the only user input is going to be (type=circle, size=50mm, offset= 3mm, rotation=4deg). from this the basic parameters are set, then its just a case of using something along the lines of brenshams? line algorithm.
i think there might be a simpler math formula as well (in the sense of arduino overhead).
might have a crack at writing something basic and stop thinking so much.
I have seen a 3D printer mechanism using a 3 dimensional version of your scheme that was controlled by an arduino so its possible. I suspect the arduino was just doing g-code interpretation and the real smarts were on the PC that compiles the CAD file into g-codes.
tip from DrDiettrich lead me to a simple solution to find position of lead screws for a given X.Y tool co-ordinate. Used CxC = AxA + BxB formula for triangles.
now just have to figure out how to draw shapes with math so the lead screws can follow the X,Y's,
and how to time it if anyone can give me a clue on this. ie do i use interrupts to update the X,Ys at a certain interval, depending on how long i want it to take to draw the shape.
// M0 Zero board
int X_range = 80; // total x movement
int Y_range = 80; // total y movement
int spacing = 50; // distance between lead screws
int offset = (X_range - spacing) * 0.5; // outside off X range to lead screw
int arm_length = 80; // fixed length pivot arm
int arm_length_const = (arm_length * arm_length); // fixed length pivot arm
int X_pos_left_lead = offset; // left lead screw x position
int X_pos_right_lead = (offset + spacing); // right lead screw x position
float X_pos = 0; // desired end effector
float Y_pos = 0; // desired end effector
float Y_pos_left_lead = 0; // left end effector
float Y_pos_right_lead = 0; // right end effector
int i = 0;
void leadScrew() {
float X_right_lead_abs = abs(X_pos - X_pos_left_lead);
float Y_right_lead_abs = abs(X_pos - X_pos_right_lead);
Y_pos_left_lead = Y_pos + sqrt(arm_length_const - (X_right_lead_abs * X_right_lead_abs));
Y_pos_right_lead = Y_pos + sqrt(arm_length_const - (Y_right_lead_abs * Y_right_lead_abs));
}
void setup() {
// Serial.begin(9600); // UNO
SerialUSB.begin(115200); // zero only
while (!SerialUSB) {
;
} // zero only
// calculate total length of cut
// calculate time needed for cut
// let program work out highest resolution program can run
}
void loop() {
while(i < 1) {
long Start;
long Finish;
Start = micros();
void leadScrew(); // 2 uSec to complete function
Finish = micros();
SerialUSB.println(Finish - Start);
i++;
}
}