Siemens LOGO! Multi-Setpoint Dispensing with Analog MUX

David Krause11 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

Siemens LOGO! Multi-Setpoint Dispensing with Analog MUX and High-Speed Counter

Volumetric dispensing applications such as drink pourers, dosing skids, and small-batch fillers share a common control pattern: a single flow sensor must stop a solenoid after one of several preset volumes has been delivered. On a Siemens LOGO! 8 base module (6ED1052-1xxx08-0BA1 series), this pattern collapses to one High-Speed Counter block, one Analog Multiplexer (MUX) block, and one On-Delay for debounce — replacing the three separate timers commonly used in beginner code. This reference walks through the complete implementation, from flow-meter pulses per litre to LOGO! Web Server custom-quantity entry.

1. Application Overview

The reference application is a three-size beer pourer on a bar top. The bartender selects a size (0.25 cl, 0.50 cl, or 1.00 l) and a quantity (5, 10, 15 units, or any value entered through the LOGO! Web Server). The program commands a 24 V DC solenoid valve open, accumulates flow-sensor pulses on the high-speed counter, and de-energises the coil when the active setpoint is reached.

Function LOGO! Resource Signal Type
Flow sensor pulses Input I3 (high-speed) 24 V DC, PNP, 5 kHz max
Bartender start button Input I1 24 V DC, NO momentary
Size selector (0.25/0.50/1.00 l) Inputs I5, I6, I7 24 V DC, NO momentary
Quantity selector (5/10/15) Inputs I2, I8, I9 24 V DC, NO momentary
Custom quantity (Web Server) Network variable Integer 1–99
Solenoid valve Output Q1 24 V DC, 0.3 A continuous
Status indicator Output Q2 24 V DC LED, <0.1 A
Note: On LOGO! 8, inputs I3 and I4 are routed to the high-speed counter hardware; using any other input caps the count rate at the 4 Hz digital-filter ceiling. I1 is shown for clarity; only the high-speed input must be I3 or I4.

2. Prerequisites

  • Base module: LOGO! 8.3 — catalog 6ED1052-1MD08-0BA1 (24 V DC powered, 8 DI / 4 DQ, with display) or 6ED1052-2MD08-0BA1 (with Ethernet). The high-speed counter is available on all LOGO! 8 BM variants.
  • Software: LOGO! Soft Comfort V8.3 (6ED1058-0BA08-0YA1) for circuit-diagram programming and Web Server configuration.
  • Firmware: BM with FS ≥ 04 (for V2.0 Web Server, custom-quantity text boxes are supported on FS ≥ 04).
  • Flow sensor: PNP/NPN pulse output, ≥ 100 pulses per litre, 24 V DC. A gear-meter such as Gems Sensors FT-110 series or ifm efector SU7 typically delivers 1000–5000 pulses/litre.
  • Solenoid valve: 24 V DC, ≤ 0.5 A continuous, with surge suppression (free-wheel diode across coil).
  • Power supply: 24 V DC, ≥ 1.5 A derated, regulated.

3. Wiring Topology

LOGO! 8 BM (6ED1052-1MD08) I1 → Start PB I3 → Flow pulses I5 → Size 0.25 l I6 → Size 0.50 l I7 → Size 1.00 l I2 → Qty 5 I8 → Qty 10 I9 → Qty 15 Q1 → Solenoid Q2 → Status LED Flow sensor PNP, 24 V DC N pulses / litre Solenoid valve 24 V DC, ≤0.5 A + free-wheel diode

Wire the flow sensor's signal output to I3, with the common return to the LOGO! 24 V DC negative terminal. The solenoid is wired between +24 V and Q1; a 1N4007 fly-back diode (cathode to +24 V) is mandatory to protect the LOGO! output stage from inductive kick.

Safety: Mount the free-wheel diode directly across the solenoid coil terminals, not at the LOGO! terminal block, to minimise radiated EMI that can corrupt the high-speed count on long valve leads.

4. Pulse-to-Volume Calibration

The high-speed counter counts raw pulses; the On threshold on the counter must be expressed in pulses, not in litres. Define a Pulse Factor Pf = pulses per litre, measured by dispensing 1.0 l of beer into a graduated cylinder and noting the count.

For a target volume V in litres, the setpoint in pulses is:

Sp = round(V × Pf)

Nominal Size Volume (l) Setpoint @ 4500 pulses/l Setpoint @ 1000 pulses/l
Glass 0.0025 11 pulses 3 pulses
Half 0.0050 23 pulses 5 pulses
Mass (1 l) 1.0000 4500 pulses 1000 pulses
Resolution warning: At 1000 pulses/l the 0.25 cl pour resolves to 3 pulses — only ±33% accuracy per shot. Select a sensor with ≥ 4000 pulses/l when small shots (< 0.01 l) are required.

5. LOGO! Soft Comfort Program Structure

The complete program uses seven blocks. Open LOGO! Soft Comfort V8.3, choose a new circuit, then add the blocks below in the order shown.

Size Selector I5 / I6 / I7 Analog MUX B18 (4 inputs) Active Setpoint AQ (analog value) HSC Threshold On = S_p Quantity × Pulse U/D Counter B4 HSC B10 Input I3, count up Comparator Cmp CN ≥ On Reset Pulse RS flip-flop RS Latch Set = I1, Rst = Cmp Q1 Coil Solenoid driver Web Server — Network Variable NI1 (text field) → Integer parse → multiplier

5.1 High-Speed Counter Configuration (B10)

From the block library, drag Special → Counter → High-Speed Counter (B10 in V8.3). Configure as follows:

Parameter Value Notes
Input I3 Mandatory for HSC routing
Count direction Up Reset on Q1 falling edge
On threshold SP_active Linked to Analog MUX output (NI-tag)
Reset mode At counter reset Avoids residual count between pours
Frequency threshold 5000 Hz Triggers diagnostic flag if exceeded

5.2 Analog Multiplexer Configuration (B18)

The Analog MUX (B18) is the single block that lets one HSC threshold serve three size setpoints. Wire the four numeric constant inputs to the calibrated pulse values and the selector bits to the size inputs.

MUX Input Value (pulses @ 4500/l) Selector Source
EN0 / V0 11 I5 (0.25 cl)
EN1 / V1 23 I6 (0.50 cl)
EN2 / V2 4500 I7 (1.00 l)
EN3 / V3 0 (unused — disable input)
Sel S1, S2 From I5, I6 via encode See truth table below
I5 I6 I7 S1 S2 MUX Output (pulses)
1 0 0 0 0 11
0 1 0 0 1 23
0 0 1 1 0 4500
none active 1 1 0  (disabled)

S1 and S2 are derived from the input bits by an OR-AND pre-stage (or by the simpler trick of feeding the inputs directly and adding a small OR with the next-higher bit so a single size button drives the correct MUX address without combinatorial hazards).

5.3 Quantity Multiplier

The Up/Down Counter (B4) accumulates number of shots. A second small Analog MUX (B18 again) multiplies the per-shot setpoint by the requested quantity before it is passed to the HSC threshold. For pour quantity N, the scaled setpoint is:

SPtotal = SPone × N

For a 1 l mass (4500 pulses) poured 15 times the HSC must count to 67 500. The HSC B10 counter is a 32-bit counter on LOGO! 8, so this is within range. If the application requires > 2 million pulses, switch the integrator to a regular Up Counter and use a comparator to gate the HSC reset.

5.4 Solenoid Latch (RS Flip-Flop)

Use the RS Latch (B3) so the button press arms the cycle:

  • S (set): I1 (start button) rising edge
  • R (reset): Output of the comparator (HSC.CN ≥ SP_total)
  • Q: drives Q1 (solenoid) and Q2 (status LED) in parallel

The HSC is also reset on the same comparator rising edge through an Edge-Triggered Reset (B11), preparing the system for the next shot.

6. LOGO! Web Server — Custom Quantity Entry

Enable the Web Server in Tools → Web Server in LOGO! Soft Comfort. The default 0BA8 BM has the V1.0 Web Server; the 8.3 (FS04) BM ships the V2.0 Web Server with the Web Editor for desktop browsers.

  1. Open Tools → Web Editor, drag a Text field onto the operator page.
  2. Bind the field to a network input, e.g. NI1, with integer type and range 1–99.
  3. Link NI1 in the LOGO! program to a numeric constant block whose output drives the second Analog MUX's N input.
  4. Add two further text fields bound to AQ1 (active setpoint in pulses) and AM2 (real-time HSC count) for operator feedback.
  5. Compile and download. Browse to http://<LOGO-IP> and authenticate with the user name LOGO and the password configured under Tools → Web Server → Access Control.
Security: The default Web Server password is blank; set a strong password under Web Server → Access Control before exposing the device to a public bar network. Restrict access with the LOGO!'s IP-filter table when available.

7. Step-by-Step Commissioning Procedure

  1. Verify I/O. In LOGO! Soft Comfort's online mode, force Q1 and confirm the solenoid click and the flow-sensor pulse stream on I3 (use a scope on a digital input, or the Watch Table with HSC.CN incrementing).
  2. Calibrate the flow sensor. Manually latch Q1 for 30 seconds, capture CN at the end, and divide by the dispensed litre count to compute Pf. Replace the constants in the MUX with the measured values.
  3. Single-shot check. Press I1 with the 0.25 cl size selected (I5). The solenoid should de-energise within 1  pulse of the calibrated setpoint. Repeat 20 times; record the poured volume; verify < ±2% deviation.
  4. Multi-shot check. Repeat with quantity = 15 (I8) on the 1 l size. Confirm the HSC threshold now reads 67 500 and the system delivers 15 discrete shots.
  5. Web Server check. Connect to the LOGO! IP, enter a custom quantity of 7, and verify NI1 in the online watch table. Re-run a single 1 l pour with N=7; total pulses should be 7 × 4500 = 31 500.
  6. Edge cases:
    • Pressing I1 while no size is selected should be ignored (MUX output = 0, comparator never trips → safety lockout).
    • Loss of I3 pulses (sensor unplugged) should be detected by a 5 s watchdog that de-energises Q1 and triggers Q3 (fault output).

8. Verification Matrix

Check Pass Criterion Method
Solenoid energises on I1 Q1 = 1 within 20 ms Oscilloscope on Q1 vs. I1
HSC counts every pulse HSC.CN increments on each I3 edge Online watch table, encoder simulation
Comparator trips at setpoint RS Latch resets at CN = SPtotal ±0 Watch table, capture flag
Volume accuracy ±2% over 20 shots Graduated cylinder, 0.5% class
No-size lockout Q1 stays 0 when all size inputs off Force, then read Q1
Web Server quantity NI1 = entered value Web browser, online watch table

9. Troubleshooting Matrix

Symptom Likely Root Cause Fix
Solenoid never opens RS Latch set input mis-wired to NC; or I1 wiring fault Verify I1 active-high; re-check RS Latch block
Solenoid never closes Comparator threshold = 0; HSC reset never fires Watch CN; confirm MUX output tracks size selector
Pour short by ~5–10% Sensor drift or aerated liquid (beer foam counts) Re-calibrate; install a de-bubbling chamber upstream of the meter
Pour long by 1 shot in 15 Quantity multiplier MUX address off-by-one Verify S1, S2 truth table; add a one-shot on size change
Counter overflows HSC setpoint > 231–1 (rare, only with extreme N × SP) Clamp N to 99; for larger totals, use Up Counter + comparator
Counts lost at high flow I3 input saturated or contact bounce Confirm sensor ≤ 5 kHz; add 100 nF filter on I3
Web Server text field blank FS < 04, or browser cached old page Upgrade firmware; clear cache

10. Extending the Reference

The same Analog MUX pattern scales linearly. For four sizes, promote the MUX to an 8-input variant (B17 analog multiplexer) and reserve a fourth selector bit. For temperature-compensated dispensing (cold beer is denser → more pulses per litre), feed the MUX selector a Gain block whose input is a PT100 or thermistor analogue input; the setpoint Sp is then multiplied by the calibrated density factor in real time.

For wash-down environments, replace the LOGO! BM with a SIP65 variant (6ED1052-1MD08-0BA1 with conformal coating) or relocate the LOGO! to a control panel and bring only the inputs/outputs out to IP65 push-buttons.

11. Notes on Standards and Sizing

The 24 V DC solenoid sizing assumes a steady-state current below the LOGO! 8 DQ rating of 0.3 A continuous (transistor outputs) or 5 A (relay outputs on -1HF08 variants). For inductive loads, confirm the suppression diode reverse-voltage rating is ≥ 2 × supply, and the surge current rating is ≥ 1 A. Always verify the applicable beverage-dispensing local code (e.g. NSF/ANSI 18 for manual food and beverage dispensing equipment, IEC 60204-1 for general machinery safety) and provide an Emergency-Stop hardwired circuit independent of the LOGO!.

E-Stop reminder: A hardwired E-Stop that removes 24 V from the solenoid rail must be installed upstream of the LOGO! Q1 terminal. The LOGO! firmware is not safety-rated and must not be the sole means of hazard reduction for any operator-accessible actuator.

12. Reference Resources

The official Siemens LOGO! system manual documents every block, every threshold parameter, and every Web Server field used above. For commissioning support, the Siemens Industry Online Support portal hosts the LOGO! application examples library and the LOGO! Web Server kit.

Can a single Siemens LOGO! 8 HSC serve multiple volume setpoints?

Yes. Route the three (or more) size selectors into an Analog Multiplexer (B18) whose output is wired to the High-Speed Counter's On threshold. The HSC only sees one threshold at a time, so it counts to whichever size the MUX is pointing at, and a single RS Latch controls the solenoid.

What is the maximum pulse rate of the LOGO! 8 high-speed counter?

5 kHz on inputs I3 and I4 with the LOGO! 8 BM (6ED1052-1xx08-0BA1). Higher-rate sensors must be divided externally; for most beverage flow meters (≤ 2 kHz) the LOGO! HSC is sufficient without prescaling.

How do I read a custom pour quantity from the LOGO! Web Server?

Open Tools → Web Editor in LOGO! Soft Comfort V8.3, drop a Text Field control on the operator page, and bind it to a network input (NI1) of integer type. In the FBD program, link NI1 to the multiplier that scales the per-shot setpoint; the scaled total is fed to the HSC On threshold.

Why is my 0.25 cl pour inaccurate at low pulse factors?

A 0.25 cl shot on a sensor that delivers 1000 pulses/l resolves to only 3 pulses, so a single missed pulse is a 33% error. Use a sensor with ≥ 4000 pulses/l, or accept the ±5% accuracy that is normal for a 0.25 cl shot on a 1000 pulses/l meter after calibration.

Do I need a fly-back diode on the LOGO! transistor output?

Yes. Always wire a 1N4007 (or equivalent ≥ 1 A, ≥ 2 × supply) directly across a 24 V DC solenoid coil. Without it, the inductive kick at switch-off destroys the LOGO! DQ transistor in a few thousand cycles and may corrupt counts on the adjacent I3 input.

Back to blog