Skip to content

Help with Switch Problems

bdring edited this page Dec 24, 2020 · 14 revisions

Help with Switch Problems

Checking Switch Status.

The active/inactive status of all switches can be checked with the "?" command. Use a serial port monitor to send the command. The status will look something like this...

<Run|MPos:351.154,0.000,-135.983,10.477|FS:1200,0|Pn:X>

The Pn:X part will only show if at least one switch is active. In this case, the X limit switch is currently being read in the active state. Every switch can be checked. These are the possible switches you could see PXYZABCDRHS

  • P = Probe
  • XYZABC = The axis limit switches
  • D = Door
  • R = Reset
  • H = Hold
  • S = Start

Check all your switches in in the active and inactive states and make sure the status query response show the correct status in both states.

Inverted States

If your switches are reporting inverted from what you expect, this can be corrected in firmware. You can invert all limit switch pins with the **$5*8 setting. You can invert the probe pin with the $6 setting.

You can invert the control pins (DRHS) by flipping the appropriate bits #define INVERT_CONTROL_PIN_MASK B1111 mask in config.h

You can invert individual limit switch pins with #define INVERT_LIMIT_PIN_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)) in config.h

Switch Pull Ups

Note: a few I/O pins (34 through 39) require external pull ups (or down) resistors. If you do not have resistors on these pins, the I/O pin will "float" and not have a deterministic" state. Most ESP32 controller PCBs, that use these pins have a pull up installed already.

Homing

Homing is controlled by a lot of settings. Don't expect a home all to work as soon as you hook up the motors. If you reduce the homing and switch features, you are more likely to have success and understand any problems. You can add features after basic homing works.

  • Turn off hard and soft limits $Limits/Soft=Off and $Limits/Hard=Off
  • Make sure all axes move in the right direction when jogging and move in both directions. Do small moves. Make sure axes with dual motors are working properly. Also, measure the movement to make sure it is moving the amount it should. If not adjust the resolution, like $X/StepsPerMm=nnn.nn for the X axis
  • Make sure the switches correctly report when switch is activated and not activated (see above)
  • Set the axis travel to the length of your axis, like $X/MaxTravel=nnn.nn for the X axis.
  • Put each axis on its own homing cycle like $Homing/Cycle0=Z, $Homing/Cycle1=X, $Homing/Cycle2=Y, etc.
  • Turn off axis squaring with $Homing/Squared=. Don't worry you can turn it on later.
  • Set the homing direction. The default is to home in the positive direction. If any axis homes towards the negative direction add it to $Homing/DirInvert, like $Homing/DirInvert=XY to make X and Y home in the negative direction.
  • Try homing one axis at a time with $HZ to home the Z axis. Be ready to kill the power or click the reset button if it does something wrong.
  • If you get an alarm or error number, you can send $E to see all the error descriptions or $E= to see a specific error.

Homing FAQ

  • Why does the axis move a little them give an ALARM 8? This is normal behavior if switch is active before the homing starts. Grbl tries to clear the switch by moving away by the $Homing/Pulloff amount. Check the switch before homing. Is it touched? Does the status show it as touched? What is the status if you touch it?
Clone this wiki locally