winder / Universal-G-Code-Sender

A cross-platform G-Code sender for GRBL, Smoothieware, TinyG and G2core.
http://winder.github.io/ugs_website/
GNU General Public License v3.0
1.86k stars 757 forks source link

(ALARM:8) Homing fail. Pull off travel failed to clear limit switch. Try increasing pull-off setting or check wiring. #2372

Closed ekmensah closed 7 months ago

ekmensah commented 8 months ago

Version

2.1.2

Hardware / Firmware

GRBL 1.1

What happened

I have a 3-axis CNC machine running GRBL 1.1h. My setup works fine without limit switches. I decided to add 6 limit switches, two on each axis. I used the limit switch instructions on the grbl wiki page for a NC setup. Going through the Setup Wizard in UGS, my limit switches work perfectly when I manually activate them, with the inverted button checked. I observed bouncing of the switches in the form of blinking on the UGS UI so I added 10k pull-up resistors which solved the problem.

When I click on 'Try Homing' in the setup wizard, the z-axis tries to home but only rotates in two revolution and stops even if the limit switch is not engaged. Then, the XY begins to home but also stops without engaging the switches.

I manually moved the axes close to the limit switch and when I try homing, it crushes into the limit switch without stopping until an alarm occurs or I abort homing.

The Alarm reads: An error was detected while sending '$H': (ALARM:8) Homing fail. Pull off travel failed to clear limit switch. Try increasing pull-off setting or check wiring. Streaming has been paused. Error while processing response : An unexpected command was completed by the controller.

I have calibrated my motors, increased pull off travel distance from 1, to 10, and now 50 mm. Still getting the same error. I increased my max travel distance to 400, 400, and 300 for X, Y, and Z respectively.

Can you assist me in fixing this problem?

This is my $$ output from USG:

$$ $0 = 10 (Step pulse time, microseconds) $1 = 25 (Step idle delay, milliseconds) $2 = 0 (Step pulse invert, mask) $3 = 2 (Step direction invert, mask) $4 = 0 (Invert step enable pin, boolean) $5 = 1 (Invert limit pins, boolean) $6 = 0 (Invert probe pin, boolean) $10 = 1 (Status report options, mask) $11 = 0.010 (Junction deviation, millimeters) $12 = 0.002 (Arc tolerance, millimeters) $13 = 0 (Report in inches, boolean) $20 = 1 (Soft limits enable, boolean) $21 = 1 (Hard limits enable, boolean) $22 = 1 (Homing cycle enable, boolean) $23 = 5 (Homing direction invert, mask) $24 = 25.000 (Homing locate feed rate, mm/min) $25 = 500.000 (Homing search seek rate, mm/min) $26 = 250 (Homing switch debounce delay, milliseconds) $27 = 50.000 (Homing switch pull-off distance, millimeters) $30 = 1000 (Maximum spindle speed, RPM) $31 = 0 (Minimum spindle speed, RPM) $32 = 0 (Laser-mode enable, boolean) $100 = 36.000 (X-axis travel resolution, step/mm) $101 = 36.000 (Y-axis travel resolution, step/mm) $102 = 12.150 (Z-axis travel resolution, step/mm) $110 = 500.000 (X-axis maximum rate, mm/min) $111 = 500.000 (Y-axis maximum rate, mm/min) $112 = 500.000 (Z-axis maximum rate, mm/min) $120 = 10.000 (X-axis acceleration, mm/sec^2) $121 = 10.000 (Y-axis acceleration, mm/sec^2) $122 = 10.000 (Z-axis acceleration, mm/sec^2) $130 = 400.000 (X-axis maximum travel, millimeters) $131 = 400.000 (Y-axis maximum travel, millimeters) $132 = 300.000 (Z-axis maximum travel, millimeters) ok

Manually activating Z limit switch

image

Error Alarm

image

How to reproduce

  1. 3-axix CNC machine without limit switches controlled by an Arduino Uno and 3 DM556 motor driver Controllers
  2. Connect 6 limit switches directly to the Arduino using the NC configuration on the GRBL wiki. Include a 10k pull-up resistor on each switch.
  3. From the UGS setup wizard calibrate motors, enable limit switches. Try to activate them manually, it should work (light red) with the inverted button checked.
  4. Try homing

Operating System

Windows 11

Anything else

I haven't been able to operate the machine with limit switches enabled.

breiler commented 8 months ago

I have a suspicion what is causing this, and I am extra curious about this statement:

I haven't been able to operate the machine with limit switches enabled

If you disable the alarm using the Unlock button after you've connected to the machine and try to jog. Will it randomly enter an alarm state with the message that the hard limit is triggered?

ekmensah commented 8 months ago

Hi Breiler thanks for the prompt response.

I am unable to disarm the alarm. I tried unlocking and I get this error:

An error was detected while sending '$X': (ALARM:1) Hard limit has been triggered. Machine position is likely lost due to sudden halt. Re-homing is highly recommended. Streaming has been paused. [MSG:Reset to continue]

When I click on Home Machine, the UI says homing but none of my motors move for over a minute.

Also, because there is no emergency stop buttom in the UI, the only way to regain control is to disconnect and reconnect from the USG UI

It has been a couple of minute of this.

image

When I reconnect and unlock this is the feedback

image
breiler commented 8 months ago

Yeah, the states are confusing in GRBL.

If the hard limits are triggered, it will enter the Alarm state which you can't recover from - you have to do a "Soft reset".

After the reset, or if you cold connect to the controller it will still enter an Alarm state, but from this type of Alarm you can recover with an Unlock.

This is a limitation in the GRBL protocol so there is no easy way for us to visualize these two different alarm states in the UI.

Also when homing - the GRBL protocol doesn't offer an abort or cancel operation.

So try this to ensure the controller is in a correct state: Disconnect, Connect, Soft Reset, Unlock and then try to jog - will this make the controller enter an alarm state caused by falsly triggering the limit switches?

ekmensah commented 7 months ago

Hello Breiler,

Hard limits are triggered now and soft resetting it do not disable the alarm. I am still unable to recover control. This is the output in the console after clicking soft reset:

Grbl 1.1h ['$' for help] [MSG:'$H'|'$X' to unlock]

I clicked Home Machine, the Z-axis moved, trigger the Z limit switch and an alarm was trigger. This is the output from the console:

An error was detected while sending '$H': (ALARM:8) Homing fail. Pull off travel failed to clear limit switch. Try increasing pull-off setting or check wiring. Streaming has been paused. Error while processing response : An unexpected command was completed by the controller.

I am unable to jog even after clicking unlock.

The only way to jog will be to disable hard limits $21=0

breiler commented 7 months ago

Hard limits are triggered now and soft resetting it do not disable the alarm. I am still unable to recover control.

As I wrote, as soon as the hard limits are triggered this is considered a serious problem in the GRBL world and requires a soft reset - then an unlock to be able to move the machine if you have homing enabled.

I am unable to jog even after clicking unlock.

You mean that the machine is properly unlocked and in IDLE state, and then when you try to jog, it will immediately enter an Alarm state? What is the console log output when this happens?

ekmensah commented 7 months ago

Disconnect, Connect, Soft Reset, Unlock and then try to jog - will this make the controller enter an alarm state caused by falsly triggering the limit switches?

Following your instructions, I still have an alarm, and my jogging controls are grayed out.

image

This is the output from the console: An unexpected error was detected: (ALARM:1) Hard limit has been triggered. Machine position is likely lost due to sudden halt. Re-homing is highly recommended. [MSG:Reset to continue]

Currently, following the instruction from the console, I tried homing, but my motors do not move even though the UI says homing.

breiler commented 7 months ago

Ok, the signs points to a EMI problem where your limit switches are falsely triggered. Read this: https://www.cnccookbook.com/cnc-electrical-noise-grounding-techniques-interference-filter/

breiler commented 7 months ago

Out of curiosity, what type of controller do you have?

ekmensah commented 7 months ago

Out of curiosity, what type of controller do you have?

I am using an Arduino Uno and 3 DM556 motor drivers.

breiler commented 7 months ago

Ok, if you have connected the limit switches directly to the Arduino inputs without any filtering or opto-couplers that is likely your problem.

ekmensah commented 7 months ago

Ok, the signs points to a EMI problem where your limit switches are falsely triggered. Read this: https://www.cnccookbook.com/cnc-electrical-noise-grounding-techniques-interference-filter/

I will and revert.

Ok, if you have connected the limit switches directly to the Arduino inputs without any filtering or opto-couplers that is likely your problem.

Yes I have connected the limit switches to the Arduino directly, but with pull up resisters.

ekmensah commented 7 months ago

Hi Breiler,

I installed a 3 channel optocoupler circuit with the limit switches and the issues are resolved. Thank you for your assistance.

breiler commented 7 months ago

Cool, and thanks for the feedback!

Do you mind sharing what you bought and how you connected them. This is one of the most common issues and by writing up a viable solution would probably help others. We can either create a new page on the wiki or if you share it directly to me I can try and write something up.

ekmensah commented 7 months ago

Sure, I purchased three 4N25 optocouplers and connected them using the circuit attached. IMG_1594

Here is an image of my isolation circuit IMG_1595