S7-1200: A Beginner’s Guide to Siemens PLC with Practical Smart Temperature Control System Tutorial

Hello, PLC beginners! Today, we will explore the mysteries of the Siemens S7-1200 PLC by building a smart temperature control system, guiding you from zero to mastering PLC programming. Don’t worry, this process is much simpler than you think. Imagine you are designing an automated temperature control system for a small greenhouse that needs to automatically control heaters and fans based on temperature changes. Are you ready to get started?

What is a PLC? A Brief Overview

A PLC (Programmable Logic Controller) is like a “mini-computer” for the industrial world, but more robust and specialized than a regular computer. It acts like a smart housekeeper, constantly collecting information (inputs), processing it (logic), and then issuing commands (outputs).

The Siemens S7-1200 is an entry-level option, affordable and easy to use. Think of it as your first car—it’s not a Ferrari, but it will definitely get you around without flipping over!

1Tip: Don't be intimidated by the fancy name "Programmable Logic Controller"; it's just a small box that executes "if...then..." instructions. For example, "if the temperature is too high, then turn on the fan".

Hardware Preparation: Equip Your Workbench

To start our temperature control system project, you will need to prepare the following equipment:

  • S7-1200 CPU 1214C (PLC main unit)

  • Power module (to provide power to the PLC)

  • Temperature sensor (PT100, for measuring temperature)

  • Relay module (to control the heater and fan)

  • TIA Portal software (for programming, like Word for writers)

  • A programming cable (USB or Ethernet, to connect the computer and PLC)

Connecting everything is simple, like assembling building blocks. The temperature sensor connects to the PLC’s analog input, and the relay connects to the digital output. Don’t worry, the wiring diagram and manual have labels, and if you’re stuck, searching for “S7-1200 wiring diagram” will yield plenty of references.

Software Installation: Not That Complicated

TIA Portal is our main battlefield. Although this software may seem a bit complex (the first time you open it, it might feel like a cockpit), you will only need to use a small portion of its features.

Installation steps:

  1. Download TIA Portal (from Siemens’ official website or authorized channels)

  2. Proceed with the installation (remember to select “STEP 7 Basic”, which is for S7-1200)

  3. After installation, plug in the programming cable, and the system should automatically install the drivers

1Tip: You may encounter driver issues during software installation. If the PLC cannot connect, try running the software as an administrator or manually installing the driver. This is a common "roadblock" for beginners.

Create Your First Project

Open TIA Portal, and let’s create the temperature control system project:

1// This is not actual code, but a pseudocode representation of the steps to take
2
3CreateNewProject("Greenhouse Temperature Control System");
4
5AddDevice("S7-1200 CPU 1214C");
6
7ConfigureHardware(); // Set IP address, etc.
8
9CreateProgramBlock("Main"); // Main program block

The actual operation is: click “Create New Project” → enter the name → add device → select the correct CPU model → configure network settings.

Don’t be intimidated by these steps; the TIA Portal interface is quite user-friendly, just follow the prompts step by step. It’s like using Excel for the first time; it looks complicated but is easy to use.

Writing Temperature Control Logic: The PLC’s Way of Thinking

Now we come to the fun part—programming! The logic for our temperature control system is straightforward:

  • If the temperature > 25℃, turn on the fan and turn off the heater

  • If the temperature < 18℃, turn on the heater and turn off the fan

  • If the temperature is between 18-25℃, turn both off (comfort zone)

In TIA Portal, we program using ladder logic (LAD), which resembles circuit diagrams and is very intuitive:

 1// Read temperature sensor
 2
 3"Temperature Sensor" -> NORM_X -> SCALE_X -> "Current Temperature"
 4
 5
 6
 7// Control fan
 8
 9IF "Current Temperature" > 25.0 THEN
10
11    "Fan" = TRUE;
12
13ELSE
14
15    "Fan" = FALSE;
16
17END_IF;
18
19
20
21// Control heater
22
23IF "Current Temperature" < 18.0 THEN
24
25    "Heater" = TRUE;
26
27ELSE
28
29    "Heater" = FALSE;
30
31END_IF;

This code simply means: read the temperature → convert to actual temperature value → control device switches based on the temperature value.

Unlike regular programming that executes from top to bottom, PLCs continuously loop through the execution (called the “scan cycle”). Imagine a diligent worker who executes the entire program from start to finish every few milliseconds, tirelessly.

Simulation Testing: Don’t Rush to Connect Real Devices

After writing the program, we can test it using the simulator in TIA Portal:

  1. Click on the “Online” menu

  2. Select “Start Simulation”

  3. Download the program to the simulated PLC

  4. Use the “Monitoring Table” to simulate different temperature inputs

  5. Observe if the outputs meet expectations

This is like a pilot practicing in a simulator; making mistakes won’t have real consequences. You can try inputting different temperature values to see if the fan and heater operate as expected.

Actual Deployment: Connecting Real Hardware

Once testing is successful, you can connect the real S7-1200:

  1. Close the simulator

  2. Connect the PLC and computer with a cable

  3. Find the PLC in the “Online” menu

  4. Download the program to the real PLC

  5. Click the “Start” button

During actual operation, if everything is normal, the PLC should control the fan and heater according to the program. As the temperature in the greenhouse changes, you will see the corresponding device switch states change.

Data Monitoring: Real-Time Status Awareness

To keep track of the system status at all times, we can add a simple monitoring function:

 1// Record historical temperature (once per hour)
 2
 3"Timer" (IN := TRUE, PT := T#1h);
 4
 5IF "Timer".Q THEN
 6
 7    "Temperature History"[Pointer] := "Current Temperature";
 8
 9    "Pointer" := "Pointer" + 1;
10
11    IF "Pointer" > 23 THEN // Store 24 hours of data
12
13        "Pointer" := 0;
14
15    END_IF;
16
17END_IF;

This code will record the temperature once per hour, storing the most recent 24 hours of data. You can create a simple trend chart in TIA Portal to display this data, visually showing temperature change trends.

Try expanding this function, such as recording when the fan or heater was turned on, which will be helpful for analyzing system efficiency later.

Common Issues: A Pitfall Guide

You may encounter these issues during programming:

  • PLC status light flashing red: This usually indicates a hardware configuration error or a serious problem with the program. Check the wiring and project configuration.

  • Sensor readings are inaccurate: Calibration may be needed, or you might need to adjust the parameters of the SCALE_X function.

  • PLC cannot connect: Check IP address settings, cable connections, and firewall settings.

Don’t be afraid of making mistakes; the learning process of PLC programming is all about trial and error and continuous improvement. Remember, even Siemens engineers learned programming step by step!

Extension Exercises

Once you have mastered the basics, try these challenges:

  1. Add an LCD display to show the current temperature

  2. Design an adjustable temperature setpoint (not fixed at 18-25℃)

  3. Add a humidity sensor for integrated temperature and humidity control

  4. Implement remote monitoring to check system status via mobile phone

Each challenge you complete will significantly enhance your PLC skills!

That’s it for the beginner tutorial on the Siemens S7-1200 PLC temperature control system. Give it a try, and you’ll find that PLC programming is quite fun, like building digital blocks to create your own automation world. Remember, practice makes perfect; knowledge gained from books is never enough!

Leave a Comment