1. Application Overview
This reference describes a complete downtime-capture application built on a Siemens LOGO! 8.2 logic module (firmware family 0BA8 / FS:02 and later) for a single-vendor conveyor line. The conveyor is fitted with a discrete PNP or NPN sensor that signals product present. When the sensor remains unmade for more than 60 seconds during a scheduled production shift, the LOGO! accumulates the elapsed time, logs it to a micro SD card, and exposes a live web view for management. At the end of each shift the operator removes the SD card and opens the resulting CSV in Microsoft Excel for charting.
The application is intentionally built with stock LOGO! function blocks: weekly timer, on-delay, edge-triggered pulse, counter / hour counter, and the integrated DataLog block. No custom function blocks, scripts, or HMI panels are required, which keeps the engineering footprint small and the validation path auditable for a first-time PLC user.
1.1 Operating Schedule
| Parameter | Value | Source / Notes |
|---|---|---|
| Production start | 07:00 local | User-specified shift start |
| Production end | 24:00 (midnight) local | User-specified shift end |
| Active days | Mon, Tue, Wed, Thu, Fri | Five day-of-week cams |
| Downtime threshold | 60 s of sensor low | Filters 1–2 s inter-product gaps |
| Time resolution | 1 minute | Sufficient for OEE reporting |
| Counter reset | 00:00 daily (end of shift) | Edge of weekly timer falling |
2. Functional Requirements and I/O Map
Capture the full functional specification in a single I/O map before opening LOGO! Soft Comfort. The table below is the binding document for wiring, programming, and FAT.
| Symbol | Type | Address | Description | Wiring / Note |
|---|---|---|---|---|
| SNS_PROD | Digital in | I1 | Product-present sensor, PNP NO | 3-wire; brown to +24V, blue to M, black to I1 |
| LMP_RUN | Digital out | Q1 (optional) | Downtime-active indicator lamp | 24V LED, 10 mA; can be omitted |
| SHIFT_OK | Flag | M8 | Within scheduled production window | Mirror of B001.Q |
| DT_ACTIVE | Flag | M9 | Downtime currently accumulating | SHIFT_OK AND (sensor off > 60 s) |
| DT_PULSE | Flag | M10 | 1-minute sample pulse during DT_ACTIVE | Clocked by asynchronous pulse generator |
| DT_COUNT | Counter | VW0 (Cnt block param) | Elapsed downtime in minutes | Source for DataLog column |
| DT_RESET_P | Pulse | M11 | One-shot at 00:00 to write log & clear counter | Edge of weekly timer falling |
3. Hardware Selection and Wiring
3.1 Recommended LOGO! 8.2 Base Module
The DataLog block, integrated Ethernet, and SD card interface are present on the 0BA8 / FS:02 generation. Use one of the following base modules (or their 12V/24V equivalents):
| Order Number | Description | Outputs | Power |
|---|---|---|---|
| 6ED1052-1MD08-0BA2 | LOGO! 8.2 BM, 8 DI / 4 DO | Relay 10 A | 115/230 V AC |
| 6ED1052-2MD08-0BA2 | LOGO! 8.2 BM, 8 DI / 4 DO | Relay 10 A | 24 V DC |
| 6ED1052-1CC08-0BA2 | LOGO! 8.2 BM, 8 DI / 4 DO | Transistor 0.3 A | 24 V DC |
Reference the LOGO! 8 system manual for full ratings, derating, and installation clearances: LOGO! 8 System Manual (Siemens Support, 109751654).
3.2 Sensor Wiring
Use a 3-wire PNP normally-open photoelectric or inductive sensor. The dark-on / light-on mode is set in the sensor; the application uses light-on so the input is high when product is detected.
Wire colours match IEC 60446:
- Brown (BN): +24 V DC to sensor pin 1 / L+
- Blue (BU): 0 V DC to sensor pin 3 / M (and to LOGO! M terminal)
- Black (BK): switched output to LOGO! I1
3.3 SD Card Requirements
Use a micro SD or SD card (with adapter) of 4 GB to 32 GB SDHC capacity formatted as FAT32. SDXC cards (64 GB+) are not supported. Industrial-grade cards (for example Siemens 6ES7648-2BF10-1QA0 or comparable) are recommended in panel-mount installations where vibration or temperature extremes are expected.
4. Software Prerequisites
| Item | Required Version | Notes |
|---|---|---|
| LOGO! Soft Comfort | V8.2 SP2 or V8.3 / V8.4 | FBD/LAD editor and simulator |
| LOGO! BM firmware | FS:02 (8.2) or later | FS:01 (8.0) lacks extended DataLog |
| PC OS | Windows 10 / 11 (x64) | Admin rights needed for installer |
| Ethernet access | Static IP in 192.168.0.x range | LOGO! default 192.168.0.10 |
| Excel | 2016 / 2019 / 2021 / 365 | UTF-8 CSV import wizard |
Download the latest LOGO! Soft Comfort installer and firmware updates from the Siemens Industry Online Support portal: LOGO! Soft Comfort V8.x Documentation.
5. Shift Window Logic (Weekly Timer)
The shift window is implemented with a Weekly Timer block (drag from the Special > Timer palette as Weekly timer). On a 0BA8 module, the block provides up to three independent cams; the LOGO! 8.2 firmware can expose additional cams per block depending on the catalog version. Configure one cam per active day.
5.1 Block B001 — Weekly Timer (Shift Window)
| Cam # | On Time | Off Time | Day Mask | Purpose |
|---|---|---|---|---|
| 1 | 07:00 | 24:00 | Mon | Monday shift |
| 2 | 07:00 | 24:00 | Tue | Tuesday shift |
| 3 | 07:00 | 24:00 | Wed | Wednesday shift |
| (4) | 07:00 | 24:00 | Thu | Thursday shift (use B001.B002 cam if 3-cam limit applies) |
| (5) | 07:00 | 24:00 | Fri | Friday shift |
B001.Q is therefore the natural trigger to (a) write a DataLog record and (b) reset the counter for the next day. Some firmware versions treat 24:00 as 00:00 of the next day; if your build does, set the off time to 23:59 and add a separate 1-minute pulse generator to fire the reset at 00:00.Connect B001.Q directly to M8 (flag SHIFT_OK) so the rest of the program can AND the shift condition with the sensor-debounce result.
5.2 Block B006 — Nightly Reset Pulse
Use a second weekly timer with a single very-short cam to fire at 00:00:00 of each day:
| Parameter | Value |
|---|---|
| Cam 1 On | 00:00 |
| Cam 1 Off | 00:01 |
| Day mask | Mon, Tue, Wed, Thu, Fri, Sat, Sun |
| Output | M11 (DT_RESET_P) |
The rising edge of M11 drives the DataLog trigger and the counter reset. The pulse is 60 s wide, which is long enough to be captured reliably by the DataLog block's edge detector.
6. Downtime Detection Filter
The 1–2 s inter-product gap is filtered using an On-Delay block with TA = 60 s. The on-delay is preceded by an Off-Delay of 2 s on the sensor input to debounce the photoelectric / inductive pickup at line edges; this prevents a 50 ms false-low from re-starting the 60 s timer.
6.1 Block Sequence
- B010 — Off-delay, TA = 00:00:02 (sensor debounce). Input: I1. Output: M12.
- B002 — On-delay, TA = 00:01:00 (60 s). Input: M12. Output: M13.
- B011 — AND with shift window. Inputs: M13 AND M8. Output: M9 (DT_ACTIVE).
Logic expression for DT_ACTIVE:
DT_ACTIVE = SHIFT_OK · ¬(sensor ON for < 60 s)
Equivalently, expressed with the block variables:
M9 = M8 AND (NOT M12_LATCH) where M12_LATCH is the 60-second-on-delayed negation of the debounced sensor
6.2 Why an On-Delay, Not a Pulse Generator
A pulse generator would toggle every cycle regardless of whether product ever returned. The on-delay only sets the output high after the sensor has been continuously low for the threshold, which matches the spec: "start counting only when the sensor is not made for about 1 minute."
7. Downtime Accumulator
Two implementation options are available; the choice depends on which value the DataLog block writes.
7.1 Option A — Hour Counter (recommended for minute resolution)
The Hour counter block (B008) increments an internal MM:SS register whenever its EN input is high. With EN = DT_ACTIVE (M9) the counter records the wall-clock duration of every downtime event inside the shift window. Reset it via R = M11 (DT_RESET_P).
| Block parameter | Value | Effect |
|---|---|---|
| EN | M9 (DT_ACTIVE) | Start/stop the running total |
| R | M11 (DT_RESET_P) | Zero the counter at 00:00 |
| Display range | 0–99 999 h | Sufficient for years of operation |
7.2 Option B — Up Counter of 1-Minute Pulses (integer minutes)
If management prefers a clean integer minutes value, drive a 1-minute pulse generator and feed an up-counter.
| Block | Type | Parameter |
|---|---|---|
| B009 | Asynchronous pulse generator | TH = 00:01:00, TL = 00:01:00 |
| B012 | AND gate | Inputs: M9 (DT_ACTIVE) AND M14 (B009.Q) → M10 (DT_PULSE) |
| B003 | Up/down counter | Cnt = M10, R = M11, On = unused, Off = unused |
The counter value is an integer minute count for the current shift. The conversion from MM:SS in option A to integer minutes is:
downtime_minutes = floor(MM·60 + SS) ÷ 60
Implement this in Excel with the formula =INT((HOUR(A1)*60+MINUTE(A1)+SECOND(A1)/60)) applied to the imported timestamp field, or do the floor in the LOGO! by using the integer counter option directly.
8. DataLog Configuration
The DataLog block is the bridge to Excel. Place it on the diagram and configure columns that match the variable memory addresses of the two accumulators above.
8.1 Block B004 — DataLog
| Column | Source | Format |
|---|---|---|
| 1. Timestamp | LOGO! internal RTC | YYYY-MM-DD HH:MM:SS |
| 2. DayOfWeek | VM address holding B001 weekday bitfield | Integer 1–7 |
| 3. DowntimeMin | VW0 (counter value) | Unsigned integer |
| 4. DowntimeHM | VW2 (hour counter MM,SS) | Two bytes packed |
| 5. ShiftOK | VM bit of M8 | 0/1 |
Trigger the block on the rising edge of M11 (the 00:00 nightly pulse). The block writes one row to /datalog.csv on the SD card. File-system path and naming are firmware-dependent; the canonical default is the SD card root with file name downtime.csv, but verify in the DataLog block properties dialog.
8.2 SD Card File Format
Files are plain CSV with ; or , separator depending on the LOGO! configuration (default separator: ; to suit European Excel locales). The file header is one row; subsequent rows are the daily records.
Timestamp;DayOfWeek;DowntimeMin;DowntimeHM;ShiftOK
2024-03-04 00:00:01;1;37;0:37:00;0
2024-03-05 00:00:01;2;12;0:12:00;0
Open the file in Excel with Data > From Text/CSV and select the matching separator. Excel will then expose the columns as a structured table.
9. Web Server for Live Monitoring
The LOGO! 8.2 firmware exposes an extended web server that displays variable values in real time. Use it as the management "dashboard" for the current shift.
- Connect a Cat5e patch cable from the LOGO! Ethernet port to a managed switch on the company network.
- From LOGO! Soft Comfort, set the LOGO! IP (default
192.168.0.10) or enable DHCP. Verify withpingfrom a PC. - Open the variable list in the Tools > Define Web Server Variables menu and mark the addresses
VW0,M8,M9as visible. - Open a browser to
http://192.168.0.10(or the assigned IP). The default page shows the LOGO! status, current variables, and a tag for each selected VM area.
10. Excel Export and Visualization
End-of-shift procedure for the operator:
- Power the LOGO! off (recommended but not required; the SD card can be hot-removed in most firmware versions).
- Open the SD card slot cover, depress the card, and remove it.
- Insert the card into a PC.
- Copy
downtime.csvto a folder named with the shift date, for exampleY:\OEE\2024-03-04\downtime.csv. - Open in Excel via Data > From Text/CSV.
10.1 Recommended Excel Layout
| Column | Source | Excel Type |
|---|---|---|
| A — Date | =DATE(YEAR(A2), MONTH(A2), DAY(A2)) |
Date |
| B — Weekday | =TEXT(A2, "ddd") |
Text |
| C — DowntimeMin | From CSV column 3 | Number |
| D — OEE % |
=1 - C2/1020 where 1020 = scheduled minutes (17 h × 60) |
Percent |
10.2 Recommended Charts
- Daily downtime bar chart: insert a clustered column chart of Date vs DowntimeMin. Right-click > Add Data Labels.
- OEE trend line: insert a line chart of Date vs OEE %. Use a secondary axis if combining with the bar chart.
- Threshold conditional formatting: apply a red fill where DowntimeMin > 60 to flag days above the alert threshold.
11. Simulation, Commissioning and Verification
11.1 Offline Simulation in LOGO! Soft Comfort
- From the menu Tools > Simulation (or press F3) enter simulation mode.
- Open the I/O Status dialog. Force I1 = 1, force the system clock to 07:00 on a Monday.
- Confirm that M8 (SHIFT_OK) goes high within 1 s of the clock crossing 07:00.
- Force I1 = 0 and let the simulation run for 65 simulated seconds. Confirm M9 (DT_ACTIVE) goes high at 60 s and that VW0 (or the hour counter) starts incrementing.
- Force I1 = 1 again. Confirm M9 drops immediately (the on-delay does not require a falling-edge reset).
- Move the clock past 00:00 of the next day. Confirm M11 pulses, the DataLog block records one row, and the counter resets to zero.
11.2 On-Site Verification Checklist
| # | Step | Pass Criteria |
|---|---|---|
| 1 | Power on LOGO! with sensor disconnected | No fault LED; module reports RUN |
| 2 | Insert SD card; browse web server | Card status shows OK; no "Card missing" alarm |
| 3 | Force sensor with a metal target / test object | I1 = 1 in web status; M8 indicator state correct |
| 4 | Set system clock to 06:59:30, observe | M8 transitions 0→1 at 07:00:00 ± 1 s |
| 5 | Hold sensor unmade for 70 s during shift | M9 goes high at 60 s, counter increments at 1 minute |
| 6 | Trigger 1–2 s product gap | M9 stays low; counter does not increment |
| 7 | Run a full 17-hour shift test (compressed) | DataLog row appears in CSV with non-zero downtime |
| 8 | Pull SD card at 00:00:30, open CSV in Excel | Row count = days in production since last card format |
12. Troubleshooting Matrix
| Symptom | Likely Cause | Diagnostic Step | Corrective Action |
|---|---|---|---|
| Counter always 0 | Weekly timer not configured for current weekday | Open web server, check M8 during shift | Re-open B001 and add a cam for the missing day |
| Counter increments during 1 s product gaps | On-delay TA set too low or wired wrong | Inspect B002 parameter TA | Set TA = 00:01:00; verify B002 input is the debounced M12, not raw I1 |
| DataLog file missing | SD card not inserted, not FAT32, or full | Check LOGO! display for SD icon | Insert / reformat SD card; verify file path in DataLog block properties |
| CSV opens with all data in column A | Separator mismatch | Open Notepad on the CSV | Re-import via Data > From Text/CSV; set separator to ;
|
| Web server returns "Page not found" | PC on different subnet, DHCP issue | ping 192.168.0.10 |
Assign static IP in 192.168.0.x or enable DHCP on LOGO! |
| Counter does not reset at midnight | Reset pulse cam is one minute off | Check M11 in web status at 00:00:30 | Verify B006 cam on/off; account for 24:00 vs 23:59 firmware behaviour |
| Sensor reads intermittent | Shield not grounded, cable runs near VFD | Check I1 in web status during fault | Use shielded cable, ground shield at LOGO! end only, separate from VFD conductors by 200 mm |
| Block download fails | LOGO! in RUN, not STOP | LOGO! display shows "RUN" | Stop the LOGO! from display or Soft Comfort before downloading |
12.1 Common Configuration Pitfalls
- Off-time 24:00 vs 00:00: depending on firmware, the weekly timer cam may interpret 24:00 as 00:00 of the next day. If the cam appears to never turn on, set Off = 23:59 and add a pulse generator for the reset.
- Retain not enabled: if the LOGO! loses power mid-shift, the counter value is lost. Enable Retain on the counter and on the DataLog row pointer to survive power cycles of up to ~80 hours (LOGO! has a super-cap that retains RAM for short outages; for longer outages the SD card is the source of truth).
- DataLog trigger race: if the trigger edge and a process variable change occur in the same LOGO! scan, the recorded value can be the new value, not the previous shift's value. Add a 1 s delay between the shift-end edge and the DataLog trigger to give the counter a final cycle to settle.
13. Field Commissioning Notes and Edge Cases
13.1 Long-Weekend Behaviour
Because the cam mask only includes Mon–Fri, no rows are written on Saturday or Sunday. The CSV therefore has a one-row gap from Friday 00:00 to Monday 00:00; this is intentional and reflects production, not a fault.
13.2 Shift Overrun Across Midnight
If a shift ever runs past 00:00 (for example a Friday that ends at 02:00 Saturday), the current program will stop counting at 00:00 and reset the counter. To support an overrun, add a second weekly timer covering 00:00 – 02:00 Sat and OR its output into M8 with a separate counter (M_Sat) so the data is segregated by calendar day.
13.3 Sensor Power Loss as Downtime
If the sensor loses power, its PNP output is undefined. With light-on wiring, a powered-down sensor typically presents a low (0) to I1, which the application will correctly classify as downtime after the 60 s filter. Verify with a controlled test: disconnect the sensor wire and observe M9 after 60 s.
13.4 Alternate Display Options
The optional LOGO! TDE text display (6ED1055-4MH08-0BA0) can show the current downtime in plain text on the conveyor, useful for line operators. The text-display page is configured in LOGO! Soft Comfort with the message text block.
13.5 Migrating to a LOGO! 8.3 or Later
LOGO! 8.3 (FS:03) adds MQTT publish directly from the variable table, removing the need for SD card retrieval in a networked plant. The program above is forward-compatible: the DataLog block can be retained as a backup, and a new MQTT client block can be added that publishes the same VW0 value once per minute.
14. Bill of Materials
| Qty | Item | Order Number (example) | Purpose |
|---|---|---|---|
| 1 | LOGO! 8.2 BM, 24 V DC, relay out | 6ED1052-2MD08-0BA2 | Controller |
| 1 | PNP photoelectric sensor, 24 V DC, NO | Vendor-specific (e.g. SICK W4-3) | Product detection |
| 1 | Sensor mounting bracket | Vendor-specific | Mechanical |
| 1 | 24 V DC PSU, 1 A | Siemens 6EP1332-1SH43 or equivalent | Power |
| 1 | Micro SDHC card, 4 GB, industrial | 6ES7648-2BF10-1QA0 | DataLog storage |
| 1 | Cat5e patch cable, 2 m | 6XV1850-2GH20 | Ethernet to network |
Why use an on-delay of exactly 60 seconds for the downtime filter?
The 1–2 second gap between products on the conveyor is normal. Setting the on-delay TA = 00:01:00 in B002 ensures the LOGO! only treats the sensor-off state as downtime if it persists for at least 60 seconds, which is well above the worst-case inter-product gap. Shorter values risk false positives; longer values delay the start of accumulation when the line truly stops.
Can the LOGO! 8.2 store downtime on the SD card automatically?
Yes. The integrated DataLog block (B004) writes a CSV row to the SD card on the rising edge of its enable input. With an edge from the 00:00 weekly timer (B006) connected to the enable, one row per production day is appended to downtime.csv on the card. The card must be FAT32 SDHC, 4–32 GB.
How do I view the CSV file in Microsoft Excel?
Power off the LOGO!, remove the SD card, and insert it into a PC. Open Excel and use Data > From Text/CSV; select the LOGO! file and choose the ; separator (the LOGO! default). The columns will load as a table ready for pivot charts. The most useful chart is a daily bar of DowntimeMin with a 60-minute threshold highlight.
Can management see the current downtime without taking the SD card out?
Yes, with the LOGO! 8.2 extended web server. Connect the LOGO! Ethernet port to the company network, mark the counter variable as visible in Tools > Define Web Server Variables, and browse to http://<LOGO_IP>. Operators and supervisors then see the running total live from any PC on the network.
What happens to the counter if the LOGO! loses power mid-shift?
Without the Retain option enabled, the counter resets to zero on power-up. Enable Retain on the counter and on the DataLog configuration so the value survives short outages (the LOGO! has an internal super-capacitor that retains volatile data for several hours). For longer outages, the SD card CSV is the canonical record of all prior shifts.
Does the weekly timer treat 24:00 the same as 00:00?
It depends on the firmware revision. In most 0BA8 builds, a cam with Off = 24:00 turns the output off at midnight, producing the falling edge needed to trigger the DataLog and reset. In some early FS:01 builds the cam is interpreted as Off = 00:00 of the next day, which means the cam never appears to turn on. If the cam stays high all day, change Off to 23:59 and add a one-minute pulse generator for the reset at 00:00.