Skip to content

dsuarezv/Netduino-gcode

Repository files navigation

Netduino-GCode

A GCode parser written in C# for the netduino platform. G-code (http://en.wikipedia.org/wiki/G-code) is a standard language used in automation (CNC, numerical control) to instruct machines the movements they need to perform in other to build a shape designed in a CAD program. That CAD model is then converted to GCode by some CAM software and that GCode is parsed by this software to generate machine movements.

Components

The software is divided in several components:

  • The netduino application: this is the GCode parser that runs in the netduino and translates GCode to pulses suitable for stepper motor drivers. Currently it receives the GCode through the network connection of the netduino plus (through a socket listening server).
  • A viewer application on the PC side feeds the GCode file to the netduino and visualizes progress of the operation. This is a 3D viewer of the GCode toolpaths in the file. It was used to debug the parser and visualize the GCode paths while in development. Here is a screenshot:

Screenshot of the viewer in action

It is also possible to connect to the netduino directly via telnet and paste the gcode over that connection. By default, it is listening on port 82.

Building

The project is a VS2010 express solution, that requires the netduino SDK to be present.

There are several build configurations available. They build the netduino application or the PC software. Both applications share the same gcode parser code so that the viewer draws what the netduino will do (at least what refers to GCode, mechanically that's a different story).

To build the netduino app, select the configuration "Netduino debug" and build. The app is the project StepperBasic/NetduinoDevice2.

To build the Windows app, select the configuration "Debug" and build. The app is the project "gcodeviewer".

Configuring

Output pins and other parameters of the device are configured in the StepperBasic/CncDevice.cs class. Changing those parameters requires recompiling and redeploying for now.

It is possible to calibrate the number of steps per mm without recompiling using a D92 command like this:

D92 X320 Y320 Z160

This means that the X axis needs 320 pulses to advance one mm, same for Y and Z needs half (160).

Compatibility

So far the parser is able to handle successfuly all the toolpaths generated by VCarve Pro v6.

Viewer usage

Create a configuration file named "gcodeviewer.ini" that will hold some configuration parameters. It has the format on a .INI file. At least, you need to add an entry with the address of netduino:

cnc.address=ip address of netduino.

you can also specify the port:

cnc.port=82

To open a GCode file, click on the top yellow bar. An open file dialog will pop up letting you choose the GCode file. No error checking is performed, if you feed any other type of file, the app may crash.

Review the toolpaths in the 3D viewer:

  • Left mouse click and drag to rotate the 3D view.
  • Shift + left click and drag to translate. (alternatively, click and drag with the mouse wheel or middle button)
  • Mouse wheel to zoom in and out. (alternatively, Ctrl + left click and drag does the same)

If happy, connect to the netduino with the "Connect" button.

The "Offline" label should become "Online".

Now click "Begin" to start machining. Note that clicking "Cancel" may not stop inmediately and may complete the current Gcode line.

License

This code is licensed under the MIT license.

About

A basic gcode parser for netduino written in C#.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages