Information flow from high-level Application to Motor control:

When we press a button on our application then we see we can start a motor or stop the motor. How does the magic happen? There are many ways to achieve this, we shall describe with examples and explanations of how do we achieve this. We need a hardware configuration for this (we have ignored all safety and security stuff in this example for simplicity, in a real project we should not)

 

BOOL constants are the truth values TRUE (1, 24 volts) and FALSE (0, 0 volts).  This can be a starting point for our high-level language. If we set our Boolean variable to HIGH  then it means we are going to write to the output device 1 (in most cases it is 24V).  See below the explanation of how the message flows from one point to another point.

1 (PC):

PC is where we are running the high-level program (A graphical user interface). There is a read button to read the status of the motor (not used in our example to simplify). There is a write button for writing status 1 (for running the motor) and 0 (for stopping the motor). Our application has been compiled with the ADS library for communicating with the PLC. 

2 (Our application):

Our application is very simple, there are 2 buttons in the graphics. Those are read and write. Read is used to know the status of the motor and write is used to start or stop the motor. There is an edit box there, we write 1 for start and press the write button to start the motor. 0 for stopping the motor.

3 (ADS Library):

We assume that we are using a PLC from Beckhoff. We need a way to pass the information from our application to the PLC. This part of the software will do for that. This is a Windows DLL (dynamic link library that wraps all the communication protocol such as TCP/IP). If we don’t use this then we have to write all these by ourselves and that is huge work. See how this magic happens in the ADS from this tutorial https://www.hemelix.com/scada-hmi/beckhoff-hmi/beckhoff-pc-plc-communication-module-development/

ADS Library brings information from our application to the PLC.

4 (PLC):

We are running a program in the PLC. The program is continuously monitoring each variable (this is called also tag or symbol) with some milliseconds interval.  We have a variable called bStartMotor. If the variable is modified by our GUI application then it is reflected in the PLC program. PLC Program notices that and writes the value to the output card. If the value is TRUE (1) then it writes 1 and if it is FALSE (0) then it writes 0.  Writing 1 means for the output card is that the output card raises the signal to 24 volts.

5 (Output card and the wire):

A PLC is always associated with input cards and output cards. Input cards are reading data and output cards are for writing data. Reading data means the input card sense if there is a presence of 24 volts in the signal pin. If the value of the signal pin is high (24 volts) then the TwinCAT system sets the value of the associated variable value to true (1). The red wire is for 24 volts and the blue one is for 0 volts or ground.

6 (Input power for electro magnetic coil):

The output of the PLC is connected to the contactor (6, 7, 8 and 9). Contactor is an electrically-controlled switch used for switching an electrical power circuit. A contactor is typically controlled by a circuit which has a much lower power level than the switched circuit, such as a 24-volt coil electromagnet controlling a 230-volt motor switch.

7 (Electro magnetic coil):

When ever we supply 24 volts to the electro magnetic coils, then it generates magnetic force. This is fixed part. When we apply electricity to the coil (by the PLC output) then it attract the armature due to the generated magnetic force. At this time the movable contacts make contact so the electricity can flow to the motor. When we remove the power (PLC write 0 to the output) then electro magnetic force gone and the spring force dis connect the contact. So movable contacts are dis engaged and electricity flowing is stopped. Thus the moor is stopped.

8 (Spring):

Mechanical spring for disengaging the movable contacts. When there is 24 volts in the output card then electromagnetic force makes the movable contact connected to the line for flowing electricity. When there is no power in the output card then electromagnetic force is gone and the spring force push the movable contact to be disengaged. So no electricity flow through the motor circuits.

9 (Movable contacts):

 

10 (Electric motor):

 

 

The Software that control the motor: