Overview
Parking gate and vehicle counting systems use retro-reflective or through-beam infrared sensors at the entry and exit lanes. When two vehicles trigger the entry and exit sensors within the same controller scan cycle, the application program must process both events without losing either count. Siemens LOGO! logic modules combine a deterministic cyclic scan with a fixed input image read at the start of each cycle, which raises a recurring engineering question in parking applications: can a single LOGO! reliably capture truly simultaneous digital inputs from IR-beam sensors, and what is the smallest pulse width that the input stage is guaranteed to register?
This reference analyzes the LOGO! scan cycle, the input filter behavior, and the function-block resources required to handle simultaneous entry/exit triggers. It also documents the recommended Up/Down counter pattern, a pulse-stretching fallback, the LOGO!Soft Comfort simulation workflow, and the bench verification steps for production commissioning. All timing values are taken from the Siemens LOGO! system manual and Siemens support article 109751654 (Short impulses on LOGO! inputs).
LOGO! Scan Cycle Architecture and Timing
The LOGO! basic module (BM) and LOGO! Pure module use a cyclic execution model. Each cycle consists of three phases:
- Read the process image of the inputs (PI update) at the start of the cycle.
- Execute the user program sequentially from top to bottom, evaluating every function block (FB) exactly once per cycle.
- Write the process image of the outputs (PO update) at the end of the cycle.
Per the LOGO! system manual, the time to process a single function block is approximately 0.1 ms on LOGO! 8 (6ED1052-xx) hardware. A program that fills the maximum number of function blocks therefore runs in roughly 40 ms worst case. A small parking application with one Up/Down counter, two edge detectors, and one threshold switch typically runs at 0.5-2 ms per cycle on a LOGO! 8 BM. The figure below illustrates the cycle.
The relevant consequence for input handling is that the digital input is sampled once at the start of the cycle. Any pulse that occurs entirely inside a single cycle but does not straddle the read boundary is not guaranteed to be latched into the process image. The minimum detectable pulse width is therefore bounded below by the input filter time of the digital input, not by the scan time itself. The scan time only affects how fast the program reacts to a transition that has already been latched.
Digital Input Electrical and Timing Characteristics
LOGO! digital inputs (I1 through I24 depending on base module and expansion) are 24 V DC sinking inputs with a fixed hardware RC filter. The published specifications for LOGO! 8 (6ED1052-xxx08-0BA1) base modules are summarized in the table below; values are taken from the LOGO! system manual and Siemens support article 109751654.
| Parameter | Typical value (LOGO! 8 BM) | Notes |
|---|---|---|
| Input voltage range | 0 to 24 V DC (max 28.8 V) | Reverse-polarity tolerant within range |
| Logic 0 threshold (off) | < 5 V DC | Per datasheet 6ED1052 |
| Logic 1 threshold (on) | > 12 V DC | Per datasheet 6ED1052 |
| Input current at 24 V | ~5 mA typical | Source current limited internally |
| Hardware filter time (standard DI) | ~1 ms | RC filter on input stage |
| Minimum guaranteed pulse width | 5 ms (recommended); 1 ms sporadic | Field experience; per support article 109751654 |
| Fast input max frequency (I3-I6 on BM) | 5 kHz | LOGO! 8 BM only; counter mode A/B |
| Standard DI max input frequency | 4 Hz | Period must exceed filter time by >5x |
| Isolation | None (referenced to 24 V DC common) | Use external relay for HV isolation |
Siemens support article 109751654 explicitly states that pulses around 1 ms are only sporadically recognized at the standard digital inputs. Pulses of 5 ms or longer are reliably captured. The IR beam sensors used in parking applications typically have a make/break time of 10-30 ms and a settled on-state of 50-100 ms or more, which places them well above the LOGO! input filter threshold. The risk of a missed trigger is therefore not a property of the LOGO! itself but of the sensor output configuration.
IR Beam Sensor Pulse Requirements
The most common parking-lot lane trigger is a through-beam photo eye or retro-reflective sensor with a PNP dark-on or light-on output. Representative part numbers include:
- SICK WL100-2 (through-beam, PNP NO, 50 ms response, IP67)
- Banner Q4X (laser distance, IO-Link, configurable output pulse 10-1000 ms)
- Omron E3F-DS30 (diffuse reflective, PNP, 30 ms response)
- Pepperl+Fuchs GLV18-8-200 (through-beam, <1 ms response, PNP, M18 housing)
- IFM O1D100 (time-of-flight, PNP, configurable output pulse 50-5000 ms)
When the sensor is wired to a 24 V DC digital input of the LOGO! and the output pulse is left at the factory default (typically 30-100 ms), the LOGO! input filter is satisfied with margin. The risk appears when the integrator reduces the pulse width to minimum, or when a third-party sensor outputs a latched vehicle-present signal that the counter must edge on. In that case, the trigger is an edge, not a level, and the pulse-stretching workaround described below is required.
Sensor wiring rules that must be observed to avoid ground loops and EMI-induced false triggers:
- Use a dedicated 24 V DC output from the LOGO! power supply (terminals U+, U-) or from the same 24 V bus that feeds the LOGO!. Do not power the sensor from a separate power supply without bonding the DC commons.
- Keep the sensor cable under 30 m or use shielded cable (CY-JZ or similar) with the shield bonded to the LOGO! PE terminal at one end only.
- Add a 100 nF X2 capacitor across the sensor output terminals at the LOGO! end of the cable to suppress long-cable ringing on the rising edge.
- Route the sensor cable at least 200 mm from any VFD output cables and never in the same conduit as a three-phase motor feeder.
Simultaneous Input Behavior Analysis
Two physical events can occur close together in a parking system:
- The same vehicle passes two beams spaced by less than 50 mm (single-lane direction discrimination). The LOGO! input filter is irrelevant because the second beam pulse follows the first by tens of milliseconds.
- Two vehicles enter and exit in different lanes such that both IR-beam outputs transition from 0 to 1 inside the same scan cycle. This is the scenario raised in the original application question.
The relevant analysis for case 2 is:
- Both inputs are sampled at the start of the same cycle, so both 0-to-1 transitions are captured in the process image.
- During the program execution phase, the Up/Down counter function block evaluates its Up and Down inputs from the same process image. The Counter FB (B003 in LOGO! 8) increments or decrements by exactly one per cycle regardless of which edge arrived first.
- A simultaneous transition on both inputs within one cycle results in either +1 then -1 (net 0) or -1 then +1 (net 0), depending on the order the FB places the inputs in the chain. This is the source of the cancelled-count symptom reported by integrators who wire the raw inputs directly into the counter without edge detection.
To prevent cancellation, route the entry trigger through a rising-edge detector (LOGO! edge marker or the B001/B002 edge FBs) and the exit trigger through a second edge detector, so each trigger contributes a single-cycle pulse regardless of dwell time. The order of evaluation is fixed by the position of the function block in the FBD chain. To guarantee that an entry counts up and an exit counts down in a simultaneous event, place the Up edge detector before the Down edge detector in the program. The diagram below shows the recommended FBD topology.
The net behavior in a worst-case simultaneous event is therefore: Up edge fires for one cycle, then Down edge fires for one cycle, and CV ends at the correct value. The edge detector ensures that the same beam that remains high for 200 ms does not retrigger the counter, even if the scan cycle is long enough for the LOGO! to read a second high sample.
Up/Down Counter Function Block (B003)
LOGO! 8 ships the Up/Down Counter (function block identifier B003). Its key parameters are:
| Parameter | Range | Description |
|---|---|---|
| On threshold (On) | 0 to 999999 | Set output Q high when CV ≥ On |
| Off threshold (Off) | 0 to 999999 | Reset output Q low when CV ≤ Off |
| Start value (STV) | 0 to 999999 | Initial value on cold start, retained if Ret is on |
| Up input (C+) | bool | Count up on rising edge |
| Down input (C-) | bool | Count down on rising edge |
| Reset (R) | bool | Asynchronous reset of CV to 0 |
| Retentive (Ret) | bool | Preserve CV across power cycles |
| Count value (CV) | 0 to 999999 | Live counter output |
| Output Q | bool | CV ≥ On |
The counter evaluates C+ and C- in the order the FBD is laid out. With both edges present in the same cycle, the program performs the increment first and the decrement second (or vice versa). The CV therefore stabilizes at the correct value after one full cycle, but a naive implementation that wires the raw I1 and I2 into the counter inputs without edge detection can show a transient off-by-one if a second event arrives in the same cycle, because the same cycle may be counted twice in succession.
For a parking counter, the recommended pattern is:
- Apply the Up/Down Counter (B003) with retentive enabled.
- Feed C+ from a rising-edge detection on I1 (entry beam broken).
- Feed C- from a rising-edge detection on I2 (exit beam broken).
- Use CV as the live vehicle count, exported to a 7-segment display or sent via Modbus TCP to the camera system.
- If a zero-floor is required (so that CV cannot decrement below 0), add a comparator B007 that gates the Down input by (CV > 0).
Pulse-Stretching Techniques
If a sensor cannot guarantee a pulse above 5 ms, insert a pulse-stretching function in front of the counter. The most compact implementation uses an On-delay + Off-delay combination:
An On-delay of 5 ms rejects sensor bounce and electrical noise shorter than the LOGO! input filter. An Off-delay of 50 ms holds the signal high long enough that at least one full scan cycle observes a stable high state, so the rising edge will always be present in the process image on the cycle that counts it. Adjust the off-delay if your scan cycle is known to be longer; the rule of thumb is Off-delay ≥ 3 × t_cycle. The 5 ms + 50 ms pair is the most common pattern in LOGO!Soft Comfort V8.4 example programs.
LOGO!Soft Comfort Program Example
The following FBD excerpt is the canonical pattern. Save it to a LOGO! 8 (6ED1052-CC08-0BA1) project in LOGO!Soft Comfort V8.4 or later. Open the simulation (Tools → Simulation) and force I1 and I2 to verify behavior before downloading to the module.
FBD chain (top-to-bottom evaluation order):
B001 Edge detect (rising) on I1 -> Q to B003.C+
B002 Edge detect (rising) on I2 -> Q to B003.C-
B003 Up/Down Counter
C+ = B001.Q
C- = B002.Q
On = 1
Off = 0
STV = 0
Ret = 1 (retain across power cycle)
B007 Analog comparator (gate Down input)
A = B003.CV
B = 0
Out = B002.Q AND (CV > 0)
(implement using B008 AND gate)
B005 Threshold switch (Q1 = gate-open relay)
input = B003.CV
On = 1
Off = 0
B751 Modbus TCP client write (firmware V8.4+)
remote IP = camera server
port = 502
unit ID = 1
register = 40001 (holding)
source = B003.CV
Simulate the program by forcing I1 and I2 to 1 in the same cycle. Use the LOGO!Soft Comfort Status view to confirm that CV increments to 1 on the first force, then to 0 when both I1 and I2 are forced in the same cycle (because Up and Down both fire in the same cycle, then settle), and that it cannot decrement below 0 due to the B007/B008 zero-floor gate. Enable Retain to keep CV across power cycles, which matches the parking-lot billing model where the in-lot count must survive an overnight power event.
Edge Cases and Failure Modes
| Failure mode | Likelihood | Mitigation |
|---|---|---|
| IR beam pulse < 1 ms missed by digital input | Medium for low-cost sensors | Pulse-stretch using On-delay + Off-delay (B001/B005) |
| Simultaneous Up and Down in same cycle cancel out | Low with edge detection | Place Up branch before Down branch in FBD; add explicit edge detectors |
| Scan cycle > 40 ms with full FB load | Low for parking apps | Reduce FB count; remove unused analogue FBs; switch to LOGO! 8.4 optimized engine |
| Mechanical bounce on gate relay output | Medium | Add 50 ms On-delay on the gate command output |
| Sensor dark-on vs light-on inverted | Operator error | Wire NC output or invert in FBD with NOT (B002 in LOGO! 8) |
| Counter resets on power cycle | Always if Ret = 0 | Set Ret = 1; battery in BM is not required for retentive counters |
| Counter overflow at 999999 | Very low (years of operation) | Reset via shift schedule; or migrate to S7-1200 with INT/DINT |
| EMI-induced false trigger on long sensor cable | Medium in industrial sites | Shielded cable, 100 nF at LOGO! end, separate 24 V supply |
| Two vehicles enter during one beam-break (tailgating) | Application-specific | Use a second beam to detect direction; count only valid single entries |
| Object parked on beam (CV drifts due to re-triggers) | Low with edge detection | Edge detection makes the counter immune to level; still log a fault if I1 stays high > 5 min |
Commissioning and Verification
Follow this checklist before handing the system to the gate operator. All steps assume a LOGO! 8 BM with firmware V8.4 or later, programmed through LOGO!Soft Comfort V8.4.
- Wire a bench pulse generator (e.g. a square-wave source or an Arduino + 24 V level shifter) to I1 and I2. Set pulse width to 1 ms, 5 ms, 20 ms and 100 ms. Verify that the counter increments for widths ≥ 5 ms and that widths < 1 ms may be missed. Document the failure threshold in the commissioning report.
- Use a two-channel function generator to fire I1 and I2 within 1 µs of each other. Verify that the counter increments by +1 (or decrements by -1, depending on FBD order) and not by 0. This is the simultaneous-trigger acceptance test.
- Display the CV on a LOGO! TDE expansion text panel (6ED1055-4MH08-0BA1). Confirm that the value matches a manual count over a 30-minute test window.
- Disconnect one sensor and short the input. Confirm that the counter does not drift on its own. A drifting counter indicates a wiring or noise issue, not a LOGO! bug.
- Cycle power to the LOGO! (24 V off for 10 s). Verify that the CV is retained when Ret = 1 and that it resets to STV when Ret = 0. Retentive counter storage is in non-volatile flash on the LOGO! 8 BM and survives >100,000 power cycles per the Siemens datasheet.
- On a Modbus TCP-connected system, poll the camera server register 40001 and confirm the value tracks the LOGO! CV within one scan. Use a Modbus poll tool such as the free Modbus Poll utility to confirm the server side independently of the camera vendor.
- Capture the LOGO! diagnostic buffer (Tools → Diagnostics in LOGO!Soft Comfort) to record any short-cycle overruns, communication errors, or scan-time spikes during a 24-hour soak test. A scan-time above 30 ms sustained indicates that the program is approaching the FB maximum and should be optimized.
- Perform an EMC spot check: place a 5 W handheld UHF transmitter (e.g. a two-way radio) within 200 mm of the sensor cable and key the PTT for 10 s. The counter must not increment. If it does, the cable shield bonding is incorrect.
Hardware Recommendations
| Component | Catalog number | Role |
|---|---|---|
| LOGO! 8 BM 24V | 6ED1052-1CC08-0BA1 | CPU with 8 DI, 4 DO, Ethernet; firmware V8.4+ |
| LOGO! 8 DM16 24V | 6ED1055-1CB10-0BA2 | Expansion: 8 DI, 8 DO for two-lane systems |
| LOGO! TDE | 6ED1055-4MH08-0BA1 | Text display for CV and status |
| LOGO! Power 24 V 5 A | 6EP1332-1SH71 | SITOP power for LOGO! and sensor |
| IR beam sensor (entry) | SICK WL100-2 or P+F GLV18-8-200 | PNP NO 24 V; 50 ms response |
| IR beam sensor (exit) | SICK WL100-2 or P+F GLV18-8-200 | PNP NO 24 V; 50 ms response |
| Counter pulse stretch | FB B001 + B005 (built-in) | Pulse-stretch in FBD |
| Modbus TCP target | Any camera server with Modbus gateway | Receive CV at register 40001 |
Alternative Controllers and Migration Paths
If the parking application grows beyond 200 vehicles/day, multi-site aggregation, or requires a longer counter range than 999999, evaluate the following Siemens migration paths:
- SIPLUS LOGO! 8 (6AG1052-1CC08-2BA1) for extended temperature range (-40 to +70 °C) outdoor installations.
- ET 200SP CPU 1510SP-1 PN (6ES7510-1DJ02-0AB0) for sites that need a DINT counter range (4 294 967 295) and PROFINET to the camera system.
- S7-1200 CPU 1214C (6ES7214-1AG40-0XB0) for sites that need high-speed counters above 200 kHz and a 16-bit or 32-bit integer counter without wraparound.
For non-Siemens alternatives in the same form factor, the Wago 750-8100 PFC100 and the Phoenix Contact Axioline F ILC 151 offer comparable counter performance with 32-bit integers and multi-protocol Ethernet out of the box. These are not drop-in replacements for LOGO! and require re-programming in the vendor's IDE, but they eliminate the 999999 cap.
Summary of Best Practices
- Always edge-detect the lane trigger before feeding the Up/Down counter, even if the sensor pulse is 100 ms.
- Place the Up edge branch before the Down edge branch in the FBD to define evaluation order.
- Set the Up/Down counter to Retentive so the count survives a power cycle.
- Gate the Down input by (CV > 0) to clamp the counter to a zero floor.
- If the sensor pulse is below 5 ms or the cable is longer than 10 m, pulse-stretch with On-delay + Off-delay.
- Bench-test with a two-channel pulse generator before deployment to validate the simultaneous-trigger acceptance criterion.
- Do not use the counter as a safety input; install a separate light curtain for personnel detection.
FAQ
What is the smallest pulse the LOGO! digital input can register?
Standard LOGO! 24 V DC digital inputs have a hardware filter of roughly 1 ms. Pulses ≥ 5 ms are reliably captured; pulses around 1 ms are recognized only sporadically per Siemens support article 109751654. Use the fast counter inputs (I3-I6 on the LOGO! 8 BM) for sub-millisecond pulses, or pulse-stretch with an On-delay + Off-delay pair to widen short pulses before they reach the counter.
Can LOGO! handle two simultaneous IR-beam triggers without missing one?
Yes. The process image is read once at the start of the cycle, so a 0-to-1 transition on both inputs in the same cycle is captured. To prevent the Up/Down counter from cancelling, run each input through a rising-edge detector and place the entry branch before the exit branch in the FBD chain. Verified with LOGO!Soft Comfort simulation forcing I1 and I2 in the same cycle.
What is the worst-case LOGO! scan time?
On LOGO! 8 hardware, a single function block takes about 0.1 ms. A program that uses the maximum number of FBs therefore runs in roughly 40 ms. This is well below the dwell time of a typical IR beam (50-100 ms) but well above the input filter time, so it does not limit input capture in normal operation. Use Tools → Diagnostics in LOGO!Soft Comfort to measure the actual scan time of your project.
How do I retain the vehicle count across a power cycle?
Set the Ret (Retentive) parameter on the Up/Down Counter (B003) to 1. The counter value is stored in non-volatile flash memory on the LOGO! BM and restored on the next cold start. No backup battery is required for retentive counters. The flash is rated for >100,000 write cycles per the Siemens datasheet, which is sufficient for parking applications where Ret is only written on each count event.
Can I send the count to the camera server over Ethernet?
Yes. Use the Modbus TCP client function block (B751 in LOGO! 8 with firmware V8.4 or later) to write B003.CV to a holding register on the camera server. The default port is 502 and the unit ID is 1. Confirm register-map support on the camera side using the camera vendor's Modbus register map; if the camera does not speak Modbus, use the LOGO! web server to publish CV as a JSON value and have the camera poll the web server with an HTTP GET.