Electric Diy Lab

Electronics DIY projects, Tutorial

Arduino project

GRBL CNC Shield + Z Axis servo MIGRBL

GRBL CNC SHIELD Z AXIS SERVO MIGRBL

Hello friends, In this post I’ll give a detail tutorial on how we can attached Servo to GRBL CNC shield and how we can generate Z axis servo friendly G-code by using MIGRBL inkscake extension.
In this way we can build a GRBL based CNC pen plotter machine or CNC drawing machine.

OVERVIEW

GRBL CNC SHIELD
GRBL CNC SHIELD

GRLB is the open source firmware freely available for every one, GRBL is used as firmware for CNC machine.

GRBL CNC Shield is used as controller for CNC machine, GRBL shield and GRBL firmware is very best for 3 axis stepper CNC machine.
But when we choose GRBL to build 2.5 axis CNC machines like pen plotter or CNC drawing machine we face a problem that there is not any provision to connect Servo to GRBL CNC shield.


Also default GRBL firmware also not have any facility to control servo motor for Z axis, but we have a hack version of GRBL version which support servo control.
Apart from all of this we also need one software which can convert our design into Z axis servo friendly G-code, For this we have a tool called MIGRBL INKSCAPE EXTENTION.

So below is the solution for how to use Z – azix servo with GRBL CNC shield

List of software and firmware to download

  1. MIGRBL Firmware (Normal GRBL does’t work download this only)
  2. Inkscape software 0.48.5 version
  3. MIGRBL inkscpae extention

As soon as you download all the above tools simply follow the below steps.

1. Uploading MIGRBL to Arduino

First of all unzip the downloaded file.
Now open the MIGRBL folder go to exmple>grblUpload>grblUpload.ino
double click on grblUpload.ino to open the code just simply compile and upload the code to arduino.
Be sure you have selected the correct port and board.
please delete if you already have any previous GRBL folder in Document>arduino>library folder.
Please note that GRBL will only work with arduino uno.
In this way GRBL firmware is successfully uploaded to arduino, next we will see how to connect servo motor to GRBL CNC shield.

2. Connecting Servo motor to GRBL CNC shield

GRBL CNC SHIELD AND SERVO MOTOR CONNECTION
GRBL CNC SHIELD AND SERVO MOTOR CONNECTION

Simply connect the 5V & GND wire of servo motor to 5V and GND pin on CNC shield.
PWM signal wire of servo motor need to connect at Z+ pin GRBL CNC shield.
In this way our wiring for GRBL CNC shield & servo motor.
If you notice a problem like arduino get reset when servo moves so give external 5V DC supply to servo motor.

3. Installing MIGRBL extension in Inkscape software

First of install the download inkscape version 0.48.5 software
Now download the MIGRBL Inkscape extension unzip the downloaded file
open the MIGRBL Inkscape extension folder copy all the four files.
Now got to C:\Program Files (x86)\Inkscape\share\extensions and paste here all the four files.
now open the inkscape software got to extension tab you will see here
MI GRBL Z-Axis servo controller this means the extension is installed successfully.

MIGRBL INKSCAPE EXTENSION
MIGRBL INKSCAPE EXTENSION


In any case you can’t find the extension at place or you get any error in g-code generation simply download this extension folder and replace with you existing extension folder with this

4. How to generate G-code

All process of installation is done now its time to generate G-code

  1. Open the Inkscape software
  2. Go to the file>Document properties
  3. Set the units to mm
  4. Set width and height of your plotting area and close the tab
  5. Now draw the design or drag and drop the image of your choice (If you have drawn something itself in inkscape skip to step 12)
  6. Now select the image and go to the path>trace bitmap
  7. Click ok and close the tab
  8. Now hold click on the image and drag the mouse
  9. A black and white image will separate from the original image
  10. Now delete the original image
  11. Drag the black and white image in center of the frame
  12. Again goto path>object to path
  13. Now go to Extensions tab and selec MI GRBL Z-Axis servo controller
  14. Change the values if needed
  15. Click on apply to generate the G-code
  16. Default location where you find the generated G code is C:\Users\Public
MI GRBL INKSCAPE EXTENSION
  • Servo up: Servo up G-code
  • Servo down: Servo down G-code (if servo move in opposite direction swip the M5 and M3 )
  • X axis speed: speed of X axis
  • Y axis speed: speed of Y axis
  • Angle for servo: set the value how much you need to up servo in angle 0 to 180
  • Delay: Servo up down delay keep it unchanged
  • Directory: the location where G-code file generate
  • Filename: default file name
  • Live preview: check to see live coordinates in inkscape

Example of GRBL CNC Shield + Z Axis servo MIGRBL

grbl based cnc machine

I hope you find this tutorial helpful for your project, if you have any question please ask in comment box.

52 Comments

  1. hub

    Can this will work with arduino megao ?

  2. driss

    Do we save the file in the form of G-code and end up
    Your answer concerns me
    thank you very much

  3. VAIBHAV MALVIYA

    SIR,
    THE 3D PRINTED CLAMPS PLEASE GIVE INFORMATION ABOUT THERE SIZE AND DIMENSIONS. AND WHERE TO GET THEM.
    PLEASE
    Thank you

  4. driss

    Everything became fine
    But when I sent Gicode via universal g-code sender Give me this message”Error expected command letter
    can you help me with a video because my is not very good
    thanks

  5. driss

    Everything became fine
    But when I sent Gicode via universal g-code sender Give me this message”Error expected command letter
    can you help me with a video because my English is not very good
    thanks

    • sandeep

      We are happy to help you, if you can please send some screen shot of the error it would very helpful to get some solution …

  6. driss

    can you give me watsapp

  7. samule

    plz help

  8. Smit

    How much volt of power supply should be given to Cnc shield???
    5,9or12
    Can you print me some 3d printed parts??

  9. Jorgelina

    Hola, me gustaría saber cual es el programa en Arduino que hay que cargar para que comience a realizar las impresiones (dibujos). O eso lo ha de realizar un programa aparte?

    • sandeep

      First you need to upload GRBL firmware to arduino, then after need to send G-code to arduino to draw image via any G-code sender software..

      • Rahul Ranjan

        Sir I need to know that can I send the g code using python to Arduino after uploading GRBL firmware to Arduino.
        If yes then how ??
        Please help me it will be great help fo my project……..
        I hope you will give me the right solution for my query……

  10. jawad

    hello sir ,every thing is working well except servo motor.its not working at all after all above procedure .Also i applied external power to servo.Now kindly help me

    • Jorgelina

      Hola, a mi me ocurre lo mismo. Pudiste encontrar el problema?
      Si es así, te agradecería mucho que me dijeras como hiciste para hacerlo funcionar.

      Gracias!!

  11. Kittisak

    hello sir Inkscape Mac OS How to setting MI GRBL Extension

  12. David

    What are the dimensions of the X, Y rail rods?

  13. agung sutrisno

    hello mr sandeep
    why after send command M3 S90 for move servo, my cnc stop. if i am try to re open port error connection. i am used universal Gcode sender V1.0.9
    iam need your advice

    • sandeep

      M3 S90 is command to operates Z axis servo
      This also heppens to me many times, so i figured out that when servo motor operates it drain more amps from arduino and reset the arduino due to over current, so I supply 5VDC to servo motor via LM7805 IC, I tap 12VDC from the main supply of GRBL CNC shield to LM7805 and supply 5V to servo motor in this way arduino free from load of this servo, you can do wiring as per the image shown in the link
      https://ibb.co/h8fhg6D

    • Rahul Ranjan

      Sir can I send g code using python to Arduino after uploading GRBL firmware to the Arduino… If yes then how??…
      Please help this will be a great help to my project….
      I hope you will give right solution to my query…
      Thank you

  14. agung sutrisno

    thanks for your adviced, i will try

  15. Congratulations especially for MIGRBL.
    It works really.
    I suppose that it should work also with Arduino Nano, Pro mini and other based on Atmega 328P am I right?

    What do You thing of using pair of L293D motor drivers for very low budget plotters based on mechanical parts od scrap CD/DVD Roms?

    I am working for such exercise for school elecronics / Ham Radio club as valuable arduino exercise.

    • sandeep

      Yes it can work with any Atmega 328P CPU, off course you cannot able to use grbl shield if using nano.
      for L293D you need adafruit motor driver shield and makerboat g-code extension for inkscape, and gctrl processing GUI, you cannot use GRBL in this case.

  16. Saeed

    Hi
    I followed all steps to create G code but when I want to send it via univresal g code sender it says the file is empty and sometime it have error
    and if its possible upload the g code for testing

    • sandeep

      You gcode file may be empty

      • Saeed

        it’s not
        when I open it by note pad it have this:

        M5
        G90
        G21
        G1 F2000
        G1 X31.5748 Y30.0769
        M3 S90
        G4 P1
        G1 F2000.000000
        G1 X31.5748 Y33.4808
        G1 X34.5817 Y33.4808
        G1 X34.5817 Y30.0769
        G1 X31.5748 Y30.0769
        M5
        G4 P1
        G1 F2000
        G1 X31.5748 Y9.3738
        M3 S90
        G4 P1
        G1 F2000.000000
        G1 X31.5748 Y26.8374
        G1 X34.5817 Y26.8374
        G1 X34.5817 Y9.3738
        G1 X31.5748 Y9.3738
        M5
        G4 P1
        G1 F2000
        G1 X6.6012 Y9.3738
        M3 S90
        G4 P1
        G1 F2000.000000
        G1 X16.0728 Y21.9371
        G1 X7.7204 Y33.4808
        G1 X11.5792 Y33.4808
        G1 X16.0227 Y27.2978
        G2 X17.3722 Y25.3503 I-52.0521 J-37.5103
        G2 X17.9938 Y24.3379 I-13.4227 J-8.9388
        G2 X18.8491 Y25.6277 I22.6974 J-14.1225
        G2 X19.9316 Y27.0841 I30.0285 J-21.1888
        G1 X24.8595 Y33.4808
        G1 X28.3842 Y33.4808
        G1 X19.7813 Y22.118
        G1 X29.0524 Y9.3738
        G1 X25.0433 Y9.3738
        G1 X18.8792 Y17.9741
        G2 X18.3707 Y18.7203 I29.7407 J20.8139
        G2 X17.8101 Y19.5856 I39.4373 J26.1632
        G2 X16.9804 Y18.2775 I-76.1046 J47.3535
        G2 X16.6408 Y17.7767 I-11.4842 J7.424
        G1 X10.4934 Y9.3738
        G1 X6.6012 Y9.3738
        M5
        G4 P1
        G1 F2000
        G1 X0 Y0

        but when I browse it to the program it says it’s empty

        • sandeep

          Gcode looks ok do one thing download Camotic gcode simulator from web and simulate you gcode if it’s proceed fine then problem is with not gcode do this and tell me the result

  17. RaRo

    How to connect the 28BYJ-48 unipolar stepper motor to the A4988 stepstick? The motor has 5 pins and the stepstick has 4 inputs.

  18. RaRo

    9V is ok!

    • sandeep

      It is not recommended as per data sheet , but I personally run it on 9V several times without any trouble..

      • RaRo

        OK! I’ll see how the engine will work.
        Why does the motor p rotate 1/4 turn when setting 2048 steps?

  19. Jorgelina

    Hola, buenas tardes. Segui todos los pasos y no logro hacer que el servomotor se mueva. Usted podría decirme cual sería el problema? Porque todo el resto funciona perfectamente, excepto el servomotor.

    GRACIAS!!!

  20. Sen K Mathew

    Hi Sir
    I am late commer.
    Sorry to disturb you. Could you please tell me how can I download MI Inscape Extention. The link is not working.

    Regards
    Sen

  21. sandeep

    Hi Sandeep,
    My Z-Axis is not working(Servo motor not at all moving). I have followed all your suggestions.

    Breaking my head to resolve this issue from last 15days.
    it seems, Pin Z+ not getting signal.
    I have changed Servos, CNC shields, Aurdino boards also. But no use.

    Could you please help me to resolve this issue.

    BR/Sandeep

  22. daniel

    Same issue here.
    uploaded the firmware to the arduino.
    plug motor as indicated, send command and no motion.

  23. Rick Paul

    Grbl compiles and all works fine except servo. Can ANYONE suggest what the problem is. Z axis motor still responds to gcode but no servo movement. Servo is
    wired as shown above

  24. Gabriel

    Hi, i have a problem in grbl controller that says “buffer size too small, process interrupted” why i have this problem and how i can solve it?

    • sandeep

      This is not any problem it just a massage from IDE, you can uplode the grbl & ignore the massage

      • gabriel

        i can send a image of the error to yor gmail? because i cant skip the message and that stop the machine

  25. Alex Junio

    Olá,
    Estou com problema no servo ele só desce para o angulo zero e fica travado, quando realizo os comandos M3 ele trava em zero e M5 ele destrava mas não sobe o eixo.
    Você saberia me responder o porque disto? Tentei ja trocar servo mas a mesma coisa a extensão tbm

Leave a Reply

Enter Captcha Here : *

Reload Image

Theme by Anders Norén