Step 6: Prepare the Arduino.

For the Arduino I started out writing my own software. But while searching for a good way to control movement from the serial port I stumbled upon something called "Grbl ". This is a g-code interpreter with lots of nifty functions. As I already had everything connected to the Arduino I had to ether change my connections or change the software. Luckily it is easy to change control pins in the software. I did however have to download Winavr and then the code from github.com . It is not that hard to do. After downloading and extracting the code you have to change the port numbers in config.h and make sure you get them in the right order. Then all you have to do is start a command window, enter the correct folder and type "make". If all goes to plan you should end up with a .hex file ready for the Arduino.

I have however changed the pin-out since then and here in the instructable I use the default pin-out of Grbl. This will make it a lot simpler to follow and setup. You can just download the prepared hex file from the Grbl download page .

The current version of Grbl (0.6b) has a bug in the queue system. The laser on and off (M3, M5) commands are not put in the queue and the laser will be turned on and off as soon as the Arduino receives the commands. This is resolved in the edge branch. You can download and the source from here , or grab the compiled hex I am using from here . This should resolve the issue until the next version of Grbl.

Any way you choose to do it you will end up with a .hex file that you must get into the Arduino. I have tried a couple of different ways and the one I like the most is by a program called XLoader . The programming is pretty straight forward; select the correct serial port for your Arduino. Select the hex file and type of Arduino and press upload. If you are using the new Arduino Uno the XLoader doesn’t work, you will get an upload error. In that case I recommend using ARP/Arduino Uploader but even this uploader has some issues with the Uno. When programming the Arduino select the com port and microcontroller in the respective dropdown. After that you will have to make a change in the “AVR Dude Params” text. Erase the “-b19200” (without the quotes) part and click on the upload button. In any case, a couple of seconds later you are done and are ready to try it out. Exit the XLoader and get to the next paragraph.

The Arduino needs to be set up for the job. Start your favorite serial terminal and open the port your Arduino is connected to. You should get a welcome message:

Grbl 0.6b
'$' to dump current settings"

If you enter $ followed by return you will get a list of options. Something like this:

$0 = 400.0 (steps/mm x)
$1 = 400.0 (steps/mm y)
$2 = 400.0 (steps/mm z)
$3 = 30 (microseconds step pulse)
$4 = 480.0 (mm/sec default feed rate)
$5 = 480.0 (mm/sec default seek rate)
$6 = 0.100 (mm/arc segment)
$7 = 0 (step port invert mask. binary = 0)
$8 = 25 (acceleration in mm/sec^2)
$9 = 300 (max instant cornering speed change in delta mm/min)
'$x=value' to set parameter or just '$' to dump current settings

You must change the steps/mm for X and Y axis to 53.333 on both. Just enter "$0=53.33" followed by return and then "$1=53.333" followed by return. Z axis can be ignored as it is not used. The acceleration can be ramped up to something like 100 ("$8=100" and return). As we move really slowly with this machine acceleration can be high. Another side effect of low acceleration can be that curves get a lot more burnt than straight lines as the controller constantly tries to accelerate and decelerate but never reach full speed. If you build this like me one of your axis might be mirrored. This is easy to fix. Option $7 lets you change direction on axis. I wanted to change direction on the X axis so I type in "$7=8" as I want to change bit 3 (8 = 00001000 binary) if you want to change direction on Y axis you type in 16 (00010000) or 24 (00011000) to change both. The complete documentation of the invert mask can be found here .

Now you are ready for the computer setup. If you want to try some movement you can type "G91 G28 X0 Y0 [return]" to zero the axis. Followed by "X10 Y10 [enter]". You should see 10mm movement on each of the axis.

<p>hi, i have a problem like this. i dont find answer in internet (google) , please help me!! </p><p>already thanks for all support :DD</p>
<p>Change your file path ,liks 'C:\Users\admin\Desktop',I think some </p><p>permissions that</p>
Same problem.
<p>Getting the same error messages. I can't get the gcode prog to function properly either. I'm experimenting with J tech's inkscape plugin, but it's weird when I use a universal gcode sender program, the steppers move, stop and then move SUPER slow, like almost unnoticably slow. After about 40 seconds, they start moving fast again, then slow down all over again.</p><p>the link to the inkscape plugin:</p><p><a href="http://jtechphotonics.com/?page_id=2012" rel="nofollow">http://jtechphotonics.com/?page_id=2012</a></p>
<p>Hello, </p><p>I have assembled the mechanics, but nothing seems to work the right way... I put in GRBL 0.9 and that works with Grbl controller program, but the inkscape plug in doesn't work - I get some error and the .nc file is not created and the g-code sender does not work either. I have tried making the code with CAMBAM suggested in the comments together with Grbl controller and got it to draw me a square (though forgot to check the size so it went overboard...). But like someone mentioned, my laser also does not burn anything... It was the right one, because the other one does not produce visible light at all. Also my question is - if i set the where the zero coordinate is, should it &quot;remember&quot; that? because after making an object it does not go to zero and I have to move it manually. It also seems to ignore the max travel distance setting... Also, how do you get the laser to turn on and off? mine is always on as long as the arduino is on (High on D12). Should I have changed something in the code for the microcontroller?</p><p>Thank you</p>
Got it moving right with grbl 0.8. Tried new laser, but so far still no burning. Moved it up to 0.4 amps. Still nothing. Anyone have any ideas?
What type of material are you trying to engrave and what is the color of your material? Try testing your laser by aiming it at some black electrical tape.<br>Did you put your laser diode in a housing with an adjustable lens? Try tweaking the focal length so that it burns the tape properly. <br>If you did all these thing, but while running gcode it still doesn't burn like it should, maybe you're moving too fast and need to slow the movement down.<br>
<p>Hey, finally got it to burn last night. I have it in a housing yes. Tried 3 different diodes. I was trying to burn paper and after testing various types (what i found on my desk), apparently not all papers get burned. I suppose the nice white paper reflects the laser beam or something. But now some other issues arose... When the gcode is being sent, I always get an error when it tries to define the speed (G1F5.00000). Is it something wrong with the syntax? Also sometimes get an error in the movement code in one command which is no different to me than the rest of them, so its probably just a glitch or something. Also, some parts dont get burned for some reason. The laser passes them, but doesn't burn. Weird. <br>Also, the laser driver with the LM317 is not working properly. when I try to adjust the current (measuring at the laser) it starts on very low end (20 mA) and then jumps up to 250 mA at the very end. No gradual rise is achieved. Any thoughts?</p>
<p>This might better explain what I mean by not cutting parts. The &quot;D&quot; in the &quot;wings&quot; is supposed to be cut out. And some other parts are missing too...</p>
<p>After some digging, it appears that the grbl version was at fault. After upgrading to 0.9 (you need to disable the PWM function they installed) It works Fine. However, The plugin for inkscape in this post need to have one line changed to work on the 0.91 inkscape and the jtech one has a a programming error. It uses G0 instead of G1 for parts that you need to engrave, which causes missing or crappy straight lines. If anyone needs a fixed .py file, pm me. Also GRBL 0.9 has a bug - the dwell function is in seconds, not in milliseconds as it should be. So 100 ms delay is actually 100 s. I also have a fixed code file for that and a .hex for Uno if anyone wants. (PM)</p>
<p>Thanks a lot for mailing me the fix!</p><p>I got it running now too, without the laser(my goggles still haven't arrived T.T).</p><p>But I can see it working properly with a fineliner pen!</p><p>Will let you know when it starts cutting :)</p>
<p>I have uploaded the fixed files to tinyupload, since the OP is not responding. The archive contains fixed plugins for inkscape and fixed grbl 0.9 source and hex</p><p>http://s000.tinyupload.com/index.php?file_id=15359939908683250552</p>
<p>Sort of working :D</p>
Would I be able to engrave a piece of aluminum?
No. <br>Much of the laser's energy will be reflected, and what energy is absorbed will be quickly dissipated due to the aluminium's conductivity.
Hi, great instructables.<br>Can you post models ss STP or IGES files so can be opened in creo or solidworks.<br>Tnx
<p>hi, i made the engraver but i am facing a problem, the motion is working fine just needs some calibration but the laser is not burning anything. it is being turned on and off but it just doesn't burn anything what can be the issue</p>
A few things come to mind:<br>1. It is underpowered. How much current are you passing through it?<br>2. It is unfocused. Do you have a focusing lens? Have you tried adjusting the focal length to suit you rig?<br>3. It's not the right laser. Where did you get it? If you got it from a DVD burner, did you pull out the right one?<br>4. It has 'gone LED'... as they say. If you mistreat a laser, it fails and just becomes a nice bright LED.<br><br>There might be other reasons too, that's just what I can think of right now.
<p>How does this work without limit switches? I dont want the motors to run past the length of the rail, causing problems! Also, how do you calibrate the speed of the print, say if you are using a more powerful laser (1.0 W) and you dont want to set stuff on fire... No limit switches are used here so how do you zero the axes and keep the print from going larger than the print area? Also, how do you calibrate the step/mm because with the 53.333 step/mm command given in the project the movements is not properly scaled to the commands. If i put in X10 it will move more than 10mm... Thanks...</p>
<p>Does anyone know if Marlin could be used on the Arduino to process the Gcode?</p>
Marlin will work fine. You will have to make sure your g-code matches the Marlin setup, i.e. you will have to choose a Marlin output to drive the laser, and if you choose a fan control signal (for example), then the 'laser on/off' codes in your g-code file will have to be changed to 'fan on/off'.
Cool, thanks. I've seen references before to people using the fan control to drive the laser, but I've never attempted to hack raw Gcode before, so I'm a little out of my depth. Do you just slice an STL as close as you can to one layer thick, and then just crack open a text editor and roll your sleeves up with find/replace? How would it work if you wanted to use the fan speed to give a grayscale output for the laser?<br><br>
<p>Raw G-code is mostly quite simple, They are basically codes telling the laser/print-head/etc to move from A to B, and how fast. Open one with a text editor. Look here for some explanations and a look-up table for the codes: http://reprap.org/wiki/G-code</p><p>I use M106 to turn on/off a fan output. (Yep, &lsquo;find and replace&rsquo;)</p><p>I don&rsquo;t use a slicer for laser engraving. I use Inkscape. it&rsquo;s free and the tools are there for g-code generation. I wrote about it here previously. Look through the recent comments to find it. It was a response to StuartB4&rsquo;s question about Inkscape and text. </p><p>As for greyscale, either the laser burns or it doesn&rsquo;t, no greyscale by adjusting intensity. You will have to dither it. I haven&rsquo;t tried it but I think the &lsquo;Raster 2 Laser Gcode Generator&rsquo; can do it.</p>
<p>I have problem with G-code sender when i'm using GRBL v0.9i. I thing it may be the baud rate that is 115200 in v0.9i and in previous versions it was only 9600. What should i do to make it work?</p>
<p>Will this engrave metal? Like a zippo lighter?</p>
<p>While you couldn't directly engrave the metal, you could probable paint it and engrave that.</p>
<p>nope, the laser from a DVD-Rom drive wouldn't have enough power,and it's dangerous to use on a reflective surface.</p>
<p>after you have done all that how does the engraver know where to start? when do you set the xy home points?</p>
<p>i am using arduino uno and L293D shield...where do i connect the laser??</p><p>This is my first electronic project. I really dont know much about the circuit</p>
<p>Hi, geceng! In my first attempt, I build this engraver on L293D, but there is no compatible software to use it. All standard CNC working with controllers with &quot;DIR-STEP-GND&quot; control signals, and no way to use L293D without problems. May be - add another ArduinoMini for &quot;Dir-Step&quot; signals emulation. One Arduino - with GRBL software, and another - with dir-step controller emulation on L293D.</p>
<p>no need to add another arduino... use L297 controller...(see sample using ULN2003)</p>
<p>Hi I want to know what is the segment that lies between Alardueno <a href="http://www.sparkfun.com/products/10267" rel="nofollow">Easydrive</a> and what their function is and whether Zerorah</p>
<p>I'm having a whale of a time getting anything to print right at all! My prints are all wonky no matter where I set the potentiometers on the EasyDrivers, I've tried every level of microstepping, including full-step. In full-step mode, my motors are taking only 6.5 steps per mm, which is ridiculously low-res! Here is my attempt at printing a tiny circuit:</p><p></p><p>It's supposed to look like this:<br></p><p>I'm using grbl 0.9j, FlatCAM to make the paths and a python script to turn Z movements into laser toggle commands. </p><p>Help Please!</p>
<p>Maybe I have not read it pretty well, but I can not find anywhere how much voltage should be marked in the image introduced into the circuit? If you need one at all. The answer Thank you in advance!</p>
<p>That jumper is just an alternative connection for the laser. If you follow the paths you will find they connect to the same as the laser screw terminal. The laser circuit will draw power from the arduino and the Vin pin.</p>
<p>This is very awesome! Thanks for this instructable.</p><p>We want to help you to complete your new project, and now there are some products about arduino and 3d printer on our website.</p><p>we can send them to you for free.Here is link:</p><p><a href="http://www.gearbest.com/3d-printer-parts-c_11400/" rel="nofollow">http://www.gearbest.com/3d-printer-parts-c_11400/</a></p><p><a href="http://www.gearbest.com/development-boards-c_11297/" rel="nofollow">http://www.gearbest.com/development-boards-c_11297/</a></p><p>Or this:</p><p><a href="http://www.gearbest.com/3d-printers-3d-printer-kits/pp_242560.html" rel="nofollow">http://www.gearbest.com/3d-printers-3d-printer-kits/pp_242560.html</a></p><p>My email:luffy@gearbest.com </p><p>Luffy</p>
<p>how concerned should i be about eye protection.</p>
<p>Will Inkscape work with text? I'm after a simple text to engraver with as few steps a possible. I'm afraid I haven't a clue how to program and I'm too old to learn :-) Also is the somewhere on-line where I can download .nc files to use with my 500mw Laser engraver. Thank you in advance.</p>
<p>Find a program called CAMBAM, there is a free version that does a lot. It takes a bit of learning (there are some tutorials and a forum) but you can make text of all kinds, there is an add-in to do curved text. You can import dxf files you make in other CAD programs, and you can do some minimal things right in it. Once you have your design or text or some combination of all the above, you can select them, generate gcode to engrave, pocket carve, or some other operations. Then just use those gcode files. No programming necessary but you will have to spend a bit of time to learn how to use it.</p>
Thanks for the info on CAMBAM. I'm not too sure if I have the patience to tackle yet another program, but I'll certainly download it and try my hand at using it. Who knows, I might just be able to handle it. I'm still looking for a download library of ready made engraving files. I'm surprised nobody has thought of it. Oh to be 40 years younger :-)
<p>You have a very inspiring way of exploring and sharing<br>thoughts. Really Motivating.</p><p>High Pagerank Backlinks</p><p><a href="http://www.webseobuy.com/cms.php?id=5" rel="nofollow">http://www.webseobuy.com/cms.php?id=5</a></p>
Thanks RTChoke, I'll go searching for it right now. I appreciate your help. Stu
<p>I actually just set up my machine the other day and used CAMBAM to generate some test text to try it out. I made some text, selected the CAM function to &quot;engrave&quot; and it did that operation, then generated gcode from that. Loaded the gcode into the laser engraver software and ran it, burned the image fine except that the controller needs the proper gcode commands to turn the laser on/off as moves around -- it never turned off so there are burn lines where it went from one letter to another. I think that is easy enough to do by editing the gcode (just open the gcode file in a text editor of some sort) to replace the up/down commands (CAMBAM is set up for CNC routers so tells the router to move in the Z axis, the laser controller ignores that but the Z move commands can be replaced with &quot;laser off&quot; &quot;laser on&quot;) with the M commands (M04 M05 maybe? I have not looked at other code yet to see what the proper commands are) that the laser controller expects. I have not fooled with it yet but will try. Don't be intimidated StuartB4, it is not hard just takes a bit of digging and learning to make things work! I also need to see how the controller and software works to see if I can control the speed and intensity of the laser. More fun!</p>
<p>Inkscape with work with text. There are a couple of ways I have used Inkscape to engrave text. </p><p>To engrave the outline: <br>Type the desired text. Select the text. (Important bit) Select Path-&gt;Object To Path. Select Extensions-&gt;Gcodetools-&gt;Path to Gcode (you could use other options, this is what I use). Go through the various tabs of the dialogue box and set it up how you like (you might need to experiment), but (another important bit) when you hit 'Apply', make sure you are on the first tab (the 'Path to Gcode' tab). </p><p>To engrave solid text:<br>I added an extension for this. It is 305 Engineering's 'Raster 2 Laser Gcode Generator' (you'll find it on the web if you go looking for it). This method takes much longer. I use the slowest setting of 10 pixels per mm - it looks the best. Once you have installed the extension:<br>Type the desired text. Select Extensions-&gt;305 Engineering-&gt;Raster 2 Laser Gcode Generator... Go through the dialogue box and set the parameters you want (default is ok for most). This outputs a number of files, one being the gcode file, another being a preview which is very useful. It will create gcode for everything on the page, so I work in layers and show only the layers I want printed when I do this. </p><p>Though I was inspired by Groover's instructable, I did some things a little different. I have Marlin running on my Arduino instead of grbl. So I make some manual changes to the gcode files to get the it to turn the laser on and off, etc.</p><p>But in answer to your question: Inkscape works with text. </p><p>I will put a photo in of some text engraving I did with Inkscape 'Wooden Spoon' was done with Gcodetools (so it is an outline). 'FIJI' was done with 305 Engineering's extension.</p>
Thanks for that very detailed tutorial. I'll definitely give it a go as soon as I sort out my laptop. It won't recognize it's built in graphics card for some reason. I'll download the latest driver and see if that sorts things out. Sometimes I have to wonder what I did with my spare time before computers. :-)
<p>I have bookmarked you to check out new stuff of your blog. A<br>must read!!!!</p><p>Fundraising platform in India</p><p><a href="http://enablersinvestment.com/" rel="nofollow">http://enablersinvestment.com/</a></p>
<p>Can any1 describe the parts in the circuit layout please?</p><p>I'm a total newbie to electronics and don't know the codes.</p>
<p>The relays and other things there are unnecessary unless you want the fans to be controlled, otherwise just wire it to a power source. Also do not use a LED driver for lasers-Their wattage types are different. Just use a lm317 with a 3ohm resistor across the ADJ and VOUT of the regulator. Otherwise if you're lazy like me, simply rely on the Arduino's regulation of 200ma. Hope it helped!</p>
<p>First, sorry for the silly question (Electronic newbie here)</p><p>Second, If I didn't missunderstand, all the components in the circuit layout (Besides the arduino and easydrivers, in the red box at the image), are for controlling the fan and the laser?<br>I mean, can I simply replace all that components with a readymade driver or with the circuit from the instructable that IT-Wizard has linked? (http://www.instructables.com/id/DIY-Laser-Diode-Driver-Constant-Current-Source/?ALLSTEPS) I want to learn what I'm doing, and that instructables is more explained, hahaha (Can I have a little more information in using the LM317 with the 3ohm resistor? That seems to be a lot more simple, and cheap, for a newbie like me)</p><p>Thanks for all the help</p><p>PS: Great Instructable!! :D</p>
<p>Also, if I replace that components with a readymade driver (Or any other method for controlling the laser), what connections I need to make to connect it to the arduino and the easydrivers?</p><p>Thanks</p><p>PS: Sorry also for the bad english, it's not my first languaje</p>

About This Instructable


4,006 favorites


Bio: I'm just a poor lonesome cowboy... Not really, I am divorced and live in the cold country of Sweden. I am not much of ... More »
More by Groover: Steampunk instant sounds Stamps from craft foam. Pocket laser engraver.
Add instructable to: