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?
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
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.
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
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?
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:
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...
//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.