Low Cost DIY DC MOTORS CNC

Hi,

I've been working in a project for a low cost CNC using simple DC Motors.

At the moment i managed to do motion control part of the project using arduino's PID library, I can say that theres no overshoot in position although i'm not using motors full power(power is limited).

I'm now working/researching in 2 axis interpolated movement, found the bersengh...whatever algorithm but im not sure if thats the best approach.

There's a lot to be done and help would be welcome.

Java interface - I managed to communicate between arduino and a java application but the com's protocol can/must be improved

  • G-code interpreter is to be done (only g00 and g 01 for now). it would be taken in the java app and then sent to arduino in a simpler way
  • trajectory lines on java interface. (already started to mess with some java drawing api and doesnt seem too hard)

on the arduino side :

  • mainly the interpolated movement of the axis

Here some videos of what i've been doing (not edited and some of them are boring)

Colabs or suggestions are welcome and appreciated.

Please just don't ask me why wont i use stepper motors instead of DC.

Best regards,
Paulo J. Martins

where are you located?

Hi.

I'm in Portugal (Europe) if thats what u are asking.

Ok I'm in India so I can help/consult you software wise however I have experience in developing hardware too when things are very far from me but software would be easy if that is needed let me know.

Ok thanks for your reply.

i'm not there yet but i think that data flow control might be a problem.

i'm thinking that i could interpret the g-code in the java app instead of sending the g-code to arduino and interpret it, compute and only then, send for instance

x:100 ' to move x axis 100 points to left or
X:100 (notice the upper case) to move x axis 100 points to right (i'm using relative positioning by the way)

so
X100Y1000 would be interpolated trajectory

I'm using USB so i think i cant use the RS232(DB9) pins DRS DTR (maybe these are not correct i'm writing from memory) to control the data flow.
I cant send another command before it reaches the setpoint (at least more than the buffer can take).

in the arduino part im thinking about 2 ways i could do the interpolated moves (both axis must arrive at same time no matter what):

lets say i want to move x 100 points and y 50. the declive would be 1/2 for each 10 points of x axis, y axis should move 5.
so i could define a fast time interval in which i would verify if this condition is satisfied.

another way could be introduce another factor(lets call it DA) in the PID error expression output = (Kperror) + (Kiintegral) + (Kdderivative) + DA;
where DA would be like DA = (Kp1
delta) + (Ki1integral1) + (Kd1derivative1);
where delta is something like (X/Y -encoderX/encoderY) that should in the suggested case be 2; 'that would change considering whether x>y or y>x

Its the firs time i'm thinking about these problems...what are your thoughts about it?
I'm not an expert in programming, i learn while im doing things, as i go along. So if anyone thinks i'm out of the track please put me back on.

Best regards

i'm thinking that i could interpret the g-code in the Java app instead of sending the g-code to arduino and interpret it, compute and only then, send for instance

Yes please do the most of that processing where ever possible over the Java programmer in the computer because this is the best way to free up a lot flash, also doing the processing over Java app on your interfacing computer makes you process stuff fast.

for PID you can use the PID library and just tune those three elements of Kp, Ki and Kp or there is also a autotune suite backing this library.