loading

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 .

Important:
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
ok

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 there... I was wondering if... I want to use it to engrave several times the same figure: some lines. Is it possible to connect it to the power and put a program in Arduino so I don t have to use the computer? I mean, I connect PC to arduino, upload my little program, and then if I connect the engraver to the power it will work? thank you in advance!</p>
<p>No, Arduino will power on but you will have to use the grbl to control.<br></p>
... thnks :)
<p>No, it won't. Arduino is just like a calculator. You will have to give input in order to receive output.<br>Although you could write a program that will stay on an sdcard and then arduino can repeat that program.</p>
yes, exactly! like this one? : http://www.cetronic.es/sqlcommerce/disenos/plantilla1/seccion/producto/DetalleProducto.jsp?idIdioma=&amp;idTienda=93&amp;codProducto=888304015&amp;cPath=1342&amp;gclid=CjwKEAjw4dm6BRCQhtzl6Z6N4i0SJADFPu1nDCpx0W2rYdx65nX7nO-NEl_Vr1wEsb1NHxrDNYlzqRoCOt3w_wcB<br>how can I do it? ( sd card )... :)))))
<p>Yes with sdcard and lots of coding can do that.<br>Or try searching if someone have that open sourced</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>
What power supply is should use? How many volt/amp I should supply for whole setup.
<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>
Setting of steps depends on what software u r using.<br>If using the given grbl version and controller u jut need to type $ and press enter.<br>That will list all commands that can be set manually. Set first two commands $0 &amp; $1 to 53.33.<br>The author had already described that the inkscape file properties must be st to 38mm*38mm so no limit switch necessary. You can override the stopped manually by using override box in the grbl controller window.
<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.
4. May be possible because of power fluctuations laser(even with driver) can behave like a working laser but won't burn anything.
Please check if the laser has at least 2.2v and 100mA of power supply.<br>Also check if has focused properly on whatever surface you have setup.<br>Note: It won't engrave shiny metal or glass.
<p>You dont really need to connect MS1 and MS2 on the Easy Driver to 5 Volts.</p><p>The default step setting is 1/8th step.</p><p>From Easy Driver web site:</p><strong>The Easy Driver is able to operate in 1/8th, 1/4, half, and full<br> step (2 phase) modes. These four modes are selected by the logic<br> levels on the MS1 and MS2 input pins. Normally, the pull-up<br> resistors on the Easy Driver hold MS1 and MS2 high, which results in<br> a default setting of 1/8th microstep mode. You can pull either<br> or both to ground to select the other 3 modes if you want.</strong>
<p>So simply leave them as it is(not connected to anywhere) will result in auto stepping? of full, half or 1/8?</p>
<div><div><p>From what I understand, if you leave them unconnected it will be 1/8th step.</p><p>As it says that is the default. I assume if you connect them different ways you will get Full, Half or Quarter step.</p><p>This is the table from the website.</p></div></div>
I'm a newbie to electronics buddy, so don't know this stuff very well. But I found what you said its almost the same as on other site.<br>Quick Specs:<br>Each EasyDriver can drive up to about 750mA per phase of a bi-polar stepper motor. It defaults to 8 step microstepping mode. (So if your motor is 200 full steps per revolution, you would get 1600 steps/rev using EasyDriver.) This setting can be easily overridden by tying the MS1 and/or MS2 pin to ground to set the driver to use 1/8, 1/4 or 1/2 microstep mode (See the datasheet for the table of values). It is a chopper microstepping driver based on the Allegro A3967 driver chip. For the complete specs of the design, read the A3967 datasheet. It has a variable max current from about 150mA/phase to 750mA/phase. It can take a maximum motor drive voltage of around 30V, and includes on-board 5V regulation, so only one supply is necessary. The best part - low cost. The parts cost is easily less than $10, even less if you make the board yourself.<br>http://www.schmalzhaus.com/EasyDriver/
<p>Thanks Groover, you've get me going. After a search on the internet your design suits me the best. I've made it mostly like you did but with a few differences.</p><p>First to mention is the laser. I've used a blue laser pulled out of a RGB laser pattern projector. The power lies on approx 250mW, I think (I don't have a LPM). Blue light transfers more energy so there is more burning power. Even on white! paper.</p><p>The programs I used:</p><p>-<strong>GBRL v09.j</strong> (for Arduino Uno library) *</p><p>-<strong>Inkscape 0.91</strong> (for pc)</p><p>-<strong>LaserEngraver</strong> (plugin for <strong>Inkscape</strong>) *</p><p>-<strong>UniversalGcodeSender v1.0.9</strong> (for pc)</p><p><br>Due to version differences of the programs I had to make some adjustments to some of them:</p><p><br><strong>GBRL</strong>, to switch the laser on and off (Gcode M03 and M05) the following has to be done before installation:</p><p><em>1a. Download <strong>GRBL</strong> sourcecode from github ( </em><a href="https://github.com/grbl/grbl" rel="nofollow"><em>https://github.com/grbl/grbl</em></a><em> )<br>2a. Extract zip File<br> 3a. Use Notepad++ and open the file called config.h (Folder: grbl-master\grbl)<br> 4a. Search for a line, that starts with &bdquo;#define VARIABLE_SPINDLE&ldquo;<br>5a. Comment this line out ( Use a double Slash // )<br> 6a. Save the File</em></p><p><br>-<strong>LaserEngraver</strong> plugin for <strong>Inkscape</strong> has a bug, to solve this read the following:</p><p><em>If you&rsquo;ve tried to use the modified Inkscape laser engraver plugin mentioned in this blog post about building an engraver, you may have run into an error trying to do the export. It&rsquo;s something like &ldquo;AttributeError: &lsquo;module&rsquo; object has no attribute &lsquo;unittouu&rsquo;&rdquo; or &ldquo;unittouu not part of inkex module&ldquo;. Here&rsquo;s the fix.</em></p><p><em>The bug is on line 3080 of laserengraver.py and broke due to an Inkscape change. Old line:</em></p><p><em>doc_height = inkex.unittouu(self.document.getroot().get('height'))</em></p><p><br><em>New line:</em></p><p><em>doc_height = self.unittouu(self.document.getroot().xpath('@height', namespaces=inkex.NSS)[0])</em></p><p><br><em>Be sure to have the exact same number of spaces/tabs on this line. In Python, whitespace is important, so you can&rsquo;t mix and match spaces and tabs, and all code blocks must have the same whitespace alignment.</em></p><p><em>Problem solved!</em></p><p>Your Gcode sender does not work so I have downloaded <strong>UniversalGcodeSender</strong>. This works fine and is simple to use.</p><p>I've added some foto's to show some details and a Youtube video where you can see some examples of engraving and cutting I did with it.</p><p>Now I know what to do I wil scale things up and start a new project with two flatbed scanner interiors an my 2W blue laser.</p><p>https://youtu.be/6A7YREqS-w8</p>
<p>Hey Thanks Venkes,</p><p>This is the very good All-in-1 Solution post you made.</p>
<p>Hi dear, I'm really excited about your project, I have read and searched for information to use GRBL but I can not make move my engines with it, will that use &quot;Adafruit Motor / Stepper / Servo Shield for Arduino Kit - v1.2&quot; if engines run libraries move, but if I do not work for me GRBL.<br><br>Do any of the users has made this project using the shield named?<br><br>Thanks I hope your understanding and prompt reply, thanks.</p>
<p>Use the GRBL of the given version or use from grbl's site and the controller</p>
<p>Hi Groover, nice pocket laser engraver. I would like to know what the work area is as I could find it in your instructions. Thanks</p>
<p>Its written 38mmx38mm</p>
<p>Hello you could spend some graphic as you do on and off the laser diode? I think it is a LM317</p>
<p>It is there, its a 5v relay.</p>
<p>ups I forgot also to ask: wich batteries could I use in this case? thank youuuu</p>
<p>Whats Soft i can use WITHOUT Isnkape? It was very stuped on my PC</p><p>Maybe to be any List of soft on PC for using with <strong>GBRL v09.j</strong> (for Arduino Uno library) ?</p>
<p>@jm.instructable</p><p>I think that the &quot;Adafruit Motor / Stepper / Servo Shield for Arduino Kit - v1.2&quot; you're trying to use is simular to the &quot;Velleman KA03&quot; I have experimented with. I coulden't get this one going as well because one cannot send Gcode to it, it seems. </p><p>You can get the steppers running using the Arduino Sketch, but you have to use GBRL and Gcode to stear the steppers in this project. The easyest way for you I think, is to buy two SchmalzHaus EasyDrivers (the're not expensive). This works! </p><p>See the detailed plan in my comment below and the one of Groover above to lighten up things. In my comment you can also see the adjustments you have to make to a few programs to get them correctly running. </p><p>Greets, </p><p>Venkes.</p>
<p>Thanks Groover, you've get me going. After a search on the internet your design suits me the best. I've made it mostly like you did but with a few differences.</p><p>First to mention is the laser. I've used a blue laser pulled out of a RGB laser pattern projector. The power lies on approx 250mW, I think (I don't have a LPM). Blue light transfers more energy so there is more burning power. Even on white! paper.</p><p>The programs I used:</p><p>-GBRL v09.j (for Arduino Uno library) *</p><p>-Inkscape 0.91 (for pc)</p><p>-LaserEngraver (plugin for Inkscape) *</p><p>-UniversalGcodeSender v1.0.9 (for pc)</p><p><br>Due to version differences of the programs I had to make some adjustments to some of them:</p><p><br>GBRL, to switch the laser on and off (Gcode M03 and M05) the following has to be done before installation:</p><p>1a. Download GRBL sourcecode from github ( <a href="https://github.com/grbl/grbl" rel="nofollow">https://github.com/grbl/grbl</a> )<br>2a. Extract zip File<br> 3a. Use Notepad++ and open the file called config.h (Folder: grbl-master\grbl)<br> 4a. Search for a line, that starts with &bdquo;#define VARIABLE_SPINDLE&ldquo;<br>5a. Comment this line out ( Use a double Slash // )<br> 6a. Save the File</p><p><br>-Laser Engraver plugin for Inkscape has a bug, to solve this read the following:</p><p>If you&rsquo;ve tried to use the modified Inkscape laser engraver plugin mentioned in this blog post about building an engraver, you may have run into an error trying to do the export. It&rsquo;s something like &ldquo;AttributeError: &lsquo;module&rsquo; object has no attribute &lsquo;unittouu&rsquo;&rdquo; or &ldquo;unittouu not part of inkex module&ldquo;. Here&rsquo;s the fix.</p><p>The bug is on line 3080 of laserengraver.py and broke due to an Inkscape change. Old line:</p><p>doc_height = inkex.unittouu(self.document.getroot().get('height'))</p><p><br>New line:</p><p>doc_height = self.unittouu(self.document.getroot().xpath('@height', namespaces=inkex.NSS)[0])</p><p><br>Be sure to have the exact same number of spaces/tabs on this line. In Python, whitespace is important, so you can&rsquo;t mix and match spaces and tabs, and all code blocks must have the same whitespace alignment.</p><p>Problem solved!</p><p>Your Gcode sender does not work so I have downloaded UniversalGcodeSender. This works fine and is simple to use.</p><p>I've added some foto's to show some details and a Youtube video where you can see some examples of engraving and cutting I did with it.</p><p>Now I know what to do I wil scale things up and start a new project with two flatbed scanner interiors an my 2W blue laser.</p><p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/6A7YREqS-w8" width="500"></iframe></p>
sry for Spam
und dann kommen die dioden tum Vorschein
be carefull theres a screw behind
first try with dvd drive and am cd
<p>hello, can i use laptop CD drives for this project?</p>
<p>Thank's, very nice job!!<br>Just question, how to differentiate the two led laser in DVD graver ?<br>The red laser we need has &quot;325...&quot; wirte on his case ?<br><br>And sorry for my bad english!</p>
<p>Thank you, sir. Nice job.</p><p>The EasyDriver board is available from www.banggood.com for $2.45 USD. I have purchased from them many times and they seem quite reliable.</p>
<p>Hi!!!</p><p>I made it!</p><p>Thank you Groover!</p><p>I use 2 DVD for X Y axis, arduino nano to control it.</p><p>Base from old FloppyDD</p><p>https://www.youtube.com/watch?v=FmCIZO7if4I</p>
<p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/lnjzDOvffsQ" width="500"></iframe></p><p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/IqdoYIK9t4w" width="500"></iframe></p>
<p>Correct link </p><p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/Rmt_z8QhTWg" width="500"></iframe></p>
<p>Hi,i try to make this project and i have a question for you , what is meen FAN from electronic schematic </p>
<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>SOLVED! Just download older version (32bit) of inkscape. Worked for me on win10</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>Since any printer has already made x/y axis base i used it :) one problem is that if you want to cut out lots of small pieces some of them tend to get stuck in there. Also added cheap 28byj motor to have z axis pen :) </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>

About This Instructable

1,241,395views

4,227favorites

License:

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: