loading

I built this two axis cnc-machine to use as a lazer-engraver. I'm waiting for the lazer at the moment, so this insutructable will be continued. For The first time I would like to show you how I wired all my components.

Step 1: Hardware

For the power supply, I use an old PC-Power-Supply with 16A. For the wiring I use 0.125mm (5V) and 1.5mm (12V 6A) cooper braid. The wiring is easy and done fast. The hardest part was to shield the wires from the motors. This was done by using aluminum foil around the wires and to insert an RC-Low-Pass-Filter between my limit switches and the input pins of the Arduino.

RC-Low-Pass-Filter

This sounds way more complicated than it is. Its just a resistor and a capacitor. Because I use grl, I can use the pull-up-pin-mode to get the resistor, so I just needed a capacitor. Grbl is using pull-up-pin-mode because this causes less distortion for the switches. That means, the switches do not forward +5V, they forward GND and the pins are pulled down from 5V to GND by triggering the switches. This capacitor should be something between 10uF and 0.47uF depending on the distortion. In my case I use a .47uF (50V) for the Y-axis and a 1uF (50V) for the X-axis. These small capacitors a polarised, so watch out to connect the GND part to GND, and plus to the limit-switch and the input pin.

This RC-Low-Pass-Filter filters our the signals with high frequency. So just low frequencies can pass through. That means your limit-switch signal is slower (you can not recognise without oscilloscope), but you do not read the distortion.

Step 2: Software

I use the grbl library to control the Arduino with simple G-Code.

Installation

  1. Download all the code from github/grbl.
  2. Download the config.h file I added underneath.
  3. Replace the config.h in grbl/grbl with my file (I used the file from MichielD99 and adjusted it to work properly with 2-axis)
  4. Pack the grbl folder (which is including the config.h file) to a ZIP-file.
  5. Goto your Arduino ide.
  6. Add the ZIP-file to the Arduino libraries.
  7. Remove the whole code of your sketch.
  8. Include the grbl library. (So you just have includes in your sketch)
  9. Compile and Flash to your Arduino.

Grbl-Controller

To send G-Code to the Arduino I use the old Grbl-Controller. Some of the functions do not work properly. To change the settings you have to use the $ commands because the grbl-library changed and the controller is really old. But it works for sending G-Code and moving the axis.

Configuration

Before the first use, we have to configure our Arduino with the machine-specific data. We have to adjust the steps per mm for our axis, if we want to use limit-switches and so on.

Todo so, enter the command $$, in the Command input field in the grbl-controller, to get a list of the possible settings. We have to enable the hard-limit-switches. This is done by entering $5 = 1. Now adjust all the other settings for your needs. In my case I just had to adjust the steps per mm for both axis ($100 and $101). For better homing behaviour you can also adjust the homing feed rates...

First try

After the configuration is done, enter $H in the command-field to start the homing-cycle for the machine. The machine should move each axis to the limit-switches twice. Once with fast and once with slow moving axis. (Depending on your configuration). After the machine did that, this are your zero-coordinates of your machine.

Whats next?

Now you are ready to generate some G-Code and load it into the Grbl-Controller.

Note: You always should do a homing ($H) and zero (by clicking the zero button) before starting any G-Code to get a proper result.

Step 3: Adaption

Spindle adaption

If you want to use this tutorial with a PWM-Signal to run your spindle or laser, leave all settings as they are. If you want to use a relay or just on / off your spindle or laser you have to change something in the config.h.

For on/off usage

change:

#define VARIABLE_SPINDLE

to:

// #define VARIABLE_SPINDLE

So just comment it out. After that you are able to use the Arduino pin 12 as an on/off for your relay.

Step 4: How It Work in Action

<p>Hey Chris .</p><p>bro need your help. In relay diagram you used a POT what is function of That POT ?</p><p>and can you share more specific circuit diagram of whole setup please please or guide me through this please</p>
<p>I'm not your bro, but ok :D The potty is jist to regulate the volgate of the laser. But you realy should use a driver-board for that. Do not regulate the current and voltage by hand!!! In step 1. is a complete wiring. What else do you need?</p>
<p>ahhh sorry for that :D yeah driver for laser is good step. i was confused with the circuit diagram by <a href="https://www.instructables.com/id/Arduino-Laser-Engraver-Wood-Design/" rel="nofollow">MichielD99</a>. i am also confused with your note &quot; <u>Note:</u> You always should do a homing ($H) and zero (by clicking the zero button) before starting any G-Code to get a proper result.&quot; what actually is meant by zero button ? need you help for completing this 2 axis..... please help and guide thank you.</p>
<p>this is the relay used by <a href="https://www.instructables.com/id/Arduino-Laser-Engraver-Wood-Design/" rel="nofollow">MichielD99</a> how to make connections from it with laser and arduino ?</p><p></p>
<p>To connect the relay to the arduino please read Step 3 Adaption. The &quot;Zero Button&quot; is in the GUI of the grbl-controller.</p>
<p>hey chris Thanks alot for your fast replies. few things more</p><p>there are three terminals at each side of relay on left are DC+ ,DC-, and IN. the pin 12 of arduino goes to IN terminal or DC+ ? -VE of supply goes to DC- right?</p><p>similarly on right side there are COM , NO, NC terminals. i guess laser is connected to Normally closed NC terminal and +ve of supply to com terminal</p><p>second thing if i am going to use driver the output of driver is 12V so will it replace the battery in your circuit is step 3 or will it be placed in place of POTTY <a href="https://www.instructables.com/member/Chris_Toph_Er" rel="nofollow">Chris_Toph_E</a>r ?</p><p>please do guide</p>
<p>It depends on what kind of relay you got. Please read this (https://en.wikipedia.org/wiki/Relay) artikle about Relays to understand how they work and how you can control them. Maybe you should first read more about elektronics. If you try to handle a laser, its really dangerous if you do not know what you are doing. You will get blind if you just try and error... The potty is replaced by the driver.</p>
<p>thanks once again for guiding chris. yeah i know little bit about electronis because am doing engineering in electrical.</p><p>so you said that potty will be replaced by driver so i made a sketch please have a look at it is sketch is it true <a href="https://www.instructables.com/member/Chris_Toph_Er" rel="nofollow">Chris_Toph_Er</a>? and which driver should i use the one mentioned by <a href="https://www.instructables.com/id/Arduino-Laser-Engraver-Wood-Design/" rel="nofollow">MichielD99</a> is good to be used right ?</p>
<p>It depends on what kind of relay you got. Please read this (https://en.wikipedia.org/wiki/Relay) artikle about Relays to understand how they work and how you can control them. Maybe you should first read more about elektronics. If you try to handle a laser, its really dangerous if you do not know what you are doing. You will get blind if you just try and error... The potty is replaced by the driver.</p>
Excellant thanks, i dont suppuse you have the code for arduino as a controller software aswel. As the ones ive found dont seem to work properly.
I will post this too, but atm I'm a little stressed ;)<br>I will make a complete tutorial how to setup everything in the next days ;)
<p>Thanks, ive tried numerous things, I got the axis moving via jog and got it to plot when sending a gcode file. But I cant get the spindle &quot;Relay&quot; to trigger using &quot;Grbl Controller 3.5.1&quot; I have also tried using other peoples versions of grbl and then the relay triggers but have other issues. So would appreciate it when you have time to do the tutorial. </p>
<p>Hey PC_Payn3, I explained how to use a Relay in my </p>Step 3: Adaption<p>Hope this helps.</p>
Thanks for that :) Is there not wires that link EN- to GND &amp; EN+ to arduino pin 8? Also can i use a 12v power rather than 24v.
<p>exact, no wires at EN- and EN+. Maybe its working with wires too, but in my case its working without. Yes you can use 12V if you want.</p>

About This Instructable

3,606views

74favorites

License:

More by Chris_Toph_Er:two axis CNC Raspberry Pi Port Expander 
Add instructable to: