LöcherUndLicht



Siemens PLC Control of Conveyor Band

In this session, a Siemens PLC will be used along with a retroreflective sensor to determine the shape of a workpiece.

Please prepare all the preparation sections before the actual lab session. This is obligatory for attending and will save you time during the session. Preparation may include drawing diagrams, answering questions, or reading through the basics.

Learning Outcome:

Learning Outcome

Introduction

In this session you will program a Siemens PLC.

Requirements

additional-plc

additional-tia_basic

What you need

Software

All software on this list are pre-installed on the lab PC.


Hardware

Conveyor System

The conveyor system consists of the following:

Make yourself familiar with the conveyor belt and identify each of the inputs

Preparation

Task Description

The conveyor band shown below is to be controlled by a Siemens PLC. Inductive sensors (1) are mounted on both sides of the conveyor to detect if a workpiece carrier is there. A retroreflective sensor (2) is used to count how many pillars the workpiece has. Different workpieces will be provided with different number of pillars.

The assignment is as follows: first, the conveyor should be waiting in an idle state. If the sensor at the beginning of the conveyor (i.e., on the left side) detects a workpiece, the conveyor's motor should be turned on and the workpiece should be transported to the right side. While the workpiece passes the retroreflective sensor in the middle, the number of pillars on the piece should be counted and saved in a variable of type integer.

The conveyor band in question

Preparation before the session

Draw a state machine diagram that describes the software to fulfill the above assignment.

Read through and prepare additional-plc and additional-tia_basicbefore the lab session.


Task

Follow additional-tia_setup to create and set up a project in TIA Portal.

Refere to additional-tia_basic for help in creating function blocks and other topics.

⚠️ For this lab you need to work with TIA-Portal V16!!!!! Both Versions are installed on the Lab PC, so pay attention!

Tia Portal Project Setup

Create the necessary variables for all sensors and map them to their suitable addresses. The sensors and actors are wired to the following addresses.

Signal address mapping

Function Block

Create a function block called FB_ConveyorControl and implement your state machine diagram from your preparation. Choose SCL as the programming language.

The Tia Portal environment does not support enumerations as CodeSys does. To generate Enumerations in TIA Portal (V16), create a new Tag List. Switch to the User Constants, assign the names of your chosen states. Think of a well chosen Datatype for the numbered representation of your enumeration.

Which Datatype do you need for the Enum? Do you need the datatype to be BOOL, FLOAT, INT or USINT?

Main [OB1]

Add one instance of FB_ConveyorControl to your Main program (drag & drop).

create a watch-table to monitor your variables during the code.

Connect the IO to the function-block. Test if the program runs correctly.

download the program to your PLC and set the PLC to RUN-mode.

Main [OB1] is written in FBD, but the function block should be written in SCL.