Adding safety optical sensor to GRBL library

Hi, everyone ..

I built a spindle CNC machine with Arduino and CNC shield. I am using GRBL library and Universal G-code sender (UGS) program to control the machine, and everything works fine.

I just need to add any optical sensor attached near to the spindle in case any hand or object come across, the system is stopped.

I try to read the configuration file of the library, but there is no feature such that. What if I just attached the sensor to one of the analog pins (A0-5), and add several commands with void setup() and void loop() functions to do the purpose?

Sincerely !

A Google search for GRBL emergency stop might help. Wire your optical sensor in place of the emergency stop switch.

1 Like

really professional emergency stops do their stopping on the most reliable most direct way.

This means your main power-supply can be interrupted through the emergency stop where all switches and contacts are wired in series and operate with normal closed-mode.

Only if all wires of the emergency circuitry are OK and unbroken, all switches are on normal-operation-position all sensors deliver a signal "I'm OK" the main power-supply is switched on.

Whenever any kind of reason like

  • emergency-stop is pressed
  • a wire of the emergency-circuitry is broken
  • any sensor does not send a signal "I'm OK"
  • partially powersupply-failure

main-power is switched OFF

This ensures that any kind of malfunction of the emergency circuitry will switch off power immidiately and through that forces you to lookup what is wrong because the machine refuses to work.

This means your optical sensor is connected to a relay that operates in normally open mode.
Only in case optical sensor delivers the correct signal "free way" the relay is switched to closed contact closing the emergency circuitry => switching main-power on.

If you try to realise this through software you reduce the reliability to your software must work properly.

So if you follow this philosophy there is no need to modify the GRBL-library

best regards Stefan

1 Like

Thank you John, I found some topics about that

and I appreciate your explanation Stefan, It is really ENOUGH and work properly!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.