Author Topic: Limit vs Home switches  (Read 172 times)

ggallant571

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1806
    • View Profile
Limit vs Home switches
« on: November 09, 2017, 07:28:49 AM »
I added 6 switches to my 3018 mini mill. Set the grbl options to limit switches and reset the CPU. Startup messages indicate that a $H homing cycle must be preformed or an $X override. Did the $X and tried to run the x axis past the limit. It stops with a

 "ALARM : Hard limit"

message. Looks like they are wired correctly.

What I do not understand is:

   1. How to initial a Homing cycle.  It currently runs to the limits and
       freezes or hits the hard stops and bangs on the steppers.
   2. How to recover from the hard limit alarm
   3. What is the process (name) for measuring the Z position of the cutting tool. I would
       like to change cutting tools and know the new depth.
   4. Does the HOME use the same switches as the LIMIT?

There is not much documentation available. It appears to have grbl 9j loaded and there are adds that indicate newer units are being shipped with 1.1. I have no idea if it contains "stock" firmware or if the vendor has played with the configuration.
SARCASM - Just one more service we offer here.

nottingham82

  • Hero Member
  • *****
  • Posts: 1590
    • View Profile
Re: Limit vs Home switches
« Reply #1 on: November 09, 2017, 10:07:13 AM »
$h to run a homing cycle.  yes it should use the same switches as the limit switches.  $x kills the alarm.   Im not sure about the z height.  I think after you put in the new bit you are supposed to reset zero for the z height.  I dont know the process though.
Laser: 2500mw A5 eleks maker
OS: Windows 10 all in one pc
Software: T2
http://www.gearbest.com/3d-printers-3d-printer-kits/pp_290386.html Paid $160 in 2016

Lob0426

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
  • Let the Magic Blue Smoke out!
    • View Profile
    • Richards RasPi Web Server
Re: Limit vs Home switches
« Reply #2 on: November 09, 2017, 04:20:37 PM »
$h initiates a script that runs the steppers towards the settings in home direction until the switches are activated. The difference in home and limit is how they react to a switch activation. Limits are initiated by the switches and end in an alarm state. Any switch can be used as a home and/or limit. Sounds weird but it works. Use $h and it is a home switch, dependent on the settings for home direction. If any switch is hit without a $h they halt the machine as a limit.

Your number 1. Since you did not use $h it just goes to the switches and stops, being activated as a limit. If it does tis with a $h used your homing seek speed is too high.

Your #2 $x as Nottingham stated. System alert is the default at start if you setup firmware for switches. I think you can change that in the firmware, not in eeprom. $h or $x cancels the alarm.

Your #3 . You can use Z limit to change the tool. Then lower down the work taking into account tool lengths

You could raise Z to the limit for the tool change, automatically stops all movement of steppers, motors and lasers (anything controlled as spindle). Then use the grbl "probe" function to lower to work height. Use an adjustable probe that can be adjusted to each tools length or have all tools the same length (I know, I'm dreaming).

Your #4 if you use $h the switch is a homing switch (. If the switch is activated without $h it is a limit.

"probe" has to be set in firmware not in eeprom.

I hope this helps.
« Last Edit: November 09, 2017, 04:29:37 PM by Lob0426 »
Richard
A5 2.5W w/homing switches on L7
A5 2W diode self upgraded from stock 500mw
Printrbot Play. Ext bed, integrated tablet control.
Printrbot Simple Metal
USA

ggallant571

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1806
    • View Profile
Re: Limit vs Home switches
« Reply #3 on: November 09, 2017, 08:06:24 PM »
Where do I declare the wiring method. 6 individual NO vs serial NC?
SARCASM - Just one more service we offer here.

Lob0426

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1622
  • Let the Magic Blue Smoke out!
    • View Profile
    • Richards RasPi Web Server
Re: Limit vs Home switches
« Reply #4 on: November 09, 2017, 11:04:22 PM »
You have to set it in grbl then recompile. The individual pins are in cpu_map.h

// Define homing/hard limit switch input pins and limit interrupt vectors.
  // NOTE: All limit bit pins must be on the same port, but not on a port with other input pins (CONTROL).
  #define LIMIT_DDR        DDRB
  #define LIMIT_PIN        PINB
  #define LIMIT_PORT       PORTB
  #define X_LIMIT_BIT      1  // Uno Digital Pin 9
  #define Y_LIMIT_BIT      2  // Uno Digital Pin 10
  #ifdef VARIABLE_SPINDLE // Z Limit pin and spindle enabled swapped to access hardware PWM on Pin 11.
    #define Z_LIMIT_BIT      4 // Uno Digital Pin 12
  #else
    #define Z_LIMIT_BIT    3  // Uno Digital Pin 11
  #endif
Different if using a Mega2560. But in same place

config.h notes on homing and homing separate axis, new to me here. description;

// If homing is enabled, homing init lock sets Grbl into an alarm state upon power up. This forces
// the user to perform the homing cycle (or override the locks) before doing anything else. This is
// mainly a safety feature to remind the user to home, since position is unknown to Grbl.
#define HOMING_INIT_LOCK // Comment to disable

// Define the homing cycle patterns with bitmasks. The homing cycle first performs a search mode
// to quickly engage the limit switches, followed by a slower locate mode, and finished by a short
// pull-off motion to disengage the limit switches. The following HOMING_CYCLE_x defines are executed
// in order starting with suffix 0 and completes the homing routine for the specified-axes only. If
// an axis is omitted from the defines, it will not home, nor will the system update its position.
// Meaning that this allows for users with non-standard cartesian machines, such as a lathe (x then z,
// with no y), to configure the homing cycle behavior to their needs.
// NOTE: The homing cycle is designed to allow sharing of limit pins, if the axes are not in the same
// cycle, but this requires some pin settings changes in cpu_map.h file. For example, the default homing
// cycle can share the Z limit pin with either X or Y limit pins, since they are on different cycles.
// By sharing a pin, this frees up a precious IO pin for other purposes. In theory, all axes limit pins
// may be reduced to one pin, if all axes are homed with seperate cycles, or vice versa, all three axes
// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits
// will not be affected by pin sharing.
// NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y.
#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.
// #define HOMING_CYCLE_2                         // OPTIONAL: Uncomment and add axes mask to enable

// NOTE: The following are two examples to setup homing for 2-axis machines.
// #define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS))  // NOT COMPATIBLE WITH COREXY: Homes both X-Y in one cycle.

// #define HOMING_CYCLE_0 (1<<X_AXIS)  // COREXY COMPATIBLE: First home X
// #define HOMING_CYCLE_1 (1<<Y_AXIS)  // COREXY COMPATIBLE: Then home Y

// Number of homing cycles performed after when the machine initially jogs to limit switches.
// This help in preventing overshoot and should improve repeatability. This value should be one or
// greater.
#define N_HOMING_LOCATE_CYCLE 1 // Integer (1-128)

// Enables single axis homing commands. $HX, $HY, and $HZ for X, Y, and Z-axis homing. The full homing
// cycle is still invoked by the $H command. This is disabled by default. It's here only to address
// users that need to switch between a two-axis and three-axis machine. This is actually very rare.
// If you have a two-axis machine, DON'T USE THIS. Instead, just alter the homing cycle for two-axes.
// #define HOMING_SINGLE_AXIS_COMMANDS // Default disabled. Uncomment to enable.

// After homing, Grbl will set by default the entire machine space into negative space, as is typical
// for professional CNC machines, regardless of where the limit switches are located. Uncomment this
// define to force Grbl to always set the machine origin at the homed location despite switch orientation.
// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.

$5 sets limits/home NC or NO
$6 sets "probe" switch NC or NO
$21 sets hard limits =switches

https://github.com/gnea/grbl/wiki/Grbl-v1.1-Configuration

"
$21 - Hard limits, boolean
Hard limit work basically the same as soft limits, but use physical switches instead. Basically you wire up some switches (mechanical, magnetic, or optical) near the end of travel of each axes, or where ever you feel that there might be trouble if your program moves too far to where it shouldn't. When the switch triggers, it will immediately halt all motion, shutdown the coolant and spindle (if connected), and go into alarm mode, which forces you to check your machine and reset everything.
To use hard limits with Grbl, the limit pins are held high with an internal pull-up resistor, so all you have to do is wire in a normally-open switch with the pin and ground and enable hard limits with $21=1. (Disable with $21=0.) We strongly advise taking electric interference prevention measures. If you want a limit for both ends of travel of one axes, just wire in two switches in parallel with the pin and ground, so if either one of them trips, it triggers the hard limit.
Keep in mind, that a hard limit event is considered to be critical event, where steppers immediately stop and will have likely have lost steps. Grbl doesn't have any feedback on position, so it can't guarantee it has any idea where it is. So, if a hard limit is triggered, Grbl will go into an infinite loop ALARM mode, giving you a chance to check your machine and forcing you to reset Grbl. Remember it's a purely a safety feature."

Richard
Richard
A5 2.5W w/homing switches on L7
A5 2W diode self upgraded from stock 500mw
Printrbot Play. Ext bed, integrated tablet control.
Printrbot Simple Metal
USA