15

!rant
Arduino CNC
Hey guys.
Since I mostly see frameworks to use with G-Code in Arduino CNCs I'm gonna make my own framework, where you don't need to know G-Code and the code is executed by Arduino code.
The code would include a template to define steppers steps and such.
Would include a library to work with different stepper shields.
Would this interest to anyone?

I'll provide a full example with stuff to learn for any amateur working with CNCs or that want to work with one. If you're not interested, thank you for reading, you can stop here.

Ex:
X(10);
Y(-5.5);
XY(6,7.5);
Z(-10);
This framework would only use incremental coordinates and will work for basic forms, drilling and such.

<Tutorial>
Coordinates.
Coordinates can be relative/incremental or absolute.
Lets say you have a square with 10mm, (top coordinates: (X=0,Y=0) to (X=10,Y=10).
think your drawing this square.
First line:
X0, Y0
Absolute: x10,y0
Relative: X+10
Second line:
A: x10,y10
R: Y+10
Third Line (...)
Absolute is a fixed point (coordinate)
Relative is a distance to move (not a coordinate but the distance and direction)
</Tutorial>

So, to cut a square with a TR10 (end mill with radius=5, diameter=10)

<code>
// You don't place + in positive values
// The tool always cut in the direction of the tool rotation, meaning on the left of the material.
Z(10); // Security Distance
XY(-5,0); //Compensate the diameter of the tool in radius
Z(-1); // Z=0 is the top of the block to mill, in this case. Z=0 can also be in the bottom
Y(15); //Second Point
X(15); // Third Point
Y(-15); // Forth point
X-15; // Fifth Point
(repeat)
</code>
Now we have a block with 1mm depth. If you use a while or for you can repeat the sequence for x=n passages, change the value to Z for the depth and your done.

Comments
  • 9
    // https://andyhemingway.files.wordpress.com/...
    calling_the_herd(Hardware)
    {
    User[ ] = { @Condor , @nightowl , @7400 , @LuxARTS , @Crowns , @mngr , @JoshBent, @BadCompany , @shellbug , @c3ypt1c, @devTea , @rEaL-jAsE , @sbiewald , @Gregozor2121 , @Haxk20 , @Cozyplanes , @S-Homles-MD , @ewpraten , @ganjaman , @MisterArie , @No-Flux-Given , @aritzh , @dev1410 , dev1410 , }
    }
    // If you want to me removed or changed to other category leave a reply
  • 2
    @GyroGearloose *@ewpratten

    Sounds worth the time!
    I always hated G-codes.
  • 2
    @PonySlaystation

    It's basically g-code in C and very basic functions.
    I will do it to test my CNCs, also it's great for repeating work (let's say I'm making wood pieces to sell).
    Best part, since it runs directly in Arduino, no lags.
  • 4
    Actually was thinking about doing something like this, gcode is complete overkill for say a drawing machine.

    We should work out details, ill write a vector->code transpiler.
  • 3
    Hmmm. Im hardware. Interesting well yeah its true but i fucking hope im in software group too. And also you can set up Android porting group and Doing crazy shit with tech group.
  • 2
    @ganjaman WOW your thinking way overhead...
    That would be perfect.
  • 2
    @Haxk20 Just Hardware and Linux, for now. :D Most of my projects are hardware based now anyway...
  • 1
    @ganjaman Btw where you from? I just good a very good polen...
  • 4
    @GyroGearloose Oh ok you are forgiven since im in the linux group. Good.
  • 4
    Also the project looks cool. But CNC isnt mine thing.
  • 1
    Well the group is for all hardware... Some might be interested, others may give advice and we all learn a little :D
  • 2
    Im from hungary and sadly still live here.

    Yeah, occured to me as i was scouring the web for gcode interpreters, found a somewhat usable one but the tooling was garbage. Wanna make a desktop app to send the data over serial as well. Also none of the ones i found support l9110 out of the box, wtf is up with that.
  • 2
    Seems interesting.
  • 2
    @ganjaman Well, my framework would have integration with serial (for use with Bluetooth for example), and with ganjaman's help, it can do more than basic shapes...
    Still, you would need gcode interpreter for detailed pieces, or lotssss of time.
  • 3
  • 2
    @devTea

    I've been thinking, why your name like that?
  • 5
    @c3ypt1c devtea? No reason I just loves tea, and using tea is too short, plus I’m on devs site so dev + tea. First time I used this username is on devrant
  • 3
    @devTea i kinda figured that might have been the case. Thanks for sharing though - it put my question to sleep. :) have a good night
  • 4
    I have been summoned.

    This sounds pretty cool. I don't have the hardware to try it right now, but I might make an emulator for it.
  • 1
    @ewpratten Changing the design... It didn't really work right, with a steel plate may be, the bb balls just went through it lol
  • 1
    I thought the same and started my own "CNC protocol" but then I realized that isn't worth the time making the wheel again. The best you can do is use the GCode and adapt your firmware to do what you want when receive the commands. That's how I made the firmware for my Delta printer and added custom features that aren't in the market (at least not yet).
  • 0
    Take a look to others protocols to get ideas. I use a lot HPGL to draw PCBs with my printer using a permanent marker.
  • 0
    @LuxARTS Well, I'm doing it anyway... I'm adapting my conventional milling machine to automatic and for small forms, it's enough for me
  • 1
    The fun thing about standards is, that there are so many to choose from!
  • 1
    Why do you want to reinvent gcode?

    Because the thing you want to do is liteary gcode with a different syntax...

    I used pc app to convert gcode to simpler protocol and the i send that to arduino.

    If you are lazy just use linux cnc
  • 1
    @Gregozor2121 I don't want to reinvent G-Code...
    I love G&M-Code (Ms are models that give function to the machine, like turning the cooling on and off, turn the spindle on and off)

    I want the Arduino to move with native code.
    No lags, No G-code, just upload the code and run it.
    It's a different way to work since you don't have much control after uploading (unless you make a controller, for speed and such).
    Direct code means less lag.
    Lets say I have a machine only to make structures and holes, you don't need to learn a new language (G-Code) for that.
    Also, If you have a machine that makes pieces in series, you can just upload the code, place the piece in brute, let it work, change the piece, repeat.
    This isn't intended to replace G-Code or any other, it's more a simpler way to do basic forms.
    For my hand milling machine (that I'm automating), with a screen and some push buttons and direct code, I can say how many mms to move and the direction.
  • 1
    Also, you can build on top of my library to integrate with BT or WiFi and control through an app.
    Or make a box with pushbuttons, screen, and a pot, and order the machine to move in one direction for X mms.
    I'll be using it when I upgrade my conventional milling machine again.
  • 1
    I still dont get your idea...
    But i can see you are making a huge progress. Good luck with your project!

    Once i move my workshop to the bigger city (where i study on uni)
    then im going to polish my cnc machine as well!
  • 0
    Well, think on it like this.
    - You're making a DIY machine and need to test it.
    You can program only the essentials and move between some coordinates for testing.
    - Or you have a very basic conventional machine like mine, and you want to program it only to make lines and move n mms on X or Y axis, I can make a box with buttons to do only basic moves instead of using a joystick.

    It's more for specific basic stuff where you don't need something as complex and more time demanding as G-Code, and have no uploader (Pc) to parse the code.
  • 2
    The "lag" that you get processing GCode (or any other type of code) will not limit the speed of work. The max speed of any CNC depends of a lot factors (milling machines depends on material, drill bit, motors power, etc.). Trust in me even a heavy and ugly firmware is faster than the real limit in most of cases.
  • 1
    BTW, you don't need a PC to send the commands to the machine. You can use an SD reader and read the files (which is the easiest way to do it IMO)
  • 1
    @LuxARTS
    SD cards? Come on. RS232 is supported by atmega hardware. It took me 15 min to setup the atmega, and to create a pc app to send the data...

    SD cards arent supported by atmega, and to work with them you have to bitband the protocol.(Of course you can use libs for that but still you have to connect the SD card to arduino)
  • 0
    @Gregozor2121 @LuxARTS , I would just go with BT or wi-fi for this one :D
    One of the ideas is, instead of push buttons, have an Android App talking by BT.
    Just waiting for the new steppers to fully convert my drilling machine to CNC. also how to add Z, so I can make the pieces for the next machine :D
  • 1
    @GyroGearloose
    As long as that wifi module has a rs232 protocol it shouldnt be a problem. Remember that it might work on 3V3 so connecting it to 5V might fry it.

    The only thing that i want to tell you it that rs232 doswnt reqire ANY additional code to run because arduino (atmega) has a small hardware module inside the chip to take care of it. All data will be avaliable in a regiester, ready to use.

    Other protocols require bitbanging or recreating the protocol in code, not only it takes space, it is harder to pull of as well.

    Well do what you want. Make sure you read the documentation of the atmega! It might be helpful.
Your Job Suck?
Get a Better Job
Add Comment