This article discusses the PLC Sorting and Counting program on Conveyors using Schneider Ecostruxure platform. In this PLC system the Conveyor will carry products with 3 different colors (GREEN, PURPLE, BROWN), the color sensor will sort the products carried by the Conveyor. The Storage Gate will Open if the sensor detects the product. Each product will be counted and has its own Storage Gate. The Alarm is On and the Conveyor will Stop when the quantity of products reaches the maximum storage amount.
Multi-Color Sorting Conveyor System
This PLC program uses 5 buttons, the PB_ON (I0.0) button is used to turn ON the system, the PB_OFF (I0.1) button is used to turn OFF the system, the RESET_COUNT_GREEN (I0.5) button is used to Reset the Green product counter data, the RESET_COUNT_PURPLE (I0.6) button is used to Reset the Purple product counter data, and the RESET_COUNT_BROWN (I0.7) button is used to Reset the Brown product counter data.
SENSORS USED
The SENS_GREEN (I0.2) sensor is used to detect Green products, the SENS_PURPLE (I0.3) sensor is used to detect Purple products, and the SENS_BROWN (I0.4) sensor is used to detect Brown products.
CONVEYOR SEQUENCE
The Sorting And Counting Conveyor System will Run when the PB_ON (I0.0) button is Pressed. The CONVEYOR (Q0.0) output will be ON to carry the product.
GREEN PRODUCT SEQUENCE
The Gate GREEN_GATE (Q0.1) will OPEN when the SENS_GREEN (I0.2) sensor detects a Green product. After 4 seconds Gate GREEN_GATE (Q0.1) will CLOSE again. The memory word COUNT_GREEN_PRODUCT (MW0) will record the quantity of Green product data.
PURPLE PRODUCT SEQUENCE
The Gate PURPLE_GATE (Q0.2) will OPEN when the SENS_PURPLE (I0.3) sensor detects a Purple product. After 4 seconds Gate PURPLE_GATE (Q0.2) will CLOSE again. The memory word COUNT_PURPLE_PRODUCT (MW1) will record the quantity of Purple product data.
BROWN PRODUCT SEQUENCE
The Gate BROWN_GATE (Q0.3) will OPEN when the SENS_BROWN (I0.4) sensor detects a Brown product. After 4 seconds Gate BROWN_GATE (Q0.3) will CLOSE again. The memory word COUNT_BROWN_PRODUCT (MW2) will record the quantity of Brown product data.
ALARM SEQUENCE
The COUNT_GREEN_ALARM (Q0.4), COUNT_PURPLE_ALARM (Q0.5), and COUNT_BROWN_ALARM (Q0.6) Alarms will be ON if the quantity of products has reached 20.
The Conveyor will Stop if there is an Alarm ON.



Project Addressing
Comment | Input (I) | Output (Q) | Memory Word | Memory Bits | Timer |
PB_ON | I0.0 | ||||
PB_OFF | I0.1 | ||||
SENS_GREEN | I0.2 | ||||
SENS_PURPLE | I0.3 | ||||
SENS_BROWN | I0.4 | ||||
RESET_COUNT_GREEN | I0.5 | ||||
RESET_COUNT_PURPLE | I0.6 | ||||
RESET_COUNT_BROWN | I0.7 | ||||
CONVEYOR | Q0.0 | ||||
COUNT_GREEN_ALARM | Q0.4 | ||||
COUNT_PURPLE_ALARM | Q0.5 | ||||
COUNT_BROWN_ALARM | Q0.6 | ||||
GREEN_GATE | Q0.1 | ||||
PURPLE_GATE | Q0.2 | ||||
BROWN_GATE | Q0.3 | ||||
COUNT_GREEN_PRODUCT | MW0 | ||||
COUNT_PURPLE_PRODUCT | MW1 | ||||
COUNT_BROWN_PRODUCT | MW2 | ||||
TIMER_GREEN | TM0 | ||||
TIMER_PURPLE | TM1 | ||||
TIMER_BROWN | TM2 | ||||
SYSTEM_ON | M0 | ||||
IR_TIMER_GREEN | M1 | ||||
IR_TIMER_PURPLE | M2 | ||||
IR_TIMER_BROWN | M3 |
Programming
RUNG 0 (SYSTEM_ON)
In this Rung, the memory bit SYSTEM_ON (M0) will be in HIGH state if the PB_ON (I0.0) button is Pressed. The memory bit SYSTEM_ON (M0) remains in the HIGH state even though the PB_ON (I0.0) button has been Released, because it uses the SET Coil Instruction.

RUNG 1 (SYSTEM_OFF)
In this Rung, because it uses the RESET Coil Instruction, if PB_OFF (I0.1) button is Pressed, the memory bit SYSTEM_ON (M0) will become a LOW state.
RUNG 2 (CONVEYOR)
In this Rung, the CONVEYOR Output (Q0.0) will be ON if the NO contact of memory bit SYSTEM_ON (M0) in the HIGH state.
If the NC contact of COUNT_GREEN_ALARM (Q0.4) or COUNT_PURPLE_ALARM (Q0.5) or COUNT_BROWN_ALARM (Q0.6) is ON, then the Output CONVEYOR (Q0.0) will be OFF.
RUNG 3 (GREEN GATE)
In this Rung, the GREEN_GATE (Q0.1) output will be ON if the NO contact of memory bit SYSTEM_ON (M0) and the SENS_GREEN (I0.2) sensor are in the HIGH state.
The timer TIMER_GREEN (TM0) will count up to 4 seconds and after it has finished counting, the memory bit IR_TIMER_GREEN (M1) will be in the HIGH state and the GREEN_GATE (Q0.1) output will be OFF.

RUNG 4 (PURPLE GATE)
In this Rung, the PURPLE_GATE (Q0.2) output will be ON if the NO contact of memory bit SYSTEM_ON (M0) and the SENS_PURPLE (I0.3) sensor are in the HIGH state.
The timer TIMER_PURPLE (TM1) will count up to 4 seconds and after it has finished counting, the memory bit IR_TIMER_PURPLE (M2) will be in the HIGH state and the PURPLE_GATE (Q0.2) output will be OFF.
RUNG 5 (BROWN GATE)
In this Rung, the BROWN_GATE (Q0.3) output will be ON if the NO contact of memory bit SYSTEM_ON (M0) and the SENS_BROWN (I0.4) sensor are in the HIGH state.
The timer TIMER_BROWN (TM2) will count up to 4 seconds and after it has finished counting, the memory bit IR_TIMER_BROWN (M3) will be in the HIGH state and the BROWN_GATE (Q0.3) output will be OFF.

RUNG 6 (COUNTER AREA)
In this Rung, if the NO contact of memory bit SYSTEM_ON (M0) and the SENS_GREEN (I0.2) sensor in the HIGH state, then the value in memory word COUNT_GREEN_PRODUCT (MW0) will increase (+1).
If the SENS_PURPLE (I0.3) sensor in the HIGH state, then the value in memory word COUNT_PURPLE_PRODUCT (MW1) will increase (+1).
If the SENS_BROWN (I0.4) sensor in the HIGH state, then the value in memory word COUNT_BROWN_PRODUCT (MW2) will increase (+1).
RUNG 7 (COUNTER ALARM)
In this Rung, when the NO contact of memory bit SYSTEM_ON (M0) and the value in memory word COUNT_GREEN_PRODUCT (MW0) is equal to “20”, then the Output COUNT_GREEN_ALARM (Q0.4) will be ON.
When the value in memory word COUNT_PURPLE_PRODUCT (MW1) is equal to “20”, then the Output COUNT_PURPLE_ALARM (Q0.5) will be ON.
When the value in memory word COUNT_BROWN_PRODUCT (MW2) is equal to “20”, then the Output COUNT_BROWN_ALARM (Q0.6) will be ON.

RUNG 8 (RESET GREEN COUNTER)
In this rung, the data in memory word COUNT_GREEN_PRODUCT (MW0) will be Reset to zero “0” if the RESET_COUNT_GREEN (I0.5) button is Pressed.
RUNG 9 (RESET PURPLE COUNTER)
In this rung, the data in memory word COUNT_PURPLE_PRODUCT (MW1) will be Reset to zero “0” if the RESET_COUNT_PURPLE (I0.6) button is Pressed.
RUNG 10 (RESET BROWN COUNTER)
In this rung, the data in memory word COUNT_ YELLOW_PRODUCT (MW2) will be Reset to zero “0” if the RESET_COUNT_BROWN (I0.7) button is Pressed.
Read Next:
- PLC Program for Password Management
- PLC Program Sequential Batch Mixing System
- Electrical Dosing Pump PLC Programming Logic
- Schneider PLC Example for Star-Delta System
- Medium-Level PLC Exercise in Automation