# driving CNC without G-code

Hey guys I've had interest in building a mini cnc machine using 3 nema 17 stepper motors. So far I got one stepper motor, some small thing, it's a bipolar stepper and I learnt how to drive it with an ATMEGA328 and transistors using 2 H-bridges.

Now I have written some real basic code to drive the motor forward and back with pushbuttons. The code has counters and logic to make sure every step is accurate and what it is supposed to be.

Now my question, before going ahead and buying all the stuff I need, will it be possible to write basic code as in ( if this then step that way) else (do that) to actually machine something? Or will the geometry of objects be way to complex for this?

My problem is I tried reading up about G-code and I was WTFF!!!! It sounds way to complicated for my level and I don't wana learn another programming language.

I was thinking something like this. I would draw an object I want to machine. Say for example I want to cut a circle out of wood 2mm wood or whatever.

So what I would think is necessary is to calculate many co-ordinate points at different locations of the circle. The more I calculate the more accurate my circle will be. Then I somehow send those co-ordinates to the arduino which uses them in a function to simply reposition X Y and Z for each co-ordinate set. Z in this case will be constant.

As for how I will calculate the co-ordinate points I don't know. It's simple enough by just using polar co-ordinates and a circle formula or Trigonometry but to calculate 1 thousand co-ordinates will require a program to do it. Then when shapes become more complex I have no idea.

Ok lol I just realised I basically explained Gcode to myself now in this post haha. Oh well. Any advice? Comments?

My problem is I tried reading up about G-code and I was WTFF!!! It sounds way to complicated for my level and I don’t wana learn another programming language.

There are tools that will emit G-code for you - generally, you don’t need to learn it or code it by hand.

I have used Inkscape with a Gcode plug in.

I have also written quite a few programs in Processing language that output Gcode.
The Hole cutter one will do as the name suggests, it is at:-
http://www.thebox.myzen.co.uk/Mac_Apps/Processing.html

G-Code is a way of describing what you want the CNC tool to do. You should be able to do a lot with some very basic G-Code so it is worth studying.

I'm not aware of any easier way to describe the tool movements.

Of course you can't drive a stepper motor directly with G-Code. Something has to convert the G-Code commands into steps for each of your stepper motors.

There are various programs (such as GRBL) that run on an Arduino and drive stepper motors based on G-Code.

It is not too difficult to convert G-Code into stepper movements, but, personally, I would do that on my PC and just have the Arduino control the motors.

...R

The Shapeoko runs on an Arduino with GRBL installed on it.

http://zapmaker.org/projects/grbl-controller-3-0/

In the case of the Shapeoko, the design uses two motors to power the Y axis. In this way it keeps the trammel from racking without a lot of extra parts. The two motors are run from separate drivers, but given the same step/dir signals.

http://www.shapeoko.com/