MINI 3 AXIS CNC PLOTTER(GRBL)

by hyper_makes in Workshop > CNC

8252 Views, 52 Favorites, 0 Comments

MINI 3 AXIS CNC PLOTTER(GRBL)

Mini CNC 3 Axis Plotter plot test2 | GRBL

Greetings fellow maker!

In this instructable you will learn about how to make a mini cnc plotter out of scratch and electronics components. You will also learn about basic electronics skills and cnc skills associated with the project.

You can follow up the updates i did before about this project at my Instagram page @hyper_makes

More importantly this is a very detailed instructable and you can't just fly through steps so take your time. :)

"I walked so that you can run"

-Pewdiepie 2020

Supplies

These are the things required for making this project:

  • HARDWARE

Beginner/Intermediate:

3 X Old DVD motor carriages

1 X CNC Shield V4

1 X Arduino Nano

3 X A4988 stepper driver module

2 or 3 X Limit switches

12V Power supply

USB A to mini B cable

Ribbon cable for stepper motors and limit switches

Expert:

3 X Old DVD motor carriages

1 X 6x8cm Prototying board(minimum area size)

1 X Arduino Nano

3 X A4988 stepper driver module

2 or 3 X Limit switches

1 X PCB mount toggle switch

Male and Female header pins

1 X LED(for power indicator)

1 X L7805 voltage regulator

1 X 5.5mm DC Jack

12V Power supply

USB A to mini B cable

28 SWG Enamelled copper wire or Single core strand hookup wire

Ribbon cable for stepper motors and limit switches

SOFTWARE:

GRBL code

UGS(Universal Gcode Sender)

TOOLS:

Soldering Iron

Solder wire

Flux

Hot glue gun

Super glue

Acrylic sheet or Aluminium Composite

A Little Light on Key Knowledge...

0J7808.1200.jpg
Nkdv_aU1.png
What-is-a-CNC-Machine1.jpg

What is CNC?

Computer Numerical Control(CNC) is the automated control of machining tools and 3D printers by means of a computer. A CNC machine processes a piece of material to meet specifications by following a coded programmed instruction and without a manual operator.

What is GRBL?

Grbl is a no-compromise, high performance, low cost alternative to parallel-port-based motion control for CNC milling. This version of Grbl runs on an Arduino with a 328p processor (Uno, Duemilanove, Nano, Micro, etc).

The controller is written in highly optimized C utilizing every clever feature of the AVR-chips to achieve precise timing and asynchronous operation. It is able to maintain up to 30kHz of stable, jitter free control pulses. It accepts standards-compliant g-code and has been tested with the output of several CAM tools with no problems. Arcs, circles and helical motion are fully supported, as well as, all other primary g-code commands. Macro functions, variables, and most canned cycles are not supported, but we think GUIs can do a much better job at translating them into straight g-code anyhow.

What is Arduino?

Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.

Making the Plotter Carriage

IMG_20190322_181831.jpg
IMG_20200623_203253.jpg

For making the plotter carriage you will need 3 X DVD carriages and acrylic sheet.

Talking about design you can build any design you want. Just type mini cnc plotter or writing machine in youtube for videos. My design is based on this video.

You can follow any design but make sure the carriages move freely upon moving them manually.

Not a Step(Insight on Previous Version)

IMG_20190907_235511.jpg
IMG_20190322_190015.jpg
IMG_20190908_020202.jpg

This was the previous version circuit board which was made using L293D H bridges for driving the stepper motor. The problem was it was not compatible with GRBL normally and the resolution was low. The movement was also not smooth and jittery. So, i decided to upgrade this circuit board with A4988 stepper modules. I was also trying to make this project using Bluetooth module but the problem with Arduino Nano is, it has serious communication problems with bluetooth module while using real time GRBL so i dropped the idea.

Making the Circuit Board(Upgraded)

cnc_v4_1.PNG
cnc_v4_2.PNG
cnc_v4_3.PNG
IMG_20200623_202934.jpg
IMG_20200628_011122.jpg
IMG_20200628_011255.jpg
IMG_20200628_011225.jpg

For making the circuit board we need:

Beginner/Intermediate:

1 X CNC Shield V4

1 X Arduino Nano

3 X A4988 stepper driver

Insert the three stepper driver modules in the respective places and Arduino nano to its place.

That's all for the beginners.

Expert:

1 X 6x8cm Prototying board(minimum area size)

1 X Arduino Nano

3 X A4988 stepper driver module

2 or 3 X Limit switches

1 X PCB mount toggle switch

Male and Female header pins

1 X LED(for power indicator)

1 X L7805 voltage regulator

1 X 5.5mm DC Jack

For making the circuit board you have to follow the circuit diagram attached(Credit) below to this step.

It's pretty straight forward so, just follow the circuit diagram and do all the connections.

Make the Z-Axis

IMG_20200623_203643.jpg
IMG_20200706_162110.jpg
IMG_20200708_193647.jpg

The Z-Axis is made from 3D printed parts.

If you own a 3D printer then just download the STL files from the link given below and start printing.

If not then inquire for a 3D printing service provider or you can cut out the necessary shapes from acrylic sheet or aluminium composite.

I am attaching a full plotter STL files link and individual STL files too. Choose accordingly :)

FULL PLOTTER FILES:Thing

Z-AXIS FILES: ATTACHED BELOW

Adding the Limit Switches

IMG_20200705_163230.jpg
IMG_20200705_163543.jpg

According to the circuit diagram you should add limit switch to both the ends of the axes. In my case i have attached only one limit switch per axis because it is not a heavy machinery which can harm itself if not setup correctly. It just does the job XD.

For the wiring diagram of the limit switches i am attaching a link to the original Wiki of GRBL which is HERE.

Setting Up GRBL on Your Nano

grbllink.PNG
Capture.PNG
Capture.PNG
Capture.PNG
Capture.PNG

First download GRBL setup from HERE and scroll down to see the download links and download the zip file.

Open the zip file and extract it. Open the folder and you will find a folder named 'grbl'. Copy the folder and paste it inside your Arduino libraries folder.

------------------------------------------------------------------------------------------------------------------------------------------------------

DO THIS IMPORTANT STEP, WHICH WILL HELP US LATER!!!(SEE STEP 10)

After that open 'grbl' folder and find 'config.h' and open it.(using Wordpad because we dont want to change the extension)

Find the homing cycle statement and comment the Homing cycle 0(Z-axis) and uncomment and rename the Homing cycle 1(X and Y axes) to Homing cycle 0.(SEE ATTACHED PHOTO FOR CLEAR UNDERSTANDING)

------------------------------------------------------------------------------------------------------------------------------------------------------

After that open your Arduino IDE and open examples. You will find the 'grblUpload' example. Connect your Nano to your computer using USB cable and upload the example to your Nano. It should show 'code uploaded successfully'.

After that close the IDE.

LOOK UP PHOTOS ATTACHED IF YOU ARE HAVING PROBLEMS.

Download UGS and Configure GRBL Settings

Capture.PNG
Capture.PNG
Capture.PNG

PRE-REQUISITE: YOU NEED JAVA 8+ IN YOUR COMPUTER FOR UGS TO WORK!

Download the UGS zip file from HERE.(You can select any version of your choice but the classic one is recommended.)

After downloading extract the zip file in a new folder and name it as you like.(preferably 'UGS')

Open the executable .jar file and select the baud rate and serial port for communication. Then click on 'Open'.

THE DEFAULT BAUD RATE IS 115200.

After connecting the nano to UGS, it is time to configure GRBL for your plotter.

I SUGGEST TO READ ABOUT GRBL SETTINGS HERE AND UNDERSTAND THEM BEFORE CONTINUING.

In the command window type: $$. The UGS should spit out the current default settings on your nano. Then type the "command=value" and hit enter to set the new value. For example: $100=80 then Enter.

-------------------------------------------------------------------------------

MY GRBL SETTINGS ARE BELOW:

$0=10 (step pulse, usec)

$1=25 (step idle delay, msec)

$2=0 (step port invert mask:00000000)

$3=2 (dir port invert mask:00000010)

$4=0 (step enable invert, bool)

$5=0 (limit pins invert, bool)

$6=0 (probe pin invert, bool)

$10=1 (status report mask:00000001)

$11=0.010 (junction deviation, mm)

$12=0.002 (arc tolerance, mm)

$13=0 (report inches, bool)

$20=0 (soft limits, bool)

$21=1 (hard limits, bool)

$22=1 (homing cycle, bool)

$23=3 (homing dir invert mask:00000011)

$24=25.000 (homing feed, mm/min)

$25=500.000 (homing seek, mm/min)

$26=250 (homing debounce, msec)

$27=1.000 (homing pull-off, mm)

$30=1000 (rpm max)

$31=0 (rpm min)

$32=0 (laser mode)

$100=80.000 (x, step/mm)

$101=80.000 (y, step/mm)

$102=80.000 (z, step/mm)

$110=10000.000 (x max rate, mm/min)

$111=10000.000 (y max rate, mm/min)

$112=10000.000 (z max rate, mm/min)

$120=2500.000 (x accel, mm/sec^2)

$121=2500.000 (y accel, mm/sec^2)

$122=5000.000 (z accel, mm/sec^2)

$130=32.000 (x max travel, mm)

$131=40.000 (y max travel, mm)

$132=200.000 (z max travel, mm)

-------------------------------------------------------------------------------

SMALL TIP FROM ME:

To calculate the step/mm for your DVD stepper motor the formula is:

(Steps for one rotation x Number of microsteps) / Pitch of leadscrew of motor = steps/mm.

For example: Steps for one rotation for normal DVD motor = 20 steps

Number of microsteps i have used = 8 steps

Pitch of my DVD motor = 2mm(Pitch: Linear distance traveled by lead for one rotation)

Then my final steps/mm is = (20 x 8) / 2

= 80 steps/mm

LOOK UP PHOTOS ATTACHED IF YOU ARE HAVING PROBLEMS.

Setting Up Micro-stepping and Current Limiting

IMG_20200628_011204.jpg
Capture.PNG
Capture.PNG
Capture.PNG
Capture.PNG
Capture.PNG

ALL CREDIT GOES TO lastminuteengineers.com FOR THE INFO. IF YOU WANT TO KNOW MORE DETAILS THEN CLICK HERE.

MICRO-STEPPING:

The A4988 driver allows microstepping by allowing intermediate step locations. This is achieved by energizing the coils with intermediate current levels.

For example, if you choose to drive DVD stepper motor having 20 steps per revolution in quarter-step mode, the motor will give 80 microsteps per revolution.

The A4988 driver has three step size(resolution) selector inputs viz. MS1, MS2 & MS3 . By setting appropriate logic levels to these pins we can set the motors to one of the five step resolutions.

These three microstep selection pins are pulled LOW by internal pull-down resistors, so if we leave them disconnected, the motor will operate in full step mode.

CURRENT LIMITING:

Before using the motor, there’s a small adjustment that we need to make. We need to limit the maximum amount of current flowing through the stepper coils and prevent it from exceeding the motor’s rated current.

There’s a small trimmer potentiometer on the A4988 driver that can be used to set the current limit. You should set the current limit to be at or lower than the current rating of the motor.

  • The method for limiting the current per coil is:

We are going to set the current limit by measuring the voltage (Vref) on the “ref” pin.

  1. Take a look at the datasheet for your stepper motor. Note down it’s rated current. In our case we are using DVD stepper motor 20steps/rev, 12V 300mA.
  2. Put the driver into full-step mode by leaving the three microstep selection pins disconnected.
  3. Hold the motor at a fixed position by not clocking the STEP input.
  4. Measure the voltage (Vref) on the metal trimmer pot itself while you adjust it.
  5. Adjust the Vref voltage using the formula

FORMULA: Current Limit = Vref x 2.5

For our case:

Vref = Current Limit / 2.5

Vref = 0.3(300mA) / 2.5

= 0.12(Set this value for DVD stepper motor)

LOOK UP PHOTOS ATTACHED IF YOU ARE HAVING PROBLEMS.

Connecting Plotter and Circuit Board Together and Setting Up Homing Sequence

Mini CNC 3 Axis Plotter Homing test | GRBL
IMG_20200705_163051.jpg
IMG_20200715_224510.jpg
IMG_20200715_224631.jpg
Capture.PNG

ALL CREDIT GOES TO GRBL/Wiki FOR THE INFO. IF YOU WANT TO KNOW MORE DETAILS THEN CLICK

HERE.

Connect the plotter to the circuit board and then connect it to the computer.

Open UGS and connect the plotter to UGS.

SETTING HOMING CYCLE:

3 digital input pins are used for signaling Grbl:

  • Pin 9 X Axis limit/Home input pin
  • Pin 10 Y Axis limit/Home input pin
  • Pin 12 Z Axis limit/Home input pin

Limit switches usually have three terminals. One is common terminal, one is normally open to common terminal and another one is normally closed to common. In this case, we are going to use two terminals, normally open (NO) and common (COM). Use of NC instead of NO is enabled by configuring $5=1. All the common lines go to the arduino's GND, the NO lines go to the pin for that axis.(GO TO STEP 6 FOR LIMIT SWITCH WIRING)

Homing is controlled by parameter $22. Type $22=1 to enable it, $22=0 to disable it. Homing can be triggered by typing $H.

The homing directions are controlled by setting $23.(SEE ATTACHED PHOTO FOR SETTING)

***Homing cycle steps:

By default, the homing cycle goes through the following steps:

  • Z axis
  1. Z Axis will move up (positive) with Fast Rate ($25)
  2. When Z home switch triggered, Z stop for a short time ($26) and back off a distance ($27)
  3. Z Axis will move up slowly util it touches the Z home switch again ($24)
  4. Z Axis backs off a small distance ($27)
  • X and Y axis
  1. X, Y Axis move both to Homing direction at fast rate ($25)
  2. The first Axis triggers the switch will stop and wait for the second axis to trigger
  3. When second axis triggers the switch, both axis back off a distance ($27)
  4. Both X and Y axis will move toward switches again slowly, until both switches triggered again ($24)
  5. Both X and Y axis will back off a small distance ($27)

But for our plotter we have to change a small part of code:

WHICH WE DID IN STEP 7!!!

***Homing Speed:

As described above, homing is done in two distinct phases per axis: feed and seek. The feed speed is controlled by setting $25. In this phase, GRBL is just trying to find the limit switch within a reasonable amount of time.
After the feed phase, the seek phase does exactly the same thing, but at a low speed, controlled by setting $24. This phase is all about accurately finding the trigger point for the limit switch.

***Homing Travel:

GRBL will give up searching for a limit switch after 1.5x the max travel distance. The max travel distance is controlled by $130, (for x), $131 (for y) and $132 (for z). These numbers are also used for soft-limits, and should be set slightly below the length of your axes.
After the feed phase, the axis moves back a little, to un-trigger the switch. This distance is controlled by setting $27. Set this number high enough so the limit switch is cleared, even when the feed phase overshoots.

***Enabling Hard Limits:

To enable hard limits just type $21=1 in command box.

LOOK UP PHOTOS ATTACHED IF YOU ARE HAVING PROBLEMS.

Final Step: Plot Tests and Results for Fine Tuning

Capture.PNG
Mini CNC 3 Axis Plotter XY movement test | GRBL
Mini CNC 3 Axis Plotter plot test1 | GRBL
IMG_20200716_010500.jpg
IMG_20200716_010658.jpg

Open UGS and connect your plotter.(If already not connected at the start of previous step)

Initiate Homing cycle by pressing on '$H' button in UGS or type '$H' in command box. This should start the Homing cycle for the plotter.(SEE ATTACHED PHOTO)

------------------------------------------------------------------------------------------------------------------------

I HAVE NOT EXPLAINED HOW TO MAKE GCODE BECAUSE IT IS A LONG TOPIC TOO LIKE THIS ONE. SO IF U WANT TO LEARN HOW TO MAKE GCODE, JUST SEARCH FOR "HOW TO MAKE GCODE" IN YOUTUBE AND YOU WILL FIND[ I HOPE ;) ] THE NECESSARY DETAILS... OR IF NOT COMMENT DOWN BELOW IF YOU GUYS NEED AN INSTRUCTABLE FOR THAT.

------------------------------------------------------------------------------------------------------------------------

Then click on the 'Browse' button in UGS and select the Gcode you want to plot. Then click 'Send'.

You will see your plotter moving and plotting the Gcode you selected.

And your Mini CNC 3-Axis plotter is complete! ;)

If you face in problems, be sure to comment down below. I will try my best to help.