Arduino Nano with Emergency stop Button

Hello People!

I'm looking to wire up an emergency stop button (big red stop button as below) to my Arduino Nano so that I can trigger events from it being engaged or not. I have a idea of how that is meant to look and just wanted a "your not going to blow anything up" before I look to putting it together, wanting the physical build done before I start the code bit.

I think what I have will detect if there is power or not in the circuit and allow my to build triggers for code from that and it wont burn everything down around it? :slight_smile:

What I mean by an Emergency stop button

Rudimentary use of Fritzing...

oops, that was meant to be a 330ohm resistor!

John

Why would you blow anything up?
Why the resistor?

I would wire the button between Arduino pin and GND and use inputMode(yourPin, INPUT_PULLUP).

1 Like

I would not rely on a software solution for an emergency stop system. Use an NVR switch cut the power

3 Likes

How would you detect the knob pressing without powering the arduino?

The resistor on the button is a very prudent solution. I always connect the button through a 500-1000 ohm resistor.
The logic is simple - you can upload a wrong code to the board or mix up the pin, apply HIGH to it and then press the button. The resistor will protect the arduino port from burnout

The Ultimate Plan is not a traditional Emergency Stop system, its a big red button that I can trigger processes with using the Arduino so not for killing the power, more for killing specific processes for the leyman rather than having to show them which button on the complex control panel they have to press and hoping they remember :slight_smile:

Sorry, that would be my bad diagram. Obviously, I wold be putting power in to the Arduino otherwise it would be a pretty dysfunctional project :wink:

The resistor is indeed to keep the Arduino as safe as possible and 330Ohms is planned to reduce the 5v down to 2v (however I am a newb to Ohm's law) so its as low as possible without creating the echo that high voltage mains cable could create (might have to think about Analog over Digital pins afterall now I think)

I browsed some documentation that offered that going back into the GPIO only would be safe and I wouldn't need the ground. Reducing the power as much as possible is my paranoia that this sounds very wrong

If your pin is an input, you're mistaken. An input pin has a high impedance; so the current is limited (see datasheet; specification IIL and IIH); they are 1 microAmp. So that's the current that flows through your 330 Ohm resistor and hence the voltage drop over that resistor is 330 microVolt (V = I * R).

The story is different when the pin is an output and @b707 has a valid point.

If you want to protect the Arduino, then use an optoisolator.

It seems to me that OP wants protect himself FROM ARDUINO rather than protect the board :slight_smile:

@jhouse82
es

I'm sorry, I'm a lot better at the coding than the wires and boxes bit which is why I was looking for pointers and/or confirmation. I got the idea that I would have to use a 330ohm resistor from and Ohm's law calculator on a website asking it that I wanted to go down from 5v to 2v after being advised by one of my engineering friends that I should be looking out for the circuit not picking up on potential background interference from Mains cables so i thought that was a good idea but I'm thinking now that if that is the case then i should be hooking into an Analog pin so that the Voltage can be measured and low voltages can be discarded?

The pin will be an input pin as it is looking to evaluate whether power is in the circuit or not but Impedance has flown right over my head (I found out yesterday that its Amp's and not Voltage that kills you)

What I'm really looking for is what order I should be soldering my pieces together in so that not of it is damaged, be able to get my reading and go back to the safety or IDE's and variables :wink:

John

This seems like great idea and a solid plan, especially after I found out what an optoisolator is, but does seem like a very complex solution to a basic circuit which I have assumed is possible and considering that I've got to put the whole thing in little box at the end of it all feels like a level of unnecessary complexity. I'm guessing that this isn't a requirement and more of a flourish?

John

I just offered it as an option in case you wanted electrical isolation between the switch and arduino.
I think in your case, the best solution would be the circuit below:
es1

I apologise Jim, just in case I seemed ungrateful in any way and thank you for for your input which is most welcome.

In the mean time however I have had some success (but not complete) in putting something together before coming back here to check, so the project currently looks like this...

... and the code ...

//Always comment your code like it will be maintained by a violent psychopath who knows where you live
// This code will detect whether or not the Emergency Stop button is depressed.  Aww, so sad ;)

int buttonPin = 12;     //Declare Pin D12 on the Arduino as an object

void setup() {
  pinMode(buttonPin, INPUT);      //Defines the interactions of the defined buttonPin to an input GPIO
  Serial.begin(9600);     //sets the Baud rate (comms between Arduino Serial monitor and computer)
}

void loop() {     //Main looping       
  int buttonState = digitalRead(buttonPin);     //Read pin D12     

  if (buttonState == LOW) {     //if the button is not despressed...
    Serial.println("Button is not depressed");      //... print to message to serial monitor
  } else {        //if it is not...
    Serial.println("Button is depressed");      //... print this message to the serial monitor
  }
}

The project is "sort of " working. I get a consistent stream of "Button is not depressed" into the Serial Monitor whilst it is not but when the Estop is I get a consistent 5:2 ration of "Button is depressed" to "Button is not depressed"

I'm thinking this is a loose connection so I'm thinking either a re-solder or something in the code to slow down the poll.

Suggestions welcome? :slight_smile:

Should be INPUT_PULLUP

10 points Jim!! Thanks again :slight_smile:

I thought you were going to use the circuit given in post #16