fellesverkstedet / fabricatable-machines

Motion systems for flexible digital fabrication and research. Easy to fabricate and customize. Documentation: https://github.com/fellesverkstedet/fabricatable-machines/wiki
163 stars 35 forks source link

Simple way of resetting the controller when power is cut? #16

Closed Jaknil closed 5 years ago

Jaknil commented 6 years ago

On Humphrey v2 the Arduino-GRBL controller is powered by USB and therefore not effected by cutting power with the emergency stop button. If a user pushes the emergency stop and cuts 220V power to the machine, the controller will keep running on USB power. If the PC streaming gcode to the CNC-machine is also left running while the power to the motors are off then the cnc-machine might preform sudden unexpected dangerous moves when power is restored.

For safety I want to trigger a controller reset if the power is cut. Preferable I want to make it so easy to do that a lazy user of our system sets it up like this without even knowing it. If it requires special components or skill I think the people who will need this the most will not set it up right.

I see a few ways to trigger this:

  1. The GRBL ABORT-pin.
  2. The arduino RESET-pin
  3. Using a data-only USB-cable and powering the arduino from the main power
  4. Changing the GRBL-code to detect the external power loss and self-resetting via software

When we make our own boards I think we should be able to set something up that sends a HIGH to 1 or 2 when the external 36V is lost. We still have 5V. Any ideas?

Without any extra components we could trigger on the alarm-function on the closed loop motors. That would work in most cases as it would detect motors missing steps due to the motor power being off, but that relies on that the motors first must loose a programmed amount of steps and does not care about the spindle so it's better than nothing but not perfect.

If we come up with a solution which uses very common or simple components it is more likely that people will use it on their own designs so please give it a though!

Jaknil commented 6 years ago

Another option is to trigger the reset on the power coming back on.

I think that can be done with a simple coil that creates inductive resistance when the main 36V power starts flowing, that could be scaled down to a 5V signal and trigger a reset.

I tried to simulate it here and I see that it will generate a negative voltage when power is cut, but I am not sure this is a problem.

Capacitors are more common than coils in hackerspaces shelf stock so perhaps they can be used instead. Or perhaps we can use the fact that there is plenty of inductance in the system already (PSU and motors)?

I know this can be done with a transistor or a signal inverter but I wanted to explore if this is even simpler for people to make. What I don't want to do is to make something that triggers on power supply noise.

@jonnor do you have any thoughts?

JensDyvik commented 6 years ago

I think a 36V driven relay or contactor that is normally open could do the trick. If power is cut from the powersupply to the motors, then the relay or contactor will also loose power. Thereby the signal to the GRBL Abort pin will be closed.

In the context of building a CNC milling machine, I would not consider a relay an exotic or complicated component to install.

On future readymade shields like the HRBL shield it could indeed be great to integrate as many as possible components for machine safety.

Jaknil commented 5 years ago

ABORT on loss of external power successfully tested with a two optocoupler configuration. It is implemented in the latest edition of the HRBL-arduino NANO shield.

image