1. Overview
The Siemens LOGO! 8 logic module paired with a SIMATIC KTP400 Basic PN is a common low-cost automation stack for small machines, building services, test stands, and remote pumping stations. A recurring engineering task is to capture a process variable (temperature, pressure, level, flow, run-time, or count) on a fixed cadence and surface the historical data on the HMI for the operator. The most common interval requested in the field is 8 hours, which aligns naturally with the three-shift workday (00:00, 08:00, 16:00).
This reference documents three engineering-grade methods to log a value every 8 hours on a LOGO! 8 and expose the result on a KTP400 Basic PN:
- Data Log block to Micro SD card (recommended for long-term retention)
- LOGO! 8 alarm buffer (suitable for short-term audit and HMI messages)
- Rolling value chain in the variable memory (VM) for live HMI trending without an SD card
The selection of method depends on the regulatory retention requirement, the availability of an SD card slot on the LOGO! 8 base module, and whether the operator needs raw CSV files or a graphical trend on the panel.
2. System Topology and Hardware
The minimum hardware stack that implements the three-shift logging scenario is shown below. The LOGO! 8 base module supplies the on-board digital and analog I/O used to acquire the process value; an AM2 / AM2 RTD expansion module is added when the transducer is a Pt100 / Pt1000 or a 0-10 V / 4-20 mA loop that is not wired to AI1 / AI2 of the base unit.
Catalog numbers relevant to the build:
| Component | Order number | Role |
|---|---|---|
| LOGO! 8 base (230RCE) | 6ED1052-1MD08-0BA1 | Logic, RTC, SD slot |
| LOGO! 8 base (24CE) | 6ED1052-2MD08-0BA1 | 24 V DC variant |
| LOGO! AM2 analog module | 6ED1055-1MA00-0BA2 | 0-10 V / 4-20 mA inputs |
| LOGO! AM2 RTD | 6ED1055-1MA00-0BA3 | Pt100 / Pt1000 inputs |
| KTP400 Basic PN | 6AV2123-2DB03-0AX0 | 4-inch mono/color HMI |
| LOGO! Soft Comfort | 6ED1058-0BA08-0YA1 | Engineering tool V8.x |
| Micro SDHC card | SanDisk Industrial 32 GB | Class 10, FAT32, industrial grade |
3. Prerequisites
- LOGO! 8 base module with firmware FS:04 (released 2016) or newer. FS:03 supports Data Log only with restrictions; FS:02 does not support it.
- LOGO! Soft Comfort V8.0 or higher for offline program development. Download LOGO! Soft Comfort V8.3
- An SD card formatted as FAT or FAT32. The LOGO! 8 accepts SDSC (<= 2 GB) and SDHC (<= 32 GB). SDXC (> 32 GB) is not supported.
- For HMI display: WinCC Basic V13 SP1 Update 9 or higher in TIA Portal V13-V17. KTP400 Basic PN manual
- Ethernet switch (or direct crossover cable) and Cat 5e or higher patch cords. PROFINET discovery works on standard Ethernet hardware.
- Static IP addresses outside the DHCP pool. The reference build uses 192.168.0.10 for the LOGO! and 192.168.0.20 for the KTP400.
4. The 8-Hour Trigger (Week Timer)
Three sample points every 24 hours are the cleanest way to expose shift boundaries on the trend. A single Weekly Timer block with three ON windows produces a one-cycle trigger pulse at 00:00, 08:00, and 16:00.
Configure the Weekly Timer in LOGO! Soft Comfort:
- Drag a Weekly Timer block (icon: clock face with weekly tab) onto the FBD diagram.
- Open the block properties and add three time ranges, all with the Day-of-week mask set to
Mo,Tu,We,Th,Fr,Sa,Su:
| Range | On time | Off time | Days |
|---|---|---|---|
| 1 | 00:00 | 00:01 | Mon-Sun |
| 2 | 08:00 | 08:01 | Mon-Sun |
| 3 | 16:00 | 16:01 | Mon-Sun |
The 1-minute ON window guarantees a positive edge even if the LOGO! scans slower than one cycle. Connect the block output to a Positive Edge detector (rising edge, M-FB "P-edge") and use the pulse as the Data Log enable trigger.
5. Data Log Block Configuration
The Data Log block (library icon: green sheet with CSV) writes one row to a CSV file on the SD card every time the enable input EN sees a rising edge. Each row can contain up to 32 columns, mixed from analog inputs, tag values, and the internal RTC timestamp.
5.1 Block parameters
| Parameter | Reference value | Description |
|---|---|---|
| Enable signal | Q from rising-edge detector | Rising edge triggers a new row |
| Filename | shiftlog.csv | Stored under /LOGO/SD/shiftlog.csv
|
| Append mode | Enabled | Appends on power-up, does not overwrite |
| Column separator | Semicolon ;
|
Required for Excel German locale; comma on English locale |
| Timestamp | yyyy-MM-dd HH:mm:ss | ISO 8601, locale-safe |
| Max rows | 200,000 | LOGO! 8 limit per Data Log block |
| Log enable flag | Tag M01 | Operator pause from HMI |
5.2 Column definition
Inside the Data Log block configuration panel, add four columns in this order:
- Column 0 - reserved for the LOGO!-generated timestamp.
- Column 1 -
AI1analog input (scaled 0-100.0 °C by the analog amplifier). - Column 2 -
AM2_AI1from the AM2 expansion (0-10 V transducer scaled to 0.0-50.0 bar). - Column 3 -
VW20holding the current shift counter from a counter block.
5.3 CSV output on the SD card
When the SD card is read on a PC the file is laid out as:
DateTime;AI1_Temp_C;AM2_Pressure_bar;ShiftNo
2025-01-15 00:00:04;42.7;12.4;187
2025-01-15 08:00:03;44.1;12.6;188
2025-01-15 16:00:02;46.3;12.9;189
5.4 SD card requirements
| Property | Required | Recommended |
|---|---|---|
| Type | SD or SDHC | SDHC Class 10 industrial |
| Capacity | <= 32 GB | 8-16 GB |
| File system | FAT16 / FAT32 | FAT32 with 4 KB cluster |
| SLC vs TLC | Any | SLC or pSLC for high write endurance |
| Write cycles | 3 / day for 5 y = 5 475 writes | Industrial card: 100 000+ writes per sector |
For 3 writes per day and ~ 50 bytes per row, the annual data volume is approximately 55 kB, well below any SD card endurance limit. An 8 GB card holds roughly 80 years of data at this rate.
6. Alarm Buffer Method (Audit Trail)
The LOGO! 8 stores the last 256 alarm events in a non-volatile circular buffer. Each alarm entry contains the message text, the activation timestamp, and the acknowledgment timestamp. By attaching the analog value to the alarm text using the Analog Multiplexer and the Message Text function, every 8-hour trigger is captured as a discrete alarm viewable in the LOGO! display, on the Web-Based Management, and on the KTP400 alarm view.
- Insert a Message Text block. Set the trigger input to the same weekly-timer pulse used for the Data Log.
- In the text body enable "Acknowledge required" and use a string with two numeric placeholders, e.g.
Shift log: T=%f1 °C P=%f2 bar. The placeholders are bound to AI1 and AM2_AI1. - The alarm buffer holds the last 256 entries. At 3 per day the buffer covers ~ 85 days. Older entries are overwritten in FIFO order.
This method is ideal for HMI alarm pages and for situations where the SD card is missing or full. It does not provide the dense timestamped history that the Data Log does, but it gives a fast, free, and persistent audit trail. Reference: LOGO! 8 System Manual, section 4.4.4 "Message texts".
7. Rolling Value Chain (Live HMI Trend Without SD)
When the operator needs the last N samples visible on a trend view on the KTP400, a chain of VM words is built. Each new sample is copied into the next slot; older samples are pushed backwards. A chain depth of 24 covers one full day at 1 sample / hour; 72 covers three days at 1 sample / 8 hours.
7.1 VM mapping in LOGO! Soft Comfort
Open Tools > VM Mapping and assign process tags to network variables:
| VM address | Symbolic name | Use |
|---|---|---|
| VW0 | Sample_0 | Most recent (current shift) |
| VW2 | Sample_1 | One shift ago |
| VW4 | Sample_2 | Two shifts ago |
| ... | ... | ... |
| VW70 | Sample_35 | 12 days ago at 8 h sampling |
7.2 Ladder program (LOGO! Soft Comfort FBD)
The 8-hour pulse from Section 4 feeds the chain. Sample_0 always holds the live analog value (a single wire from the AI amplifier). The shift logic shifts each VM word backwards when a new sample arrives:
Sample_35 := Sample_34
Sample_34 := Sample_33
...
Sample_2 := Sample_1
Sample_1 := Sample_0 (snapshot of AI value at trigger time)
Implement the shift as a single block cascade using 35 RS flip-flops clocked by the trigger pulse, or use the Shift Register block (U-FB 19 in LOGO! Soft Comfort). The shift register consumes one function block per stage; 35 stages is the maximum that fits in a LOGO! 8 BM with 400 function blocks.
7.3 Pros and cons versus Data Log
| Aspect | VM chain | Data Log + SD |
|---|---|---|
| Storage | Volatile (lost on power-cycle > RTC backup limit) | Persistent on SD card |
| HMI live read | Immediate (one PROFINET cycle) | Requires WinCC script to parse CSV from FTP |
| Capacity | ~ 50-200 samples (VM size limit) | 200 000 rows per file |
| Setup effort | Medium (larger program) | Low (drag and drop) |
| Best for | Short-term trend view on HMI | Long-term regulatory archive |
8. Exposing the Data to the KTP400
The KTP400 Basic PN connects to the LOGO! 8 over a standard S7 connection. Tags exposed via VM mapping become readable as DB words. In TIA Portal configure the HMI connection as follows:
- Add the LOGO! 8 as a S7-200 compatible partner. The default HMI driver is SIMATIC S7-200.
- Set the LOGO! IP and Rack/Slot: the LOGO! 8 always presents itself as Rack 0 / Slot 1 for S7-200 drivers.
- Create HMI tags of type Word with the following address pattern:
| HMI tag | LOGO! VM address | Cycle (ms) | Acquisition |
|---|---|---|---|
| Temp_Current | VW0 | 500 | Cyclic |
| Temp_Shift_1 | VW2 | 1000 | Cyclic |
| Temp_Shift_2 | VW4 | 1000 | Cyclic |
| Pressure_Current | VW6 | 500 | Cyclic |
| Shift_Counter | VW8 | 2000 | Cyclic on demand |
| Log_Active | V10.0 | 500 | Bit for "Logging OK" |
These tag cycles give an average PROFINET load of approximately 6 tags * 2 cycles/s = 12 read requests / second, well below the LOGO! 8 connection limit of 8 concurrent S7 connections and the HMI tag polling capacity of 100 tags (KTP400 limit).
9. HMI Screen Design
A minimum viable HMI screen for the shift log use case contains three elements:
- Current values - two numeric I/O fields bound to Temp_Current and Pressure_Current, refreshed every 500 ms.
- Trend view - a WinCC trend with 8 trend buffers. Bind buffer 1 to Temp_Shift_1, buffer 2 to Temp_Shift_2, and so on. Set update cycle to 1 000 ms and time axis window to "12 hours".
- Alarm view - a WinCC alarm control with the "LOGO!_Alarms" alarm class, which receives the messages from the Message Text block. The KTP400 holds the last 64 alarm events internally; the LOGO! 8 holds the last 256.
For the trend view, populate the trend buffers by writing a small VBScript that is triggered every 8 hours, copying the VM snapshot to the internal HMI tag array. A more elegant approach is to configure the trend source as "HMI tag array" with 35 entries and pre-fill it in the screen initialization using the LOGO! VM values.
10. Step-by-Step Commissioning
- Wire the analog source to AI1 (4-20 mA, two-wire) or to AM2 (Pt100). Verify in LOGO! display menu AI > AI1 that the raw value tracks the transmitter.
-
Insert the analog amplifier and configure: sensor 0/4-20 mA, scaling 0.0-100.0, output to tag
AM_Temp. - Add the weekly timer as in Section 4. Test by setting the LOGO! RTC to 07:59:50 and watching the Q output pulse for one minute at 08:00.
- Add the Data Log block, configure the file name and columns as in Section 5. Insert a micro SD card and wait for the LOGO! to remount (LED on the SD card symbol turns solid).
- Map the VM words as in Section 7.1.
- Transfer the program to the LOGO! 8 over Ethernet. Use PC > LOGO! in LOGO! Soft Comfort.
- Configure the HMI connection in TIA Portal as in Section 8 and download the KTP400 project.
-
Force a manual trigger from LOGO! Soft Comfort online mode: set the trigger input
M02true for one cycle. The Data Log row count should increment by one and the SD card file should grow by one line. - Verify on HMI that the trend and current values update.
11. Verification
After a 24-hour soak test the engineer must confirm five conditions:
| # | Check | Pass criterion |
|---|---|---|
| 1 | Data Log row count | 3 new rows in shiftlog.csv (one per 8 h) |
| 2 | CSV row count = LOGO! counter | Counter Shift_Counter in the display matches CSV ShiftNo column |
| 3 | SD card free space | Decreased by ~ 150 bytes (3 rows * 50 bytes) |
| 4 | KTP400 trend buffer | Three new points appear at 00:00, 08:00, 16:00 |
| 5 | Alarm view | Three new Message Text entries with the correct value |
12. Storage and Lifetime Calculations
Three sample points per day, 365 days per year:
Rows per year = 3 * 365 = 1 095 rows
Bytes per row (typical) = 50 B (timestamp + 3 columns + CRLF)
Bytes per year = 1 095 * 50 = 54.75 kB / year
8 GB SD card = 8 * 1024^3 B = 8 589 934 592 B
Years to fill = 8 589 934 592 / 54 750 = 156 877 years
Capacity is not a concern; the SD card wear-leveling and FAT32 metadata churn dominate the long-term reliability. In practice, plan a card replacement every 5-7 years for industrial installations and every 3-5 years for unattended outdoor sites.
13. Troubleshooting Matrix
| Symptom | Likely root cause | Diagnostic | Corrective action |
|---|---|---|---|
| No file on SD card | SD card not recognized | LOGO! menu Card > Status shows "no card" | Re-seat card, reformat to FAT32 with 4 KB clusters |
| File present but empty | Trigger pulse never fires | Online monitor on weekly timer Q | Check DST and time zone; verify day-of-week mask |
| Duplicate rows every hour | Trigger window too long | Inspect weekly timer ranges | Reduce ON window to 1 minute |
| File present, no timestamp | Column 0 disabled | Reopen Data Log block properties | Enable "Write timestamp" in column 0 |
| HMI shows # for values | S7 connection lost | Diagnostics > Connections on HMI | Verify Rack 0 / Slot 1, IP, subnet, no firewall on PC port |
| Tag not updating on HMI | VM address wrong | Read VW with LOGO! display menu | Recreate VM mapping, redownload HMI |
| KTP400 reports "Too many tags" | Tag count > 100 | TIA Portal project tree > HMI tags | Consolidate to array tags, reduce to 100 or fewer |
| CSV corrupted on Windows read | Locale separator mismatch | Open in Notepad - check delimiter | Use semicolon and German locale, or comma with English |
| Lost samples after power cycle | SD card was not flushed | Unplugged within 1 s of trigger | Wait 5 s after last trigger before removing card |
| Cycle time increases to > 1 s | Data Log + heavy program | LOGO! Soft Comfort online cycle time | Reduce function block count, split into two Data Log blocks |
14. Safety and Compliance Notes
The data logging path described here is a non-safety function. In safety-related applications under IEC 61508 / IEC 61511, the data log must not be the only audit trail for SIL 1 or higher. Pair the LOGO! 8 with a higher-level historian or a SIL-rated BMS. The KTP400 Basic PN is not TUV-certified for SIL operation; use the KTP400 Comfort or a separate Safe Panel for HMI on safety functions.
For installations subject to FDA 21 CFR Part 11 the CSV file must include an electronic signature column. The LOGO! 8 cannot generate cryptographically signed entries; a downstream PC process must sign the archive after collection.
15. Field-Proven Caveats
- Do not store the SD card in a card holder with a write-protect tab in the locked position - the LOGO! will silently fail to write.
- The Data Log block survives a power cycle, but the rolling VM chain does not. Persist the chain by writing each shift end to a separate Data Log row and rebuilding on cold start from the CSV.
- When the LOGO! 8 detects a corrupted FAT it recreates the
/LOGO/SDdirectory but does not recover existing CSV files. Pull the card monthly for backup if the data is regulatory. - Do not exceed 8 Data Log blocks per LOGO! program - the editor will warn, and the runtime will refuse to start.
- Use Siemens-validated SD cards (Siemens IA&DT Support) in environments with > 50 °C ambient. Consumer cards fail quickly at sustained high temperature.
16. FAQ
Can the KTP400 Basic PN create a data log on its own?
No. The SIMATIC Basic Panels (KTP400 Basic, KTP700 Basic, KTP1200 Basic) do not support the WinCC "Data log" runtime function. Logging must be executed on the LOGO! 8 (Data Log block on the SD card) or on a higher-level system. The KTP400 only displays the values via S7 tags or alarm views.
How many rows can the LOGO! 8 Data Log block hold?
Each Data Log block can hold up to 200 000 rows. At 3 rows per day that is more than 180 years of data per file, so the practical limit is the SD card size and wear, not the block size. You can use up to 8 Data Log blocks per LOGO! 8 program.
What is the minimum SD card size and which file system must it use?
SDSC (up to 2 GB) and SDHC (up to 32 GB) are supported; SDXC cards above 32 GB are rejected. The card must be formatted as FAT16 or FAT32. Siemens recommends industrial SDHC cards of 4-16 GB formatted with FAT32 and 4 KB cluster size for long endurance.
How do I get the CSV file off the SD card without stopping the LOGO!?
Three options: (1) hot-swap the SD card - the LOGO! continues running but stops logging for a few seconds, then resumes. (2) Use the LOGO! Web-Based Management (HTTP on port 8080) to download the file. (3) Use the LOGO! 8 FTP server (port 21) to copy the file via the network. The FTP path is /shiftlog.csv inside the card root.
Can I trigger the log at a custom interval such as every 30 minutes?
Yes. Replace the Weekly Timer with a single pulse generator (Blinker) with ON time = 1 s, OFF time = 1 799 s for a 30-minute interval; use the rising edge as the Data Log enable. For non-8-hour intervals below one hour you can also use a counter block driven by a 1-minute clock. Avoid the Astable Multivibrator for intervals that are not exact divisors of one day, because it drifts on long time scales.
Why does the cycle time of the LOGO! 8 spike when the SD card writes?
The Data Log block flushes the FAT directory after every row. This requires a sector write of approximately 4 KB, which takes 80-200 ms on a typical industrial SD card. The LOGO! cycle stalls for that duration. Plan the trigger at low-load moments and keep the program under 200 ms average cycle.
Can I display the historical CSV trend on the KTP400?
Indirectly. The Basic Panel cannot read files from the LOGO!, but you can mirror the last N samples into VM words using a shift register. The HMI trend view then reads those VM words as a tag array. For deeper history, export the CSV from the SD card to a PC and visualize in WinCC Runtime on a Comfort Panel or in a web-based dashboard.