Programming Siemens LOGO! 8 for Min/Max Sensor-Motor Mapping

David Krause13 min read
PLC HardwareSiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

1. Problem Definition

A Siemens LOGO! 8.3 base module (order number 6ED1052-1MD08-0BA2) programmed with LOGO! Soft Comfort V8.4 must arbitrate between ten 24 V proximity-sensor inputs (I1–I10) and ten relay-driven motor outputs (Q1–Q10) under two hard constraints: (a) at least six motors must remain energised at all times regardless of input state, and (b) no more than eight motors may ever run simultaneously even if all ten sensors are active.

The naive 1:1 mapping (I1→Q1, I2→Q2, …) violates both constraints. When fewer than six sensors are active, fewer than six motors would run, breaking the minimum guarantee. When more than eight sensors are active, all ten motors would energise, breaking the maximum cap. The control program must therefore arbitrate between sensor-driven requests and the fixed Min/Max output band using hysteresis, latching, and a priority chain.

1.1 Formal Requirements

  • Sensor-to-motor mapping: each active sensor I_n requests its corresponding motor Q_n.
  • Minimum-of-six rule: when fewer than six sensors are active, fill the gap by switching on the lowest-indexed motors Q1, Q2, … Q6 until six outputs run.
  • Maximum-of-eight rule: when more than eight sensors are active, ignore the excess (9th and 10th priority) so only eight motors run.
  • Priority when Min-filling collides with sensor mapping: fixed ascending order (Q1, Q2, … Q10).
  • Hysteresis: changing Min/Max constants during Run requires a program stop, recompile, and transfer. Live parameter editing is not supported in firmware V1.81.x.

2. Hardware Prerequisites and I/O Mapping

The base module 6ED1052-1MD08-0BA2 provides only eight digital inputs and four relay outputs. Reaching 10 DI / 10 DO requires digital expansion. Refer to the official LOGO! 8 System Manual (entry ID 109751049) for module compatibility and pin-out.

Slot Module Order Number DI DO Notes
0 (Base) LOGO! 8.3 BM 230R 6ED1052-1MD08-0BA2 8 4 (relay 10 A) I1–I8 / Q1–Q4 internal
1 DM16 24R 6ED1055-1NB10-0BA2 8 8 (relay 5 A) Carry I1–I8 / provide I9, I10, Q5–Q10
Alternative: DM8 24 6ED1055-1MB00-0BA2 4 Adds only Q9, Q10 if sensors stay on base

The program logic below uses symbolic tags I1..I10 and Q1..Q10, so it is hardware-independent. Either DM16 24R or DM8 24 + DM8 DI expansion satisfies the I/O count.

Important: The base module relay outputs are rated 10 A resistive / 3 A inductive (AC-15) per the System Manual. Drive motor contactor coils through an interposing relay (e.g. Siemens 3RT2015) sized for the contactor inrush. Never switch motor windings directly through LOGO! relay contacts unless the steady-state and inrush currents are confirmed within the 10 A / 3 A limits.

2.1 Software Stack

  • LOGO! Soft Comfort V8.4 (released 2018, compatible with LOGO! 8.0 / 8.1 / 8.2 / 8.3 firmware).
  • Base-module firmware ≥ V1.81.01. Verify via LOGO! Soft Comfort → Tools → Transfer → Device Information.
  • Ethernet connection (the LOGO! 8.3 base integrates a 10/100 Mbit RJ45 port on the bottom face) for fast program download.

3. Logic Specification Table

Let Σ be the count of active sensor bits and M = {n | I_n = 1} the active sensor mask. The active output mask A must satisfy:

  • min(|A|, 10) = 6 (lower clamp)
  • max(|A|, 0) = 8 (upper clamp)
  • A ⊇ {n ∈ M | n ≤ 8} when |M| ≥ 8 (priority to lower indices)
  • A = {1,2,3,4,5,6} ∪ {n ∈ M | n ≤ 8} when |M| ≤ 6 (fill from the bottom)
|M| Required output mask A Behaviour
0 {1,2,3,4,5,6} Six minimum motors held on
1 {1} ∪ {2,3,4,5,6} I1 plus 5 fill motors
3 (I2, I5, I8) {1,2,3,4,5,6} I2, I5, I8 do not light extras because Min cap already met
6 {1,2,3,4,5,6} All six sensors map 1:1
7 {1,2,3,4,5,6,7} Sensor wins up to 7
8 {1,2,3,4,5,6,7,8} Sensor wins up to 8
9 {1,2,3,4,5,6,7,8} 9th and 10th sensor ignored
10 {1,2,3,4,5,6,7,8} 9th and 10th sensor ignored

4. Algorithm: Min/Max Output Selection Strategy

Two implementation strategies are viable. The first uses digital counters and latches; the second uses analog multiplexers and threshold switches. The cleanest LOGO! implementation combines a hysteresis counter with SR latches.

4.1 Counter + Latch Method (recommended)

  1. Sum all ten sensor bits with a 10-input OR chain into a counter that tracks the number of active sensors Σ.
  2. Configure the counter with On threshold = 8 and Off threshold = 5. This hysteresis band (8 down to 5) prevents output chatter near the boundary.
  3. Gate every sensor I_n through an AND whose second input is the inverse of (Σ ≥ 8). This enforces the Max cap.
  4. Feed each gated sensor into the Set input of an SR flip-flop that drives Q_n.
  5. Wire the Reset input of each SR to NOT(I_n) so the latch drops when the sensor falls.
  6. Build a separate Min-fill chain: six OR-gates tied to a permanent High source (M-flag) and routed through an analog threshold A1 set to On=6. When fewer than six sensors are active, the fill chain forces Q1..Q6 on via OR with the SR outputs.
  7. Retentive flag on each SR must be cleared so that a sensor drop turns the output off; only the Min-fill logic re-energises Q1..Q6 when needed.

4.2 Analog-Muxer Method (alternative)

The Ella_68 method posted in the field report uses ten multiplexer blocks so each input I_n produces an analog constant V_n = n. A counter sums the active values, and a parallel chain adds Max (10) to the sum so that a second threshold-switch bank sees values in the range 11..20. Each output Q_n latches when either V_n (in 1..10) or V_n + 10 (in 11..20) is high. Reset all latches when the total sum equals zero so the Min-fill chain re-asserts. This method is compact but does not naturally extend to multi-sensor active states; for clarity and field maintainability, use the counter + latch method.

5. FBD Implementation in LOGO! Soft Comfort V8.4

5.1 Block List and Resource Budget

FBD Block Count Purpose
Digital input I1..I10 10 Sensor inputs
Digital output Q1..Q10 10 Motor contactors
Up/Down counter B003 1 Counts active sensors Σ
Analog threshold trigger B007 2 Min (≥6) and Max (≥8) comparisons
SR flip-flop B004 10 Latch each Q_n
AND gate B001 10 Maximum gate per sensor
OR gate B002 12 Aggregation and Min-fill
NOT gate B008 10 Sensor-fall reset
Special marker (M-flag) 1 Permanent High source

The total of approximately 56 function blocks plus 20 I/O points fits comfortably inside the LOGO! 8.3 BM resource budget of 400 blocks / 200 KB program memory.

5.2 Step-by-Step Wiring

  1. Open LOGO! Soft Comfort V8.4. File → New → select target "LOGO! 8.3 (6ED1052-1MD08-0BA2)".
  2. Drag ten digital inputs (I1..I10) and ten digital outputs (Q1..Q10) onto the FBD canvas. Map I1..I10 to the BM/DM terminal labels.
  3. Drop an Up/Down counter (B003). Wire its Cnt input to the OR of all ten sensor lines using cascaded B002 blocks. Wire Dir to a permanent-High M-flag so the counter only counts up.
  4. Open B003 properties: On threshold = 8, Off threshold = 5. This gives the 8/5 hysteresis band.
  5. Wire B003 output Q (pin 3) through a NOT gate to create "NOT(Σ≥8)". Feed this into one input of each of ten AND gates (B001).
  6. Wire the second input of AND gate n to sensor I_n. The AND output is "I_n AND NOT(Σ≥8)", the maximum-gated request.
  7. For each pair, drop an SR flip-flop (B004). Set input = AND output n. Reset input = NOT(I_n). Output Q drives relay Q_n.
  8. Build the Min-fill chain: drop six OR gates (B002) with both inputs tied to a permanent M-flag High. Route these six OR outputs to an additional six OR gates whose second inputs are Q1..Q6 from the SR outputs. This makes Q1..Q6 = (sensor request) OR (Min-fill).
  9. Add an analog threshold trigger B007 set to On = 6. Wire the counter value (B003 pin 4) to its input. The output enables the Min-fill OR chain only when Σ < 6.
  10. Add a second B007 set to On = 8, Off = 5. Its output drives the NOT gate in step 5 to implement hysteresis.
  11. Compile with F5. The status bar must show "Program fits into LOGO! 8.3 BM".

5.3 FBD Topology Schematic

  I1  I2  I3  I4  I5  I6  I7  I8  I9  I10
   \   |   |   |   |   |   |   |   |   /
    \  |   |   |   |   |   |   |   |  /
     \ |   |   |   |   |   |   |   | /
      \|   |   |   |   |   |   |   |/
       OR  OR  OR  OR  OR  OR  OR  OR  OR
        \   |   |   |   |   |   |   |   /
         \  |   |   |   |   |   |   |  /
          \─┴───┴───┴───┴───┴───┴───┴─┘
                       │
                       ▼
                Up/Down B003 (On=8, Off=5)
                       │
            ┌──────────┴──────────┐
            ▼                     ▼
   Threshold A1 (≥6)      Threshold A2 (≥8)
   Min-fill enable        Max gate
            │                     │
            ▼                     ▼
    OR chain into Q1..Q6   NOT → AND with I1..I10
                                  │
                                  ▼
                            SR B004 × 10
                                  │
                                  ▼
                                Q1..Q10

6. Ladder Logic Implementation Notes

LOGO! Soft Comfort V8.4 supports ladder diagram (LAD) since V8.0. The mapping is direct but more verbose because there is no equivalent to the analog threshold trigger in LAD. Each rung represents one motor output.

       I1          Cnt<8          Q1
 ───┤  ├──────────┤/├────────(SET)─┤
                                       │
       NOT I1                          │
 ───┤/├─────────────────────────(RST)─┘

For each rung n = 1..10:

  • Contact A: I_n (sensor request).
  • Contact B: NOT(Cnt≥8) realised by a marker flag M_n set by the threshold A2.
  • Coil: SR SET for Q_n.
  • Reset branch: NOT(I_n) wired in parallel to drive the SR RESET.

Network 11 implements the minimum fill: six parallel rungs each gated by M-flag High and the analog-threshold A1 enable bit. The rung output is OR-ed with the corresponding SR output through a marker flag that drives Q_n.

LAD pitfall: LOGO! LAD does not support nested subroutines like a Siemens S7-1200. All hysteresis logic must be in-line. Use marker flags M1..M8 to store intermediate states between rungs.

7. Simulation and Commissioning

  1. Press F3 (Simulation) in LOGO! Soft Comfort. The simulator renders I1..I10 as clickable buttons and Q1..Q10 as LED indicators.
  2. Click the patterns defined in Section 3 and verify the output mask matches the truth table exactly.
  3. Test the 9-sensor and 10-sensor case: outputs must cap at eight and the 9th/10th outputs must not energise.
  4. Test the sensor-loss case: turn off I1 while Q1 is on because of sensor activity. Q1 must drop out within one scan cycle.
  5. Test the minimum-fill case: turn off all inputs. Outputs Q1..Q6 must remain on, Q7..Q10 off.
  6. Confirm hysteresis: with eight sensors active, drop one sensor (Σ=7). Outputs must hold at 8 because Off threshold is 5. Drop to four sensors (Σ=4) and outputs must collapse to the Min-fill of six.
  7. Transfer to the physical module via Ethernet (Tools → Transfer → PC → LOGO!).
  8. On the LOGO! display, navigate to Start and confirm Run is highlighted. Cycle power once to ensure clean initialisation of all SR flip-flops.

7.1 Verification Checklist

Test Active sensors |M| Expected A Pass criterion
All off 0 {1..6} Q1–Q6 on, Q7–Q10 off
Sparse pattern 3 (I2, I5, I8) {1..6} Q1..Q6 on, I2/I5/I8 do not light extra
Seven sensors 7 (I1..I7) {1..7} Q1..Q7 on
All sensors 10 {1..8} Q1..Q8 on, Q9/Q10 off
Hysteresis boundary 8 → 7 {1..8} Hold at 8 outputs when dropping to 7

8. Edge Cases and Field-Proven Caveats

8.1 Sensor Bounce and Debouncing

Proximity sensors feeding 24 V into LOGO! digital inputs must be debounced. LOGO! 8.3 firmware supports an input-filter parameter (Tools → Parameter VM Mapping → Input filter). Default is 0.5 ms; for noisy industrial environments set 3 ms minimum. Refer to the LOGO! System Manual (entry ID 109751049), section "Input filter".

8.2 Run-Time Editing of Min/Max Constants

The discussion thread notes that changing Min/Max during Run requires a circuit "reset". In practice this means: stop the program via the LOGO! display (Stop), edit the threshold constants in LOGO! Soft Comfort, recompile, transfer, then re-start. The hysteresis in B003 (On=8 / Off=5) prevents hunting near the boundary but does not survive a live parameter change.

8.3 Power-Fail Restart Behaviour

LOGO! retains all digital outputs in their last state across short power dips if the retentivity flag is set on each SR block. Enable "Retentive" on the ten SR flip-flops only when brown-out recovery is required. Otherwise the relays drop out and the Min-fill logic re-asserts Q1..Q6 on power-up, which is the desired safe default for this application.

8.4 Expansion Module Hot-Swap

Never hot-plug DM8 / DM16 modules on a powered LOGO! base. The expansion bus is not designed for live insertion and the module may latch in an undefined state, requiring a power cycle. Always de-energise the system before adding or removing expansion I/O.

8.5 Relay Wear from Contactor Inrush

If Q1..Q10 drive contactor coils directly, inrush can reach 6–10× holding current for the first 50 ms. The LOGO! relay contact-life curve in the System Manual shows that 10 A relay switching 24 VDC inductive loads drops to roughly 30,000 operations at full inrush. Insert an interposing 24 VDC relay sized for the contactor and drive the contactor coil from the interposing relay, not the LOGO! output.

8.6 Analog Range Overflow in the Muxer Method

If you scale the analog-muxer alternative to more than 50 outputs, the (V_n + Max) sum can approach the LOGO! 16-bit signed analog limit of ±32767. The counter + latch method scales without bound because it stays in digital domain.

9. Troubleshooting Matrix

Symptom Likely Cause Diagnostic Fix
Q1..Q6 do not stay on with no inputs Min-fill chain not wired or threshold A1 missing Monitor I/O Status on LOGO! display Verify A1 (On=6) feeds the Min-fill OR gates into Q1..Q6
9th and 10th sensors still light Q9/Q10 Maximum gate threshold not wired into AND chain Check B003 On threshold = 8 and the AND inputs Add AND(I_n, NOT(Cnt≥8)) before SR SET
Sensor 5 lights motor 5 even when sensors 1–4 are off 1:1 mapping without Min-fill priority Confirm priority chain on Q1..Q6 Add Min-fill OR chain feeding Q1..Q6 SET
Outputs chatter when 7 or 8 sensors active Hysteresis too tight or missing Counter toggles between On/Off thresholds Set Off threshold = 5, On threshold = 8 (bandwidth 3)
LOGO! goes to STOP during transfer Program exceeds memory or block count Check F4 → Properties → Resources Use DM16 expansion or split logic across two LOGO!s networked via Ethernet
Inputs read false on the LOGO! display Sensor sinking vs sourcing mismatch Measure voltage at I_n terminal with a DMM LOGO! 8.3 MD variants source 24 V; verify PNP sensor wiring
Reset of SR blocks not occurring Missing reset coil on SR block Inspect SR block properties in FBD Wire NOT(I_n) to the R input
Q_n stays latched after I_n goes low Retentivity set unintentionally Right-click SR → Properties → Retentive Uncheck Retentive unless brown-out recovery is required
Outputs do not match truth table in simulation Min/Max constant polarity inverted Hover over A1 / A2 blocks to read threshold Set A1 On=6 / Off=0; set A2 On=8 / Off=5

10. Frequently Asked Questions

What is the maximum number of digital I/O the LOGO! 8.3 base module supports natively?

The 6ED1052-1MD08-0BA2 base provides 8 digital inputs and 4 relay outputs. To reach 10 DI / 10 DO you must add a DM16 24R (6ED1055-1NB10-0BA2) for 8 DI + 8 DO, or a DM8 24 (6ED1055-1MB00-0BA2) for the missing 6 DO. Refer to the LOGO! 8 System Manual entry ID 109751049 for the full expansion table.

Can the Min and Max output values be changed online without re-programming?

No. The two analog threshold triggers (B007) holding the Min and Max constants are compiled into the program. To change them you must stop the LOGO!, edit the constants in LOGO! Soft Comfort, recompile, and transfer. Live parameter editing of Min/Max is not supported in firmware V1.81.x.

Does the LOGO! 8.3 use sinking or sourcing inputs?

The 6ED1052-1MD08-0BA2 is the 230 V supply variant with 24 V digital inputs that source current (PNP). For NPN sensors use the 24 V variant 6ED1052-1MD00-0BA2 or add a DM8 24 module. Verify sensor polarity against the wiring diagram in the System Manual before commissioning.

What happens if all 10 sensors fail open?

With the program described above, the Min-fill logic drives Q1..Q6 on and leaves Q7..Q10 off. This is the safe default: six motors run continuously rather than zero, preventing downstream process starvation. If you need fail-safe (all off when sensors fault), invert the Min-fill logic and tie the Min threshold to a sensor-health bit.

Can I implement this control in ladder diagram instead of FBD?

Yes. LOGO! Soft Comfort V8.4 supports ladder (LAD) since V8.0. The mapping is one rung per output with the SR latch implemented as a parallel branch. The FBD version is more compact for this application because of the analog threshold and counter blocks, but LAD is functionally equivalent.

Back to blog