Wireless Safety Button for PLC Safety

1,102

5

9

This project is my proof of concept for using IoT and (eventually) robotics to create an additional layer of safety for hazardous manufacturing facilities. This button can be used to start or stop multiple processes, including the control of signal lights. While I refer to this project as an e-stop button, please note that installing true e-stop controls requires a lot of redundancies and regulations. This project is simply meant to add an additional layer of safety.

Please use safety precautions when wiring and powering this circuit.

Supplies:

Electronics

x2 NODE MCU boards - https://amzn.to/2QxJwz2

x1 PLC w/power supply - Allen-Bradley CompactLogix PLC is used in this Instructable - https://amzn.to/2QySV9H

x1 5v Electromechanical relay

x1 2N2222A transistor

x1 1k Ohm resistor

x1 normally closed (NC) push button

x1 normally open (NO) push button

x1 9v battery connector + 9v battery

Assorted wire

Software

Arduino IDE

Studio 5000

Step 1: NODE MCU Server Circuit Wiring

A NODE MCU board will be used as the server, and is the middleman between the button and the PLC. When the button is pushed, the server will receive a signal, which will energize a relay, and send the necessary signal to the PLC to stop all processes.

Board Wiring

To power our NODE MCU, simply use a micro usb wall adapter.

Relay Crash Course

The relay consists of two parts; the coil, and the armature. The coil can be energized, which creates a magnetic field, which will cause the armature to move from the normally closed (NC) position to the normally open (NO) position.

To determine which pin is NO and which is NC, use a multimeter and set it to measure resistance (2k Ohm range). Touch the red lead to the middle pin, and then measure each of the opposite pins. The NC pin will be electrically connected, so you should see a small resistance reading. The NO pin will not be electrically connected, so the reading should be over range.

Once the NO and NC pins have been established, solder or attach two wires to the coil (black wires in the picture above), one wire to the middle contact pin, and one to the NC pin (green wires).

Board to Relay Wiring

We now need to connect our relay to the board. We need to supply 5v to the relay coil in order to engage the armature. Since the NODE MCU board only outputs 3.3v, we need to use a transistor to amplify the signal. Refer to the wiring diagram for circuit connections. Please note that if a different pin is used for the signal, it will need to be changed in the code.

Relay to PLC Wiring

Wire the central pin to the 24v source, and the NO pin to input terminal 1 on the PLC.

Step 2: NODE MCU Client Wiring

This NODE MCU board will be programmed as the client, and will send the button status to the server. Connect the 9v battery to Vin and GND pins on the NODE MCU. Solder/attach a wire from any pin labeled 3v3 (3.3v pin), and another wire to pin D8 (GPIO 15). Solder or attach the other end of these wires to either side of the normally closed emergency button.

Step 3: PLC Wiring

Plug your green wire from the NC relay leg into input terminal 0 of your PLC. Make sure you have a connection to ground via the common (COM) port associated with your input. Most PLCs have separate COM ports, so be sure you're wired to the right port.

Do the same with a normally open push button to act as our start button for our PLC. Attach this button to terminal 1.

Plug in any number of output devices that can handle 24v into the output terminals. For this example, we are using a single pilot light in output terminal 0. Be sure to add a connection to ground at COM.

Step 4: Programming NODE MCU Server and Client

If this is your first time using the NODE MCU boards, use this setup guide: https://www.instructables.com/id/Quick-Start-to-No...


Once you're setup, download the server and client files. The necessary changes are listed below, as well as in the .ino files.

1. Change the SSID to your network name for both server and client

2. Change the password to the network password for both server and client. If it is an open network, leave it as "".

3. For the server, include the IP, gateway, and subnet mask.

4. For the client, include the IP address used for the server.

5. If both boards are wired as shown in the previous steps, simply upload the files to the respective boards. If different pins are used, change the respective variable, then upload.

Step 5: Program the PLC

PLC Crash Course

PLCs use a fairly simple I/O language known as ladder logic. Code is read from top to bottom, and from left to right. During each program cycle, true/false input data is updated, and that information is used to control the outputs. Inputs and outputs in the ladder logic program are tied to discrete terminals on the PLC, which are wired to field devices.

The symbols used are as follows:

--| |-- Examine if closed (XIC). This is an input contact, and it will be true if there is a HIGH signal at the corresponding input terminal.

--|/|-- Examine if open (XIO). This is an input contact, and it will be true if there is a LOW signal at the corresponding input terminal.

--( )-- Output. This is an output contact, and it will become HIGH while all of the input contacts on the rung are TRUE.

Explanation of Code

On the first rung, the first XIC contact is our emergency stop command. We use an XIC in conjunction with a normally closed E-stop button. Since the NC button provides a HIGH signal, the XIC will return TRUE, allowing the rest of the rung to be energized. Pressing the E-stop button will break the HIGH signal, and force the rung to de-energize, thus stopping any dangerous machinery that may be running.

The next part of the circuit is a parallel rung that forms a seal-in circuit with the output coil. Parallel rungs act like an OR gate - if either are true, the rung can be true. The top contact is wired to our start button, and the bottom contact is the status of our output contact. Once the start button is pressed, the output will energize, which will make the bottom contact TRUE. So the user can release the start button and the output will remain energized until the E-stop button is pressed.

To program the PLC

Be sure you have Studio 5000 downloaded and installed. Power up the PLC and connect it to your computer using a USB connection. Open the attached code. Select Communication < Who Active. Your PLC should be listed under USB serial port. Be sure your PLC is set to 'prog' to download. Select your PLC and download the code. Once ready, set the PLC to 'run' to run your program.

Step 6: Run It!

Attach a 9v battery to your client board. Plug in your server board and your PLC. Run the PLC program, then hit the emergency button. You should see the pilot light (or whatever output device used) deactivate.

IoT Challenge

Runner Up in the
IoT Challenge

Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Beauty Tips Contest

      Beauty Tips Contest
    • Pets Challenge

      Pets Challenge

    9 Discussions

    0
    None
    garzo

    5 days ago

    In my region, and i'm quite sure that this is true for most part of the world, if it resemble an e-stop (same shape and color) IT MUST BE A PROPER E-STOP! In factories you are not allowed to use a red-mushroom-shaped button if it's not a compliant button with a compliant wiring (o a certified wireless mean of communication). This could be useful as remote input, no doubt on that, but don't consider it a remote e-stop because it doesn't "add an additional layer of safety", quite the opposite.

    0
    None
    pben

    17 days ago on Introduction

    I have a question. Have you looked at the electrical code that requires E-Stops to be hardwired? Wireless controls have been used in industrial controls for at least twenty years that I know of but E-Stops are required by USA national and local codes to be wired in such a way that any break in the wiring will disable the machine under control.

    Is there the same requirement in your region?

    Wireless controls can be used in the USA if reasonable techniques are used to have reliable control of the machine. So standard start, stop, and other control can be wireless. E-Stops are a special case because of safety.

    5 replies
    0
    None
    ZacharyA22pben

    Reply 17 days ago

    I can't specify codes or regulations, but I'm certain there are many for e-stop installation. This project is not meant to replace wired e-stop buttons and I'm fairly certain I would need a lot of review / certification for it to be implemented. As it stands, this is just a prototype that could exist alongside current safety protocols.

    If you or anyone can cite specifics I'd be happy to update my instructions to reflect current regulations.

    0
    None
    xivadiZacharyA22

    Reply 8 days ago


    Yes, I wouldn't call it an E-Stop or make it look like one. I'd only use it in a situation where you assume it will fail without harming people or equipment (or other life for that matter). :-)

    0
    None
    Noremorse920ZacharyA22

    Reply 15 days ago

    You can't just have this "alongside" a traditional rated e-stop unless you don't call this an e-stop. If it's an e-stop, it must confirm to applicable regs. If you call it a cycle stop, and don't color it like an e-stop, then go wild, just don't call it an e-stop.

    0
    None
    HoboWhispererZacharyA22

    Reply 16 days ago

    Check out NFPA 79 - Electrical Standard for Industrial Machinery. It has loads of info on that sort of thing. I used to refer to it regularly in my machine controls design days, and most panels I work in now are designed to meet those guidelines.

    0
    None
    pbenHoboWhisperer

    Reply 16 days ago

    Thanks for the reference. Back when I was a draftsman for a controls company in the 90's I remember having to dig through the big fat national code book a couple of times. There were a few wireless controls just coming out but we still had to lay conduit and wires for the E-Stops. I haven't had to deal with industrial controls since 2003 so my knowledge may be a little out of date now.

    0
    None
    Charles Su

    17 days ago

    Nice idea for a proof of concept. Wireless e-stops do exist, but involve much more.
    To be sure, this is not a safety rated e-stop. For that to be the case, it would need some sort of way for both the PLC and the e-stop to recognize that their communication is active and functioning. ASAIK, Europe tends to be even more strict than the US.