Introduction #
How can DataSuite be used with optimized data blocks (DB) of a Siemens S7 PLC?
Welcome to the guide, in this document you will learn how to set up DataSuite with a PLC (S7-1200/S7-1500) and optimized data blocks.
The data is saved in Excel files, but can also be stored in SQL databases
1. Requirements #
1.1 Hardware & Software #
- Siemens S7-1200 or S7-1500 PLC with activated OPC UA functionality
- DataSuite software (version 3 or newer)
- TIA Portal (for PLC programming and configuration)
- Licensed OPC UA Runtime for the PLC
- Microsoft Excel (if Excel files are to be used)
1.2 Network Configuration #
- Profinet connection between PC (with DataSuite) and the PLC
- Fixed IP address for the PLC
- Firewall settings for OPC UA (enable port 4840)
2. Activate OPC UA in the Siemens PLC #
As optimized data blocks cannot be accessed via Put/Get, the PLC must act as an OPC UA server.
2.1 Enable OPC UA Server in the PLC #
- Open TIA Portal and load the PLC project.
- Go to Device configuration → OPC UA.
- Activate OPC UA Server and select standard interface.
- (Optional) Change port from 4840 to another port.
- Configure security options:
- Activate at least user name/password authentication.
- (Recommended) Activate encrypted connection.
- Save changes and restart PLC.
2.2 Configuring OPC-UA Variables #
- Open the desired data block (DB) in TIA Portal.
- Drag the desired variables into the OPC UA server interface (right mouse button → OPC UA → Add).
- Load the modified program into the PLC.
3. Connecting DataSuite with OPC UA #
3.1 Add SPS connection #
- Open DataSuite and go to PLCs.
- Click on Create new PLC.
- Select PLC – OPC UA as the connection type.
3.2 Enter OPC UA connection parameters #
- Enter the IP address of the PLC.
- Set port 4840 (or the port set in the PLC).
- Security mode: If activated, select an encrypted connection.
- Authentication: Enter the user name and password of the PLC.
- Test and confirm the connection.
4. Importing variables from OPC UA #
- Open the newly created PLC connection in DataSuite.
- Click on Manage variables.
- Select OPC UA Import and load the data blocks released in the PLC.
- If new variables are added in the PLC, import again.
5. Configure Excel file in the DataSuite #
5.1 Creating a new Excel file #
- Open DataSuite and go to Excel files.
- Click on Add new file.
- Create a new Excel file or use a template.
5.2 Set up Excel file for write access #
- Enter file path and name (may contain variables).
- Set save options:
- Overwrite (old file is replaced)
- Continue (new data is appended to existing file)
- Append number (create a new file with consecutive number each time)
- Set data format (XLSX or CSV).
5.3 Saving Data in an Excel File #
- Create a trigger in DataSuite.
- Select Action: Excel – Write.
- Select the desired file and spreadsheet.
- Assign the corresponding cells to the PLC variables.
- Save and activate.
5.4 Reading Data from an Excel File #
- Create a trigger in DataSuite.
- Select Action: Excel – Read.
- Select the desired file and spreadsheet.
- Assign the Excel cells to the OPC UA variables in the PLC.
- Save and activate.
6. Alternative: Database connection (SQL) #
If the data is not to be saved in Excel but in an SQL database, DataSuite can also work with the following databases :
- Microsoft SQL Server
- MySQL
- MariaDB
- PostgreSQL
6.1 Configure Database Connection #
- Go to Databases in DataSuite.
- Click on Create new connection.
- Select the desired database type.
- Enter the connection parameters (host, port, user, password).
- Test and save the connection.
6.2 Set up database queries #
The tables and columns can be linked dynamically with PLC variables.
7. Troubleshooting & optimization #
7.1 Connection not possible? #
- Check whether the PLC is accessible (ping to IP address).
- In TIA Portal:
- OPC UA Server activated?
- Correct security options selected?
- Data blocks added to the OPC UA interface?
7.2 Values are not being updated? #
- Open the variable view in DataSuite → Are values being read?
- Triggers configured correctly? (Check conditions)
- Excel file not open? (Excel locks files when editing)
- SQL database queries correct? (Test connection)