fra589 / grbl-Mega-5X

5/6 Axis version of Grbl, the open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on an Arduino Mega2560
https://github.com/fra589/grbl-Mega-5X/wiki
Other
341 stars 159 forks source link

Limit Switch Logic #333

Closed milesmiles902 closed 1 year ago

milesmiles902 commented 1 year ago

I purchased used components for a 5th axes.

The steps/unit, acceleration, and velocity correctly function.

Now, I need to configure my wiring (or grbl-Mega-5x package) to fit the limit switches.

Microsensor [EESX674] Setup: Limit Switch Power: 24 V from stepper supply Limit Switch Ground: Stepper driver Pin Min: D14 Pin Max: D15

Microsensor Schematic: Microsensor

Microsensor Logic: Capture

Observations:

  1. Light-On requires an enabled [config.h > #define DISABLE_LIMIT_PIN_PULL_UP] for the stage to move.
  2. When Pin Min/Max [D14/D15] are supplied voltage, and a corresponding limit is optically blocked, the other pin receives no power.

Shouldn't the optical switches regulate an output signal to the Arduino?

milesmiles902 commented 1 year ago

If no luck, I may try a logic table of the five wires (three sensors) to find a transistor formatting for grbl-Mega-5x.

Not optically blocked:

Wire #1 Wire #2 Wire #3 Wire #4 Wire #5
Power Ground Test Output Test Output Test Output
Power Test Output Ground Test Output Test Output
Power Test Output Test Output Ground Test Output
Power Test Output Test Output Test Output Ground
... ... ... ... ...

Optically blocked:

Wire #1 Wire #2 Wire #3 Wire #4 Wire #5
Power Ground Test Output Test Output Test Output
Power Test Output Ground Test Output Test Output
Power Test Output Test Output Ground Test Output
Power Test Output Test Output Test Output Ground
... ... ... ... ...
fra589 commented 1 year ago

Hi @milesmiles902,

Unfortunately for you, I'm really not an electronics expert...

Warning ! The Arduino board works at 5 volts and connecting the limit switches to 24 volts will certainly destroy it. It would be wiser to disconnect the limit switches from the 24v motor driver supply and plug them into the 5v of the Arduino.

According to the Microsensor schematic, #define DISABLE_LIMIT_PIN_PULL_UP should do the trick by connecting the "L" output to the signal pin of the Arduino. But be careful to add a pull-down resistor so as not to destroy the Arduino board.

Another good solution should be to add a transistor or an optocoupler between the microsensor and the Arduino board. But in this case, I don't know enough about electronics to help you... Asking Google will surely be a better option :-)

@++;
Gauthier.

RaphaelDives commented 1 year ago

I bought an 8-channel 24v relay board and use my switches with 24v volt. (since I had to many interferences on the limit pins using 5v). Works like a charm... Cheers Raphael

milesmiles902 commented 1 year ago

Warning ! The Arduino board works at 5 volts and connecting the limit switches to 24 volts will certainly destroy it. It would be wiser to disconnect the limit switches from the 24v motor driver supply and plug them into the 5v of the Arduino. @++; Gauthier.

The crossed wiring did reset my Arduino's EEPROM.

Thank you.