I have designed and built a desktop CNC utilizing Arduino running GRBL. Everything is done, but I would like input on my emergency stop solution. The emergency stop is intended to stop everything with no hope of recovering the running program.
Based on my research, the Arduino reset pin is held high and if connected to ground gets pulled low, triggering a reset. The three EasyDrivers have an enable pin that is also pulled low, or connected to ground, to enable the drivers. Based on that information, I developed the attached circuit.
A few notes: The IC noted in "Mill Wiring_bb" is not correct, I am using a 74HC08 quad-gate AND IC. The "Logic Test" circuit is something I developed in EveryCircuit to test the theory. The three power supplies represent the Arduino Enable pin, the Arduino Reset pin, and the 5 VDC power supply for the circuit. I have also replaced the LED between the AND output and ground with a 10K resistor. Last, ignore the LEDs with the switch. They aren't illustrated correctly and I have to change that.
The theory behind the circuit is that when the ESO is triggered, the Enable pins on the EasyDrivers are pulled high by the 5 VDC power supply and one input on the AND gate is pulled high. The second AND gate input is always high from the Arduino Reset pin. This should have the effect of pulling the Reset pin low and the Enable pins high, disabling the EasyDrivers and resetting the Arduino at the same time. My understanding is that this is the best manner to do an E-Stop for the GRBL and the EasyDrivers.
The NC side of my ESO switch breaks power to the spindle.
I am looking for confirmation that this will work as designed, that my understanding of the logic is correct, and if not, how to change it so that it will work. The points I can't change are: What I am using for Arduino, GRBL, the stepper drivers, and the ESO. Everything else I can modify as needed.
The best way to implement an emergency stop is a big red switch that physically shuts off power to all the motors. It can slso shut off power to the Arduino - but that is of secondary importance.
Thanks for your reply. The ESO is a big red button on top of the mill frame where it can be easily depressed. It has two sides, one NC and one NO. The NC side breaks connection to the spindle power. The NO side runs this logic gate because my research says that killing power to an Arduino running GRBL in the middle of a run can case issues and the drivers may be damaged. The latter I have from the designer of the EasyDriver. My intent is to stop the spindle directly and stop the EasyDrivers and GRBL Arduino as gracefully as possible.
If my research has missed something about running GRBL on Arduino and running EasyDrivers, I am open to a new solution, please provide a link or other reference.
I think your intent is good, I tried to implement a similar E-STOP feature in RAMPS-FD. In terms of safety, there are different levels of emergency stop, from stopping movement to isolating power. In many cases, isolating power can be achieved simply by mains switch. Adding a hardware "stop" is a useful addition, rather than a substitute for electrical isolation. I find it very handy for testing new setups on 3D printers, where a software "stop" is unreliable.
However, I really don't understand your schematic or how it would work. I can't really tell anything from the wiring diagrams. For useful feedback, you really need a proper schematic.
I would also encourage you to use a NC switch as the stop switch, so that if the switch becomes disconnected it causes a safe shutdown. Also consider what happens if the 5V power fails, but the motor or spindle power is still present.
The spindle power is on an NC switch. As soon as the big red button is pressed, the spindle power is cut. Because it is only 1/8 HP, it stops rotating completely very soon after.
I want the NO side of the big red button to trigger the stepper drivers to disable and the Arduino to reset, while still allowing the Arduino Pin 8 to control the enable/disable on the stepper drivers.
If 5 VDC power fails, the relay that switches the spindle opens and the spindle stops.
Normal shutdown is after all stepping instructions have been sent to the steppers and the Arduino GRBL has returned to a rest state. The system is turned off with a mains power which disconnects A/C at the source and shuts off everything except the Arduino since the Arduino is powered by USB. Then the PC is disconnected and the Arduino shuts down.
My research and about 20 emails back and forth with the designer of the EasyDriver board tells me that the ideal way to stop this system is through triggering a reset of the Arduino and disabling the EasyDrivers at the same time. This will stop the now motionless spindle from jamming the cutter into the workpiece.
I just want to know if this logic circuit will work as designed.
This method also eliminates the need to reset zeros on the machine after an E-Stop.
If what I have provided is not sufficient, please tell me what you mean by a "proper schematic". Do you mean a wiring diagram similar to that supplied in the image "Logic Test" and if so, what do you need it to cover? That image is the logic design I want to make sure it correct and operates the way I want it to. To my knowledge, all the information I have supplied should be sufficient to determine of the logic circuit will operate as intended.
A properly configured Emergency Stop isolates all power from the machine.
Definetely never a software operation.
It's not just there for mechanical mishaps but electrical ones as well.
Save the operator.........
azgti:
If what I have provided is not sufficient, please tell me what you mean by a "proper schematic". Do you mean a wiring diagram similar to that supplied in the image "Logic Test" and if so, what do you need it to cover? That image is the logic design I want to make sure it correct and operates the way I want it to. To my knowledge, all the information I have supplied should be sufficient to determine of the logic circuit will operate as intended.
A proper schematic is one drawn in Eagle or Kicad showing actual components used, with actual pin numbers etc. EveryCircuit is a fun toy, but not something you can actually use for design work.
E.g. Your output from the AND gate goes to an LED, which is noted as actually being a resistor. In that case, draw a resistor! However, it still doesn't make sense, as the output is pulled low but is not connected anywhere.
I can only conclude that on the information provided, EveryCircuit is not a suitable way to present the design,* and your circuit will not do what you want.
azgti:
The spindle power is on an NC switch. As soon as the big red button is pressed, the spindle power is cut. Because it is only 1/8 HP, it stops rotating completely very soon after.
it appears that the consensus is to cut the power and let everything continue to run until each motor runs out of energy.
think of your car, in an emergency just turn off the key. you loose power steering, power brakes and engine power. the car will just continue until it runs out of energy.
for a CNC machine, most drivers have a method of locking the axis. for a stepper it is to hold any pin high and not send pulses. the stepper is a generator or a motor. with nothing connected it can freewheel and cog along until it runs out of power. or, it you send power to one axis, it acts like a brake.
larger CNC machines use a simple DC motor to power each axis and an encoder for feedback. once spinning, the motor will freewheel for a bit with a loss of power. in some machines like a wood router, it can coast along for a foot or so before coming to a stop.
for the spindle, the driver may have a method of braking. on the smaller CNC spindles, there is no circuitry, but on electronically driven spindles, there should be.
I have to disagree with the consensus. just disrupting power does not insure any part of the machine will come to a stop before there is a problem.
I believe you need to clamp each motor to create a brake.
dave-in-nj:
I have to disagree with the consensus. just disrupting power does not insure any part of the machine will come to a stop before there is a problem.
I believe you need to clamp each motor to create a brake.
There needs to be a proper risk assessment that takes full account of the probability of different failure events and different hazards.
A substantial part of the risk reduction will be achieved by keeping human contact away from moving parts.
My concern is that there would be inadequate analysis and testing of a software cut-off so that it may not actually reduce the risk.
I agree with you that it would be great to apply a brake to dissipate the rotating energy more quickly, but I think I would prefer a simple mechanical brake rather than a system that can only work if the motor remains powered up.
I don't know why people are referring to software (there is none involved), or "risk assessments", this is a hobby CNC we are talking about, and the OP never mentioned anything about safety. I think he is smart enough to avoid the whizzy parts or fondling live wires. There is something about the phrase "emergency stop" that gets people in quite a tizzy!
Anyway, I'll take back what I said about EveryCircuit. Despite requiring Chrome and being somewhat limited, it is quite useful and you can get some real numbers out of it, as well as being fun
I did a little circuit to model the use of a NO switch to gate the Enable line from the Arduino. I found the logic called for a NOR gate. The Enable output of the Arduino is modelled as a toggle switch. A sample EasyDrive is modelled as an LED, note the Enable input is active low and the EasyDriver has a default pull-down, a loose wire here is a single point of failure.
For additional bling, a Green LED shows when the EasyDrivers are enabled, and a Red LED shows when the ESTOP is active. (Green = go, Red = stop).
I don't think it is strictly necessary to also reset the Arduino, since the drivers won't do anything with Enable high, but I also did another version to put the Arduino into reset when the ESTOP is active. This requires an additional inverter, I used a NOT gate. I am sure there are many ways to create equivalent circuits with the same logic. EveryCircuit - Emergency Stop 2 The Arduino reset is modelled as a LED with an active low enable.
With either of these circuits, after ESTOP is activated the tool position will be lost and the machine needs re-homing.
Thanks for your reply, I appreciate the time you took to investigate EveryCircuit and look at the question.
I chose EveryCircuit because I don't have the money for Eagle and EveryCircuit shows a wiring schematic and allows simulation. I wish it had notes also, but maybe someday.
I didn't add a resistor because for the simulation I didn't need it. The LED showed me when the circuit was pulled low by going active.
My EveryCircuit sketch if you want to play with it.
The reason I want to reset the Arduino is to kill the feed from the GRBL controller on the PC. By stopping the EasyDriver with the enable/disable pin and not by cutting power, I make sure that the steppers are stopped as the EasyDriver will hold the motors from taking further steps. Resetting GRBL means that until GRBL is initialized again, no more steps will be transmitted to the drivers.
If I just cut power to the EasyDriver and the motor continues to turn, it can feed voltage back into the EasyDriver and cause damage.
So the solution I developed is to reset Arduino and disable the EasyDrivers with one switch. The AND gate solution was the most simple way I could do it with my limited knowledge of logic circuits.
I wanted to take the GRBL enable pin out of the loop because it may reset when Arduino resets and I don't know what behavior will occur when the reset pin is held low on Arduino.
I need to take some time to understand your circuit and I will let you know if I have any questions. Thanks again!