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. JakePratt42

    Builder

    Joined:
    Feb 3, 2016
    Messages:
    5
    Likes Received:
    0
    So I figured out the issue. I had two problems working against me. The first was that I used the same colored pair of wire for two of the axes. So i was looking at the wrong stepper driver board. once I figured this out, it quickly became apparent that the correct stepper driver board is bad.

    Thanks for taking the time to help me work through this noobish issue.

    Jake P.
     
  2. BlueHairBob

    Builder

    Joined:
    Jan 31, 2014
    Messages:
    7
    Likes Received:
    1
    I have been wrestling with homing for several days. I am able to modify and build the firmware (0.9j) and load it onto the board successfully. I am working with a 2 axis diode laser.

    After much debugging, I have discovered that the board I am using (Eleks Maker 3 Axis), while it has pins for Limit switches X+, X-, Y+, Y-, Z+, Z-, ALL of them are connected to D9.

    What I see is that X homes correctly and then the carriage moves toward the Y limit and just keeps going - presumably because the Y limit switch bit never gets changed.

    Is there a way to use the board for homing in this condition?

    Is it possible to have it do homing correctly if I tell it that both X and Y switches are on the same port?

    Thank you very much for any ideas and help.

    Bob
     
    #62 BlueHairBob, Feb 8, 2016
    Last edited: Feb 8, 2016
  3. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    That's an interesting problem. I recall writing Grbl's homing cycle to be able to combine multiple axes to a single pin, as a way to save available pins. But, I can't remember exactly how I planned on doing it.

    First, you'll have to split up the homing cycle into separate cycles for each axis in config.h. By default, Grbl combines the x and y axes homing into one cycle. Next you'll probably need to re-define the pin mapping in the cpu_map header files, so that the y-limit is on pin 9. That should do it, but I can't guarantee it. Please let me know if it works out.
     
  4. HPB

    HPB Well-Known
    Builder

    Joined:
    Nov 28, 2015
    Messages:
    80
    Likes Received:
    52
    I'm very new to the world of CNC machines and I recently built a simple laser cutter that uses grbl on Arduino. It works great except the engravings are being mirror'd horizontally. Any idea why this is happening? My setup looks like this: Two steppers on the X-axis being controlled by two A4988s but through a single step and dir pin pair. A single stepper for the Y-axis. Am I correct in assuming that the two-stepper beam is indeed the X-axis? The step and dir pins for these are connected to the X-axis step and dir on the Arduino (pins 2 and 5). Also, I tried switching the step and dir pins with those of the Y-axis but that did not work.
     
  5. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    It's most likely that you have one of your coordinate axes inverted. Make sure that your machine moves the correct direction when you command it to move. Typically, when an X-positive moving is executed, the tool will move to the right, relative to the part. Y-positive will move the tool away from the part. Google search for CNC coordinate system for more information.

    To fix it, set the invert direction setting in Grbl to reverse that particular direction.
     
  6. Julius

    Julius Well-Known
    Builder

    Joined:
    Nov 13, 2015
    Messages:
    193
    Likes Received:
    61
    It can also be your cam, depending on where you set the origin. I had one model that even though I had the top of the stock as Z=0, it decided that the safe plane was 3mm INTO the wood, and then lifted up to do the cuts.
     
  7. BlueHairBob

    Builder

    Joined:
    Jan 31, 2014
    Messages:
    7
    Likes Received:
    1
    Hey, it works!!! By setting the Y limit pin to the same as X:

    // try mapping the Y limit to the same as the X limit for the Eleks Maker 3X board to enable homing
    #define Y_LIMIT_BIT X_LIMIT_BIT // Uno Digital Pin 9

    and setting the Homing Cycles as 2 steps:

    //#define HOMING_CYCLE_0 (1<<Z_AXIS) // REQUIRED: First move Z to clear workspace.
    #define HOMING_CYCLE_0 (1<<X_AXIS) // OPTIONAL: Then move X,Y at the same time.
    #define HOMING_CYCLE_1 (1<<Y_AXIS) // OPTIONAL: Then move X,Y at the same time.

    Homing on that board works!

    Thanks for the help.
     
    geoff_s likes this.
  8. geoff_s

    geoff_s New
    Builder

    Joined:
    Feb 10, 2016
    Messages:
    2
    Likes Received:
    0
    Talk about perfect timing! I've spent the last day or so searching to see if there was a way to allow multiple home switches on a single pin with grbl My machine runs all N/C home switches connected in series ( currently under Linuxcnc with a Gecko G540). I've wanted to give grbl a try but didn't want to rewire and reconfigure things too much to do it.

    BlueHairBob did you also define the Z_AXIS for pin 9?
     
  9. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    Combining all 3 axes to a single pin should work exactly the same. You'll need to add another homing cycle for the third axis, so it'll look something like this in your config.h.

    #define HOMING_CYCLE_0 (1<<Z_AXIS)
    #define HOMING_CYCLE_1 (1<<X_AXIS)
    #define HOMING_CYCLE_2 (1<<Y_AXIS)
     
  10. BlueHairBob

    Builder

    Joined:
    Jan 31, 2014
    Messages:
    7
    Likes Received:
    1
    I did not do anything with te Z axis because my machines are 2 axis diode lasers.
     
  11. geoff_s

    geoff_s New
    Builder

    Joined:
    Feb 10, 2016
    Messages:
    2
    Likes Received:
    0
    I should have read your original post in more detail. I was just glad to find someone asking about the same issue I have (or had). :)
     
  12. HPB

    HPB Well-Known
    Builder

    Joined:
    Nov 28, 2015
    Messages:
    80
    Likes Received:
    52
    Weird but I just reset grbl and it works as expected now. Thanks for trying to troubleshoot this!
     
  13. HPB

    HPB Well-Known
    Builder

    Joined:
    Nov 28, 2015
    Messages:
    80
    Likes Received:
    52
    OK new issue: Homing does not work. I've wired 4 limit switches (2 on either side of X and Y axes). Both the X axis switches are connected to pins 9 and the Y axis switches to pin 10 of the Arduino and they both have a 560R pull-down resistor. I've enabled homing and hard limits within grbl and when I run $H, nothing moves and after some time I get the "ALARM: Homing failed" message. I checked the voltage on the limit pins on the Arduino and they show 5V. I tried inverting the limit pins ($5=1) but still no luck. What am I missing here?
     
    #73 HPB, Feb 16, 2016
    Last edited: Feb 16, 2016
  14. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    By default, Grbl is setup for 3-axis homing and starts the homing process with the z-axis. If you haven't altered the config.h file to do only 2-axis homing, then Grbl is likely trying to home the z-axis and not finding the z-limit switch.
     
  15. HPB

    HPB Well-Known
    Builder

    Joined:
    Nov 28, 2015
    Messages:
    80
    Likes Received:
    52
    Oh I never thought of that. I've built a laser cutter with just the X and Y axis. I have not altered config.h yet.

    So would it work if I change the homing sequences from this:

    #define HOMING_CYCLE_0 (1<<Z_AXIS) // REQUIRED: First move Z to clear workspace.
    #define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // OPTIONAL: Then move X,Y at the same time.

    To this:

    #define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS))

    OR

    #define HOMING_CYCLE_0 ((1<<X_AXIS)
    #define HOMING_CYCLE_1 ((1<<Y_AXIS)

    EDIT: OK so I tried the above line and flashed the recompiled hex to Arduino. Also since I have pulldown resistors I inverted the limit pins by setting $5=1. Now the homing does not fail on screen and no alarms are triggered but it moves every so slightly and stops :(
     
    #75 HPB, Feb 16, 2016
    Last edited: Feb 16, 2016
  16. HPB

    HPB Well-Known
    Builder

    Joined:
    Nov 28, 2015
    Messages:
    80
    Likes Received:
    52
    Hi, any more insights on this issue?
     
  17. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    Not sure about the pull-down resistor setup you have. Grbl, since v0.9, assumes the pin has its internal pull-up resistor enabled at all times. When you change $5=1, you only change whether Grbl reads the pin when high as triggered, rather than low. To disable the internal pull-up and use your pull-down resistors, you'll have to uncomment the line '#default DISABLE_LIMIT_PIN_PULL_UP.'
     
  18. HPB

    HPB Well-Known
    Builder

    Joined:
    Nov 28, 2015
    Messages:
    80
    Likes Received:
    52
    Ok. Let me try this. Thanks. Do the max travel default settings make any difference in the homing cycle? One time, homing did work. The axes moved till the travel limits (200 mm default) and then stopped. When I adjusted the travel limits more than the actual travel the laser assembly did hit the limit switch but it did not trigger a stop and tried to move beyond the physical limit.
     
  19. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    Yes. Grbl will search for the limit switch for a distance of about 1.5 times the axes travel.

    If Grbl starts a homing cycle and does not stop when it hits a limit switch, then there is something wrong with your wiring or Arduino pin. Before a homing cycle starts, Grbl checks the limit to see if its triggered. If so, then it'll return a homing cycle error. Once homing begins, Grbl will actively check the state of the limit pin for the homing axes until it sees it triggered and will immediately stop motion. It will then go in a location cycle that pulls off the limit (based on pull-off distance) and re-triggers it at the homing feed rate.
     
  20. CHIPSpeaking

    Builder

    Joined:
    Mar 13, 2016
    Messages:
    6
    Likes Received:
    0
    I'm A NOOB on the CNC laser cutters, and have a problem similar to the one on this thread.

    My equipment is an A4 Eleks with Arduino (Windows 10), Board: "Arduino Duemilanove or Diecimila, ATmega328" )

    I got it from GearBest in China, and they are a place I will never shop again. No support, no build instructions, (I made it work ANYHOW!), and the software they sent was virus infected. So no more of my money will go to them... I managed to get uninfected copies, and made it go. WAS working nicely. Re-flashing the EEPROM with the Arduino code didn't help.

    My X axis is flipped (rendering all MIRRORED images), The machine has NO limit switches, and I inadvertently loaded an image to cut that was WAY bigger than the range the cutter can actually go to, there was a lot of unhappy noises from the cutter, and after, it started mirroring all the time.

    I'm not a programmer in the Arduino environment and have hopes that someone has been in the same boat as me. I'm rather frustrated, as you might well guess.

    Help!

    Thanks for any help in advance,

    John
     
  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
    first you should read this
    https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.9
    where you will learn that flipping an axis is just a setting away (-:
    the value for $3 is the one you will want to change.
    this can also be done in hardware by flipping 2 wires (on the same coil of course) on the stepper motor, but since you loaded something that caused this, my guess is a software fix is better.

    also, you should set the softlimits so that grbl knows when something is too big for the machine which will prevent it running into the end stops.

    have fun
     
  22. CHIPSpeaking

    Builder

    Joined:
    Mar 13, 2016
    Messages:
    6
    Likes Received:
    0
    GRBL 0.9 DOES NOT WORK on my machine, so I re-flashed. to 0.8c.

    Tips on 0.9x won't help me since I am on 0.8c.

    Sorry if I wasn't clear.

    My X axis is flipped horizontally. It is a CHEAP Chinese made bit of hardware with no limiter switches, and no way (I know of) to tell it to swap the horizontal (X axis). I tried using Universal GRBL sender (Java) and asked to switch the X Axis, no joy.

    I tried GRBL Controller 3.X and it didn't help with the X Axis "flip" either.

    I am at a loss.

    I will try changing the $3 value. What value should I see, and what value should I change to it, if 0.8c even allows this bit to be set?

    I am enough of a NOOB to ask, how do I set this $3 value? I have one sender that has a console mode, and I am guessing that it will be the one to use, how does one format a request for the current value of a $3 bit, and how does one format a value change at the console?

    Thanks very much for the reply. I appreciate it, but I'm STUCK on 0.8c, as 0.9x won't work with the Chinese hardware I have.

    I have already bought a different machine which is to arrive today - and am trying to salvage what I can with the Eleks A5 Unit I have.

    Again, thanks!

    John
     
  23. CHIPSpeaking

    Builder

    Joined:
    Mar 13, 2016
    Messages:
    6
    Likes Received:
    0
    Tried several values for the $3 setting, made no difference at all.

    It will not obey the flip X axis command from GRBL Controller 3.6.1 either.
     
  24. Serge E.

    Serge E. Journeyman
    Builder

    Joined:
    May 6, 2014
    Messages:
    730
    Likes Received:
    252
    Look at he wiring for he X stepper to the controller you have. There should be two pairs of colored wires between the two. Given the other issues with your machine, who knows if the colouring scheme is 'standard'. Nonetheless, all you need to do to invert the X is to invert ONE of the two pairs - left wire of pair becomes right and vice versa. This should get your stepper going in the right direction.
     
  25. CHIPSpeaking

    Builder

    Joined:
    Mar 13, 2016
    Messages:
    6
    Likes Received:
    0
    I found the step port inversion mask was $6, and the value of 100 worked saved to my machine's EEPROM. $6=100 $3 had no apparent effect.

    The problem seems solved. Thanks for pointing me in the direction I needed to go.

    The reference that helped was at:

    Grbl Controller Options | zapmaker

    Problem fixed!

    Sign me happy.

    John
     
  26. CHIPSpeaking

    Builder

    Joined:
    Mar 13, 2016
    Messages:
    6
    Likes Received:
    0
    It could be handy to be able to "Flip" horizontally (mirroring), the value that has somehow gotten written had been $6=200.

    This value could be used when making an applique or sticker for putting on the inside of a window or the cutting of the back of a mirror to create a design on the front. $6=100 goes back to normal. You can flip the Y axis too, but I wasn't interested in doing that so I didn't use that value. I think it was $6=160 which flipped both x and Y axes. Experiment away... Some values won't save to the ROM, I think because they are invalid values.
     
  27. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    For Grbl v0.8, see the Wiki on configuring that version. The bit masks to set the stepper directions are a bit convoluted in that version and prior.
     
  28. CHIPSpeaking

    Builder

    Joined:
    Mar 13, 2016
    Messages:
    6
    Likes Received:
    0
    Thanks for the tip!~ I'm on 0.8c, so this WILL be helpful!
     
  29. Jon Norris

    Builder

    Joined:
    Feb 14, 2016
    Messages:
    27
    Likes Received:
    48
    Can GRBL handle a 4th rotary axis? I've seen some references online saying it will work for a 4 axis machine, and other places say it will only work for 3 axis.
     
  30. Sonny Jeon

    Sonny Jeon Well-Known
    Staff Member Moderator Builder

    Joined:
    Aug 6, 2015
    Messages:
    165
    Likes Received:
    66
    It's strictly 3-axis at the moment. Most people run 4 motors with two on the y-axis for gantry type CNCs. I'm working on a 4-axis extension with an Arduino Mega fork right now. Should be out soonish. (The little 328p Arduino doesn't have room for the 4-axis code)
     
    Serge E. and David the swarfer like this.

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