Difference between revisions of "4xidraw"

From Interaction Station Wiki
Jump to navigation Jump to search
(21 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
=4xidDraw=
 
=4xidDraw=
 
+
[[File:4xidraw.jpg]]
 +
== What ==
 
The 4xiDraw is a diy xy plotter made from off the shelf materials and 3d printed parts. Perhaps it is a drawing machine more than a plotter. It can use regular felt-tip pens, ball pens or fountain pens as pen orientation is variable. It is a new version of an XY plotter using a single belt and two stepper motors in a configuration called h-bot.
 
The 4xiDraw is a diy xy plotter made from off the shelf materials and 3d printed parts. Perhaps it is a drawing machine more than a plotter. It can use regular felt-tip pens, ball pens or fountain pens as pen orientation is variable. It is a new version of an XY plotter using a single belt and two stepper motors in a configuration called h-bot.
 
[https://www.instructables.com/id/4xiDraw 4xiDaw instructables page]<br>
 
[https://www.instructables.com/id/4xiDraw 4xiDaw instructables page]<br>
  
The plotter is Arduino based, and uses a special flavour of [https://github.com/gnea/grbl/wiki GRBL software] created by the robottini user. It enables GRBL to handle a servo on digital pin 11 using commands M3 and M5. This way it can raise and lower the pen on the paper. Find the GRBL version here: [https://github.com/robottini/grbl-servo servo GRBL ]
+
The plotter is Arduino based, and uses a special flavour of [https://github.com/gnea/grbl/wiki GRBL software] created by the robottini user. It enables GRBL to handle a servo on digital pin 11 using commands M3 and M5. This way it can raise and lower the pen on the paper. Find the GRBL version here: [https://github.com/robottini/grbl-servo servo GRBL ] and info how to flash GRBL to and Arduino [https://github.com/gnea/grbl/wiki/Flashing-Grbl-to-an-Arduino here]
 +
[https://github.com/gnea/grbl/wiki/Grbl-v1.1-Configuration GRBL settings]
 +
<br>
 +
'''About Grbl'''<br>
 +
Grbl is a free, open source, high performance software for controlling the motion of machines that move, that make things, or that make things move, and will run on a straight Arduino.
 
<br>
 
<br>
 +
 +
== How ==
 +
 +
=== Inkscape ===
 +
First, we will use Inkscape to send images to plot.
 +
Inkscape is a free and open source vector graphics editor. <br>
 +
[https://inkscape.org/ Download here]
 +
 +
We will have to install an additional extension for Inkscape in order to send our images to the 4xidraw. 
 +
 +
[https://github.com/bullestock/4xidraw Download it here]
 +
 +
Find out how to install inkscape extensions [https://inkscape.org/gallery/=extension/ here]
 +
 +
=== Universal Gcode Sender ===
 +
 +
Universal Gcode sender is a full featured gcode platform used for interfacing with advanced CNC controllers like GRBL and TinyG. Universal Gcode Sender is a self-contained Java application which includes all external dependencies, that means if you have the Java Runtime Environment setup UGS provides the rest.
 +
 +
 +
====gcode====
 +
From Wikipedia on G-Code:
 +
G-code (also RS-274), which has many variants, is the common name for the most widely used numerical control (NC) programming language. It is used mainly in computer-aided manufacturing to control automated machine tools. G-code is sometimes called G programming language, not to be confused with LabVIEW's G programming language. G-code is a language in which people tell computerized machine tools how to make something. The "how" is defined by instructions on where to move, how fast to move, and what path to move. The most common situation is that, within a machine tool, a cutting tool is moved according to these instructions through a toolpath and cuts away material to leave only the finished workpiece. The same concept also extends to noncutting tools such as forming or burnishing tools, photoplotting, additive methods such as 3D printing, and measuring instruments.
 +
 +
File extentions:  .gcode, .mpt, .mpf, .nc and several others
 +
<br>
 +
<br>
 +
 +
Simply put, G-Code is the language that tells the machine what to do, which movements to make, when to deposit material, when to stop etc. etc.. For example, a simple G-Code line that tells the machine to move to position X:10mm, Y:10mm could be:
 +
 +
G01 X10 Y10
 +
Here the code G1 is the code for move to. To draw a square with the 3D printer would require four such movements. Assuming we start from location X0 Y0 Z0 and want to draw a square of 10 by 10 mm:
 +
 +
G01 X0 Y10
 +
G01 X10 Y10
 +
G01 X10 Y0
 +
G01 X0 Y0
 +
For a list of G-Code commands an Ultimaker 3D printer understands (or a printer running Marlin) see: https://github.com/ErikZalm/Marlin/blob/Stable/Marlin/Marlin_main.cpp Scrolling down will reveal the G-Code list.
 +
 +
An easy way to manually control your printer and send G-Codes by hand is Pronterface/Printrun: http://www.pronterface.com
 +
 +
 +
Another square
 +
 +
 +
M03 (pen up)
 +
 +
G21 (All units in mm)
 +
 +
G00 X20 Y30
 +
M05 (pen down)
 +
G01 X200 Y30 F2000
 +
G01 X200 Y200 F2000
 +
G01 X30 Y200 F2000
 +
G01 X30 Y30 F2000
 +
 +
M03 (pen up)
 +
G00 X0 Y0 (going to 0 on both axes)
 +
 +
 +
 +
 +
'''G commands'''
 +
'''G0/G1'''
 +
Linear move.  Moves to coordinates XY (or Z) and extrudes E material at a speed of F
 +
example:
 +
G1 X500 Y500 E50 F3600
 +
<br>
 +
'''G2'''
 +
Clockwise arc move. Moves in an arc to coordinates XY, pivoting around relative coordinates IJ, extrudes E material between the two points at speed F
 +
example:
 +
G3 X90 Y30 I13.5 J1 E20 F3600
 +
<br>
 +
'''G3'''
 +
Counter-clockwise arc move.  Function is identical to G2 but reversed
 +
example:
 +
G3 X50 Y50 J30 E10.34 F4800
 +
<br>
 +
'''G4 '''
 +
Dwell for duration P (Milliseconds) or S (seconds)
 +
example:
 +
G4 S2
 +
<br>
 +
'''G20'''
 +
Change coordinate mode to Inch
 +
<br>
 +
'''G21'''
 +
Change coordinate mode to millimeter (default)
 +
<br>
 +
'''G28'''
 +
Home axes.  G28 to home all, or specify XYZ
 +
<br>
 +
'''G90'''
 +
Set moves to absolute positioning mode.  Moves will be in reference to machine zero
 +
<br>
 +
'''G91'''
 +
Set moves to relative positioning mode.  Moves will be in reference to last toolhead position
 +
<br>
 +
'''G92'''
 +
Override current tool position with given coordinates
 +
example:
 +
G92 X50 Y50 Z1.34
 +
 +
 +
'''F''' Feed Speed  Sets the feed rate, or rate of movement of the axes.
 +
<br>
 +
'''S''' Spindle speed
 +
<br>
 +
'''E''' Extrusion,  E0.0377 means an Extrusion(E) of 0.0377 mm.
 +
<br>
 +
'''I'''  Parameter - X-offset in arc move
 +
<br>
 +
'''J''' Parameter - Y-offset in arc move
 +
 +
==== export Gcode via Inkscape ====
 +
 +
[https://www.norwegiancreations.com/2015/08/an-intro-to-g-code-and-how-to-generate-it-using-inkscape/ A short guide how to generate Gcode from your files in Inkscape ]
 +
 +
=== send Gcode via a python script===
 +
 +
<syntaxhighlight lang=python style="border:3px dashed blue">
 +
 +
 +
#!/usr/bin/env python
 +
"""\
 +
Simple g-code streaming script for grbl
 +
 +
Provided as an illustration of the basic communication interface
 +
for grbl. When grbl has finished parsing the g-code block, it will
 +
return an 'ok' or 'error' response. When the planner buffer is full,
 +
grbl will not send a response until the planner buffer clears space.
 +
 +
G02/03 arcs are special exceptions, where they inject short line
 +
segments directly into the planner. So there may not be a response
 +
from grbl for the duration of the arc.
 +
 +
---------------------
 +
The MIT License (MIT)
 +
 +
Copyright (c) 2012 Sungeun K. Jeon
 +
 +
Permission is hereby granted, free of charge, to any person obtaining a copy
 +
of this software and associated documentation files (the "Software"), to deal
 +
in the Software without restriction, including without limitation the rights
 +
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 +
copies of the Software, and to permit persons to whom the Software is
 +
furnished to do so, subject to the following conditions:
 +
 +
The above copyright notice and this permission notice shall be included in
 +
all copies or substantial portions of the Software.
 +
 +
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 +
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 +
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 +
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 +
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 +
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 +
THE SOFTWARE.
 +
---------------------
 +
"""
 +
 +
import serial
 +
import time
 +
 +
# Open grbl serial port
 +
s = serial.Serial('/dev/ttyACM3',115200)
 +
 +
# Open g-code file
 +
f = open('simple.g','r');
 +
 +
# Wake up grbl
 +
s.write("\r\n\r\n")
 +
time.sleep(2)  # Wait for grbl to initialize
 +
s.flushInput()  # Flush startup text in serial input
 +
 +
# Stream g-code to grbl
 +
for line in f:
 +
    l = line.strip() # Strip all EOL characters for consistency
 +
    print 'Sending: ' + l,
 +
    s.write(l + '\n') # Send g-code block to grbl
 +
    grbl_out = s.readline() # Wait for grbl response with carriage return
 +
    print ' : ' + grbl_out.strip() # prints the ok response from grbl
 +
 +
# Wait here until grbl is finished to close serial port and file.
 +
raw_input("  Press <Enter> to exit and disable grbl.")
 +
 +
# Close file and serial port
 +
f.close()
 +
s.close()   
 +
 +
</syntaxhighlight>

Revision as of 22:56, 26 May 2019

4xidDraw

4xidraw.jpg

What

The 4xiDraw is a diy xy plotter made from off the shelf materials and 3d printed parts. Perhaps it is a drawing machine more than a plotter. It can use regular felt-tip pens, ball pens or fountain pens as pen orientation is variable. It is a new version of an XY plotter using a single belt and two stepper motors in a configuration called h-bot. 4xiDaw instructables page

The plotter is Arduino based, and uses a special flavour of GRBL software created by the robottini user. It enables GRBL to handle a servo on digital pin 11 using commands M3 and M5. This way it can raise and lower the pen on the paper. Find the GRBL version here: servo GRBL and info how to flash GRBL to and Arduino here GRBL settings
About Grbl
Grbl is a free, open source, high performance software for controlling the motion of machines that move, that make things, or that make things move, and will run on a straight Arduino.

How

Inkscape

First, we will use Inkscape to send images to plot. Inkscape is a free and open source vector graphics editor.
Download here

We will have to install an additional extension for Inkscape in order to send our images to the 4xidraw.

Download it here

Find out how to install inkscape extensions here

Universal Gcode Sender

Universal Gcode sender is a full featured gcode platform used for interfacing with advanced CNC controllers like GRBL and TinyG. Universal Gcode Sender is a self-contained Java application which includes all external dependencies, that means if you have the Java Runtime Environment setup UGS provides the rest.


gcode

From Wikipedia on G-Code: G-code (also RS-274), which has many variants, is the common name for the most widely used numerical control (NC) programming language. It is used mainly in computer-aided manufacturing to control automated machine tools. G-code is sometimes called G programming language, not to be confused with LabVIEW's G programming language. G-code is a language in which people tell computerized machine tools how to make something. The "how" is defined by instructions on where to move, how fast to move, and what path to move. The most common situation is that, within a machine tool, a cutting tool is moved according to these instructions through a toolpath and cuts away material to leave only the finished workpiece. The same concept also extends to noncutting tools such as forming or burnishing tools, photoplotting, additive methods such as 3D printing, and measuring instruments.

File extentions: .gcode, .mpt, .mpf, .nc and several others

Simply put, G-Code is the language that tells the machine what to do, which movements to make, when to deposit material, when to stop etc. etc.. For example, a simple G-Code line that tells the machine to move to position X:10mm, Y:10mm could be:

G01 X10 Y10 

Here the code G1 is the code for move to. To draw a square with the 3D printer would require four such movements. Assuming we start from location X0 Y0 Z0 and want to draw a square of 10 by 10 mm:

G01 X0 Y10 
G01 X10 Y10
G01 X10 Y0 
G01 X0 Y0 

For a list of G-Code commands an Ultimaker 3D printer understands (or a printer running Marlin) see: https://github.com/ErikZalm/Marlin/blob/Stable/Marlin/Marlin_main.cpp Scrolling down will reveal the G-Code list.

An easy way to manually control your printer and send G-Codes by hand is Pronterface/Printrun: http://www.pronterface.com


Another square


M03 (pen up)

G21 (All units in mm)

G00 X20 Y30 
M05 (pen down)
G01 X200 Y30 F2000
G01 X200 Y200 F2000
G01 X30 Y200 F2000
G01 X30 Y30 F2000

M03 (pen up)
G00 X0 Y0 (going to 0 on both axes)



G commands

G0/G1
Linear move.  Moves to coordinates XY (or Z) and extrudes E material at a speed of F
example: 
G1 X500 Y500 E50 F3600 

G2 Clockwise arc move. Moves in an arc to coordinates XY, pivoting around relative coordinates IJ, extrudes E material between the two points at speed F example: G3 X90 Y30 I13.5 J1 E20 F3600
G3 Counter-clockwise arc move. Function is identical to G2 but reversed example: G3 X50 Y50 J30 E10.34 F4800
G4 Dwell for duration P (Milliseconds) or S (seconds) example: G4 S2
G20 Change coordinate mode to Inch
G21 Change coordinate mode to millimeter (default)
G28 Home axes. G28 to home all, or specify XYZ
G90 Set moves to absolute positioning mode. Moves will be in reference to machine zero
G91 Set moves to relative positioning mode. Moves will be in reference to last toolhead position
G92 Override current tool position with given coordinates example: G92 X50 Y50 Z1.34


F Feed Speed   Sets the feed rate, or rate of movement of the axes.

S Spindle speed
E Extrusion, E0.0377 means an Extrusion(E) of 0.0377 mm.
I Parameter - X-offset in arc move
J Parameter - Y-offset in arc move

export Gcode via Inkscape

A short guide how to generate Gcode from your files in Inkscape

send Gcode via a python script

#!/usr/bin/env python
"""\
Simple g-code streaming script for grbl

Provided as an illustration of the basic communication interface
for grbl. When grbl has finished parsing the g-code block, it will
return an 'ok' or 'error' response. When the planner buffer is full,
grbl will not send a response until the planner buffer clears space.

G02/03 arcs are special exceptions, where they inject short line 
segments directly into the planner. So there may not be a response 
from grbl for the duration of the arc.

---------------------
The MIT License (MIT)

Copyright (c) 2012 Sungeun K. Jeon

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
---------------------
"""

import serial
import time

# Open grbl serial port
s = serial.Serial('/dev/ttyACM3',115200)

# Open g-code file
f = open('simple.g','r');

# Wake up grbl
s.write("\r\n\r\n")
time.sleep(2)   # Wait for grbl to initialize 
s.flushInput()  # Flush startup text in serial input

# Stream g-code to grbl
for line in f:
    l = line.strip() # Strip all EOL characters for consistency
    print 'Sending: ' + l,
    s.write(l + '\n') # Send g-code block to grbl
    grbl_out = s.readline() # Wait for grbl response with carriage return
    print ' : ' + grbl_out.strip() # prints the ok response from grbl

# Wait here until grbl is finished to close serial port and file.
raw_input("  Press <Enter> to exit and disable grbl.") 

# Close file and serial port
f.close()
s.close()