[hackpgh-discuss] Re: Awesome article on how to read G-code

  • From: "Ryan Priore" <ryan.priore@xxxxxxxxx>
  • To: <hackpgh-discuss@xxxxxxxxxxxxx>
  • Date: Tue, 25 Oct 2016 17:43:57 -0400

While we are on the topic of gcode, I have a few questions.

 

What is the typical way to interface auxiliary functions with gcode. For 
example, if I wanted to take advantage of the generic usability of gcode to 
move a carriage around, but I wanted to do things like snap a photo or perform 
some additional action via PWM pulse, how would you attempt that process? I 
know from using RAMPS with 3D printing, I can do certain things like control a 
servo motor with the M280 command, or control the voltage output of a general 
I/O pin with M42.

 

After playing with the WARigami setup for our Oribotix booth at Maker Faire, I 
have some other things that I would like to do with motor control. I am trying 
to decide whether it is easier for me to layer what I want to do atop of a 
gcode interpreter like a generic RAMPS or gcode interpreter shield for Arduino, 
or whether it is easier to handle the motor movement myself with direct 
commands within an Arduino or Python environment. For example, move motor then 
trigger sensor, then repeat…

 

Ryan

 

From: hackpgh-discuss-bounce@xxxxxxxxxxxxx 
[mailto:hackpgh-discuss-bounce@xxxxxxxxxxxxx] On Behalf Of Andrew C.
Sent: Tuesday, October 25, 2016 5:21 PM
To: hackpgh-discuss@xxxxxxxxxxxxx
Subject: [hackpgh-discuss] Re: Awesome article on how to read G-code

 

read it. a decent overview.

 

 gcode is really not complex. majority of machining can be explained using less 
than 10 codes, in about 30 minutes. it's just commands to move a table or head 
to a 3d point in space. many of the gcodes are machine specific- meaning beyond 
a basic 10 or so, things like G83 can mean different things on different 
machines. anyone who runs these machines learns the codes special to that 
machine if they program it.

 

A very quick example for those interested, based on common Haas machine codes- 
the following line:

 

G81 Z-1.550 F100.;

 

This line tells the machine to drill to the Z depth of 1.550" deep, below Z0. 
plane (usually the top of your part) at a feed (rate of plunging) of 100 inches 
a minute into the part.

 

The gcode G81 is a code to drill- a type called a canned cycle, basically a 
movement subroutine, that the machine knows means to move downward, and back up 
to whatever Z position it was at before you made it drill. The ; sign is an end 
of block character that denotes the end of the line of commands for the machine 
to read as one line of command.

 

There are many things you can add to that to make it more specific in how it 
does that. Just one example:

 

G99 G81 Z-1.550 R6.0 F100.;

 

This does the same thing as before, but G99 is a code that tells the machine to 
use a reference value above or below the part Z0. origin point to retract to 
when done, the R value is that position. If it's positive, it's that far above 
the Z origin point, if it's a negative R, it moves to that spot below Z0. 
origin when done. So here, the machine moves drill or whatever tool you are 
using to 6" above the part after it drills into the part 1.550" deep.

 

It sounds like complex stuff, but it's really not. unless you are programming 
3D shapes like faces, most programming is done with only 4 Gcodes or so, and 
maybe 6 modifiers. Mcodes like M06 tell the machine to do other things, like in 
that case, do a tool change.

 

Its honestly not difficult guys, what's difficult is selecting safe tools to 
cut with, and spinning them at correct speed and moving them at correct rate 
(feed) at a safe depth through material. That's the knowledge part behind 
machining, and that is what takes more time to learn.

 

-Andrew

 

 


On Tuesday, October 25, 2016, Yevgeniy Soroka <ukranians2@xxxxxxxxx 
<mailto:ukranians2@xxxxxxxxx> > wrote:

http://makezine.com/2016/10/24/get-to-know-your-cnc-how-to-read-g-code/

 

-Geno

Other related posts: