Welcome to Our Community

Some features disabled for guests. Register Today.

Ask Grbl CNC questions here.

Discussion in 'Control Software' started by Sonny Jeon, Aug 12, 2015.

  1. MrSurly

    MrSurly New
    Builder

    Joined:
    Jul 20, 2016
    Messages:
    11
    Likes Received:
    0
    Hi jbell,

    Not sure if you're aware exactly of what GRBL does, so here goes.

    Just so you know, GRBL is a fairly low-level program that sends the actual movement commands to the stepper motors. You would usually use it if you're building your own machine.

    GRBL doesn't have a user-friendly GUI (thought it does have a CLI you can access), and is intended to be used with a more friendly front-end such as ChiliPepper, cncjs, etc.

    Something like this:

    [ ChiliPeppr ] <-- (LAN, internet, or local connection) --> [ controller CPU (e.g. Raspberry Pi) ] <-- serial port --> [ Arduino (running GRBL) ] <--> [ CNC Hardware (Stepper drivers, spindle control, limit switches, etc) ]

    This is a gross simplification. Nothing mentioned above is really involved in doing the actual design (i.e. from a CAD program, for example).

    HTH
     
  2. Joe Pineapples

    Builder

    Joined:
    Jul 26, 2016
    Messages:
    15
    Likes Received:
    1
    Well, that didn't seem to go very well at all :(
    I did manage to find and download the GRBL.zip (thanks Sonny), followed the Wiki installation procedure as best as I could (I didn't understand the instruction about selecting a serial port, I'm using a USB to connect the mega2560) and tried to upload to the mega.
    An orange strip appeared at the bottom of the screen stating: "Error compiling for board arduino/genuino Mega or Mega 2560"

    Any ideas what I should do now?
     
  3. Joe Pineapples

    Builder

    Joined:
    Jul 26, 2016
    Messages:
    15
    Likes Received:
    1
    I copied the error messages-

    Arduino: 1.6.8 (Windows XP), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

    In file included from C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl/grbl.h:43:0,

    from C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\examples\grblUpload\grblUpload.ino:27:

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl/nuts_bolts.h:25:0: warning: "false" redefined

    #define false 0

    ^

    In file included from C:\Documents and Settings\User\Local Settings\Application Data\Arduino15\packages\arduino\hardware\avr\1.6.12\cores\arduino/Arduino.h:24:0,

    from sketch\grblUpload.ino.cpp:1:

    c:\documents and settings\user\local settings\application data\arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.3-arduino2\lib\gcc\avr\4.9.2\include\stdbool.h:42:0: note: this is the location of the previous definition

    #define false false

    ^

    In file included from C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl/grbl.h:43:0,

    from C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\examples\grblUpload\grblUpload.ino:27:

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl/nuts_bolts.h:26:0: warning: "true" redefined

    #define true 1

    ^

    In file included from C:\Documents and Settings\User\Local Settings\Application Data\Arduino15\packages\arduino\hardware\avr\1.6.12\cores\arduino/Arduino.h:24:0,

    from sketch\grblUpload.ino.cpp:1:

    c:\documents and settings\user\local settings\application data\arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.3-arduino2\lib\gcc\avr\4.9.2\include\stdbool.h:43:0: note: this is the location of the previous definition

    #define true true

    ^

    In file included from C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl/grbl.h:43:0,

    from C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\examples\grblUpload\grblUpload.ino:27:

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl/nuts_bolts.h:51:0: warning: "max" redefined

    #define max(a,b) (((a) > (b)) ? (a) : (b))

    ^

    In file included from sketch\grblUpload.ino.cpp:1:0:

    C:\Documents and Settings\User\Local Settings\Application Data\Arduino15\packages\arduino\hardware\avr\1.6.12\cores\arduino/Arduino.h:85:0: note: this is the location of the previous definition

    #define max(a,b) ((a)>(b)?(a):(b))

    ^

    In file included from C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl/grbl.h:43:0,

    from C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\examples\grblUpload\grblUpload.ino:27:

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl/nuts_bolts.h:52:0: warning: "min" redefined

    #define min(a,b) (((a) < (b)) ? (a) : (b))

    ^

    In file included from sketch\grblUpload.ino.cpp:1:0:

    C:\Documents and Settings\User\Local Settings\Application Data\Arduino15\packages\arduino\hardware\avr\1.6.12\cores\arduino/Arduino.h:84:0: note: this is the location of the previous definition

    #define min(a,b) ((a)<(b)?(a):(b))

    ^

    In file included from C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl/grbl.h:43:0,

    from C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\examples\grblUpload\grblUpload.ino:27:

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl/nuts_bolts.h:55:0: warning: "bit" redefined

    #define bit(n) (1 << n)

    ^

    In file included from sketch\grblUpload.ino.cpp:1:0:

    C:\Documents and Settings\User\Local Settings\Application Data\Arduino15\packages\arduino\hardware\avr\1.6.12\cores\arduino/Arduino.h:115:0: note: this is the location of the previous definition

    #define bit(b) (1UL << (b))

    ^

    In file included from C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\grbl.h:31:0,

    from C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\serial.c:22:

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\serial.c: In function 'USART_UDRE_vect':

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\cpu_map/cpu_map_atmega328p.h:34:23: warning: 'USART_UDRE_vect' appears to be a misspelled signal handler, missing __vector prefix [-Wmisspelled-isr]

    #define SERIAL_UDRE USART_UDRE_vect

    ^

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\serial.c:105:5: note: in expansion of macro 'SERIAL_UDRE'

    ISR(SERIAL_UDRE)

    ^

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\serial.c: In function 'USART_RX_vect':

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\cpu_map/cpu_map_atmega328p.h:33:23: warning: 'USART_RX_vect' appears to be a misspelled signal handler, missing __vector prefix [-Wmisspelled-isr]

    #define SERIAL_RX USART_RX_vect

    ^

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\serial.c:159:5: note: in expansion of macro 'SERIAL_RX'

    ISR(SERIAL_RX)

    ^

    In function 'USART_RX_vect':

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\serial.c:159:1: warning: 'USART_RX_vect' appears to be a misspelled signal handler, missing __vector prefix [-Wmisspelled-isr]

    ISR(SERIAL_RX)

    ^

    In function 'USART_UDRE_vect':

    C:\Documents and Settings\User\My Documents\Arduino\libraries\grbl\serial.c:105:1: warning: 'USART_UDRE_vect' appears to be a misspelled signal handler, missing __vector prefix [-Wmisspelled-isr]

    ISR(SERIAL_UDRE)

    ^

    C:\Documents and Settings\User\Local Settings\Application Data\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.3-arduino2/bin/avr-objcopy:C:\DOCUME~1\User\LOCALS~1\Temp\build19f31ea00fa25c69f2eaba22ba7497e1.tmp/grblUpload.ino.elf: Permission denied

    exit status 1
    Error compiling for board Arduino/Genuino Mega or Mega 2560.

    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.
     
  4. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,435
    Likes Received:
    1,908
    You are in luck since I was messing with this yesterday.....

    on this page GitHub - grbl/grbl: An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino click the 'clone or download' button at right (it is green)
    1. select 'download zip'
    2. open the zip
    3. in the zip, find the 'grbl' folder and drag and drop that into your arduino sketchbook library folder, something like 'my documents/sketchbook/libraries'. in my case I end up with a full path of C:\Users\david\Documents\Arduino\libraries\grbl
    4. open the config.h file (in Notepad, from that folder) and make changes to select the Mega build.
      Specifically, the line
      #define CPU_MAP_ATMEGA328P // Arduino Uno CPU
      must change to
      #define CPU_MAP_ATMEGA2560
      and you will need to read the file
      cpu_map/cpu_map_atmega2560.h
      to figure out what the pinouts are. They DO NOT match the Arduio UNO pinouts.
    5. open Arduino IDE
    6. open File|Examples|grbl|grblUpload
    7. select the Mega2560 board under Tools|Board
    8. select the correct serial port
    9. compile
    10. upload
    Now, a question for @Sonny Jeon : how does one have grbl 0.9j and grbl v1 for the Mega2560 co-exist in the libraries folder? I put one in as folder grbl09 and the other as grbl2560 but can only compile grbl2560 since the IDE helpfully autoselects *that* library, always, and compile fails for grbl09.
     
  5. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,435
    Likes Received:
    1,908
    on selecting a serial port: @Joe Pineapples
    When the Arduino is plugged in to the USB port, it creates a serial port (USB can do many things, serial ports are jut one of them)
    Here is what it looks like with no Arduino plugged in, my PC has an actual serial port COM1 and COM3 is a virtual port for virtual machines.
    noserial.png

    and when I plug in an Arduino UNO that has appeared as COM11, they usually have high numbers
    withuno.png
     
  6. Joe Pineapples

    Builder

    Joined:
    Jul 26, 2016
    Messages:
    15
    Likes Received:
    1
    Thanks Dave, I'd already read/heard about altering the config.h file, from several sources but with no indication of where to find it, I thought (for no real reason) it would be visible in the IDE at some point!

    Will have to wait until I get from work tonight before I can try again.
     
    #246 Joe Pineapples, Jul 27, 2016
    Last edited: Jul 27, 2016
    David the swarfer likes this.
  7. Joe Pineapples

    Builder

    Joined:
    Jul 26, 2016
    Messages:
    15
    Likes Received:
    1
    @Dave, I altered the file and clicked upload. No error message this time but after the green compiling meter/bar filled up and disappeared, it still says "Uploading" in the blue bar at the bottom. It's been this way for about 15 min now. I'm thinking that something still hasn't gone smoothly.
     
  8. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,435
    Likes Received:
    1,908
    Google tells me this is often related to selecting the incorrect board/chip. So make sure you have an Arduino UNO with an Atmega328p chip, and also make sure you have selected that type of board in the ArduinoIDE.

    board.png
     
  9. Joe Pineapples

    Builder

    Joined:
    Jul 26, 2016
    Messages:
    15
    Likes Received:
    1
    I don't though, I have a Mega2560!
    It looks like this may be my problem... [SOLVED]no programmer has been specified on the command line or the config file - Page 2
    Will have another look tonight. Thanks again for response.
     
  10. Bob K

    Bob K New
    Builder

    Joined:
    Jun 2, 2016
    Messages:
    55
    Likes Received:
    20
    Has anyone put GRBL on an Azteeg X3pro?

    Thanks to this forum I've been able to compile & upload GRBL to my controller but it's not talking on the USB port.

    I'm not looking forward to modifying the cpu_map_atmega2560.h. I definitely have not figured out how/where the physical pins are named (assigned a digital pin number) in GRBL or in Marlin (that firmware seems to work fine).

    Bob
     
  11. MrSurly

    MrSurly New
    Builder

    Joined:
    Jul 20, 2016
    Messages:
    11
    Likes Received:
    0
    Hi Bob,

    AFAIK, GRBL only uses the serial TX and RX pins for comms. GRBL itself doesn't use any Arduino code, and isn't set up to have the USB emulate a serial port for the Mega2560. I'm sure Sonny can confirm/deny.
     
  12. Bob K

    Bob K New
    Builder

    Joined:
    Jun 2, 2016
    Messages:
    55
    Likes Received:
    20
    I was surprised to see only three steppers defined in the cpu_map_atmega328p.h & cpu_map_atmega2560.h files. Can you point me to a GRBL that has more stepper ports defined?

    Bob
     
  13. MrSurly

    MrSurly New
    Builder

    Joined:
    Jul 20, 2016
    Messages:
    11
    Likes Received:
    0
    Do you need more stepper motors, or more axes? If the former, you can just pair one output to multiple stepper drivers; this is common for gantry setups that have more than one stepper for an axis.
     
  14. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    Not sure. Haven't tested it, but I think the Arduino IDE looks for everything in its library path. So, if you have multiple things with the same name/function calls, then you may have problems. I've always erased the old library and added a new one, whenever compiling Grbl via the IDE.
     
  15. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    Correct. Grbl only uses the serial TX/RX pins for comms and does not use any Arduino code. It just uses the Arduino IDE to easily compile and upload Grbl.
     
  16. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    Grbl only supports 3-axes or less. If you have two motors on one axis (gantry-style CNC), then you just need to wire the stepper drivers to the same pins and have the motors output in opposite direction (if needed).
     
  17. Joe Pineapples

    Builder

    Joined:
    Jul 26, 2016
    Messages:
    15
    Likes Received:
    1
    Well, I tried rolling back the AVR board version to 1.6.10 and when that didn't fix the problem I took it further back to 1.6.9 but it still isn't working.
    There are fewer orange error contents now though, so it's getting somewhere at least.
    I'm considering throwing the Mega2560 in the bin and just buying an UNO. Are there ever issues like this when uploading to the UNO?
     
  18. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    Honestly, I'm not sure why you are having so much trouble uploading Grbl to an Arduino. It's fairly straight-forward. First, is Grbl successfully compiling? If so, it's not a Grbl problem, but an Arduino/host computer issue. Second, do you have an authentic Arduino Mega or a clone? Third, I've run into a problem with USB 3.0 ports. If you are connected to USB 3.0, try a USB 2.0 port or hub. It seems to fix weird issues like this one.
     
  19. Bob K

    Bob K New
    Builder

    Joined:
    Jun 2, 2016
    Messages:
    55
    Likes Received:
    20
    Joe - I ran into a GRBL that sort of works on my 2560 based Azteeg X3pro:
    The Shapeoko Forum • View topic - GRBL on Mega2560 - Solution

    With this one I was eventually able to upload it to my board, have it talk to GRBL Controller and spin the X stepper motor. It looks like that's all I'll ever be able to do with it as my hardware isn't compatible with how GRBL maps I/O. Specifically all the step and direction pins must be in one port. My board has them scattered all over the place.

    With the 0.9i from the main page (GitHub - grbl/grbl: An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino) I could modify, compile & upload to my board but I couldn't get it to talk to GRBL Controller. There were no error messages.

    Looks like I need to buy a different controller board for my build.

    Bob
     
  20. Joe Pineapples

    Builder

    Joined:
    Jul 26, 2016
    Messages:
    15
    Likes Received:
    1
    It appears that the problem may have been with the old laptop I was using. I've just tried to upload GRBL at work from a desktop PC and I think it might have worked. I'm not entirely sure though because there are a couple of lines at the bottom of the screen which mention something about invalid libraries for GRBL.
    Took a shot of the screen in case it means anything to others on here...
     

    Attached Files:

  21. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,435
    Likes Received:
    1,908
    Thanks. I did solve it by changing all occurances of grbl.h to grbl2560.h .. folder must be that name too, and the .ino file name must also change along with its folder. easy enough with a Notepad++ 'replace in files' function.
    so now I have 2 folders
    grbl/
    grbl2560/
     
  22. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    It looks like you added the wrong folder. You need to add the folder that is inside the grbl-master folder named grbl. The wiki page should have pointed that out. Remove all of the grbl folders in the Arduino library directory and try again by adding the correct folder.
     
  23. Joe Pineapples

    Builder

    Joined:
    Jul 26, 2016
    Messages:
    15
    Likes Received:
    1
    That's exactly what I did, loaded the GRBL folder that was within the GRBL-master folder. How do I remove folders from the arduino library?
     
  24. IanW

    IanW New
    Builder

    Joined:
    Jul 31, 2016
    Messages:
    4
    Likes Received:
    0
    Hi, I'm new to the forum but have recently converted my benchtop mill to GRBL as I don't really have space near it for a full PC (I'm also running Linuxcnc on another small mill and a wood router so bench space is at a premium). One of the jobs I regularly have to do involves cutting internal threads of around 100mm diameter x 1.5mm pitch and it would be really useful to have the facility to thread mill these (my other little mill isn't up to the job which is why I converted this benchtop mill). I notice that this facility has been asked for before but hasn't been given any priority so I'm just adding my 'please' to the list.... I currently do the job on my old Harrison lathe but its messy to do involving making wood chucks etc as the part is really too big for the lathe and milling would be so much easier.. Thanks, Ian
     
  25. ply

    ply New
    Builder

    Joined:
    Jul 30, 2016
    Messages:
    2
    Likes Received:
    0
    Hi!
    For some Laser-engraving work i would like to change the grbl code to handle M3/M5 with exact timing and without halting the stepper's motion. A look into the code revealed that I probably have to extend the planner block buffer and segment_buffer structs with an "M3/M5 action at end of this block" field, change the M3/M5 handling code to attach the action to the last not yet executed planner block in the queue (instead of waiting for the buffer to run empty), change the stepper code to forward the M3/M5 action into the segment_buffer, and change the interrupt to execute the switching command at the end of the stepper segment.
    I am new to grbl, arduino and cnc so my question is: might the above plan be a good idea or is this a complete fail? Or maybe this already exists somewhere?
    The background is, i bought one of these cheap "eleks maker" 5500mw laser engraving machines and already wrote a small gcode generator that converts a png into a scanline-style engraving gcode. there is very slow acceleration on the left and right of the image (inside the gcode) to switch direction and there isnt - (and should not be) any acceleration while the laser is doing a scan line. however the scanlines have to be done with quite a bit of feed rate to get the desired burn result, which doesnt seem to be a problem with this machine as long as acceleration is kept low all the time.
     
    #265 ply, Jul 31, 2016
    Last edited: Jul 31, 2016
  26. Bob K

    Bob K New
    Builder

    Joined:
    Jun 2, 2016
    Messages:
    55
    Likes Received:
    20
    Joe - just navigate to the library folder and delete it.

    On my PC it's at : C:\Program Files (x86)\Arduino\libraries

    My Win10 PC pops up a warning about needing admin privileges by just hit continue & the delete will continue.

    Bob
     
  27. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    I don't see why you couldn't do it with Grbl. It supports helical arcs that would normally be used for thread cutting. If you mean by tapping with a synchronized spindle, that is not supported. This requires a lot more control logic and hardware for the spindle.
     
  28. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    Laser support is slated to be released with Grbl v1.0.
     
  29. Bob K

    Bob K New
    Builder

    Joined:
    Jun 2, 2016
    Messages:
    55
    Likes Received:
    20
    I'm also pretty new at this stuff so I hope that I'm interpreting your request properly.

    Here's a YouTube video on "How To Thread Mill with Simple G-Code".


    Click on the SHOW MORE and the gcode is listed. I've attached it to this post.

    Here's an Autodesk thread that uses post processors to convert the helical movement into short line segments or arcs.
    Solved: Bore milling GCODE = DEEP bit fusing plunge... - Autodesk Community

    Bob
     

    Attached Files:

    #269 Bob K, Jul 31, 2016
    Last edited: Jul 31, 2016
  30. IanW

    IanW New
    Builder

    Joined:
    Jul 31, 2016
    Messages:
    4
    Likes Received:
    0
    Thanks Sonny, that does seem to be what I need for milling the threads with a single point cutter. I was obviously trying to over-think the problem... I have some reading to do...
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice