Scaling Siemens LOGO! High-Speed Counter Frequency to GPM
The Siemens LOGO! logic module integrates high-speed counter inputs capable of measuring pulse trains from flow meters, encoders, and proximity sensors at rates up to 5 kHz on inputs I3 through I6. Converting the raw pulse frequency into engineering units such as gallons per minute (GPM) for display on the LOGO! onboard HMI or LOGO! TD text display requires additional scaling logic beyond what the built-in Threshold Trigger function provides. This reference documents three field-proven techniques for converting a high-speed input frequency into a scaled flow value, derives the analog gain formula used in the custom implementation, contrasts the LOGO! approach with native engineering-unit scaling available on AutomationDirect BRX Do-More and CLICK PLC platforms, and concludes with a commissioning and troubleshooting matrix.
Overview of the Scaling Problem
The default LOGO! Threshold Trigger (Special Functions > Counter > Threshold Trigger) counts incoming pulses on a selected high-speed input (I5 or I6 on LOGO! 8 base modules) over a programmable gate time G_T and produces a frequency value that can be displayed on a Message Text block. The function does not natively translate the frequency into engineering units, and its output cannot be referenced as an analog input by other LOGO! blocks. The scaling problem arises whenever the application requires one or more of the following:
- The translation factor m (GPM per Hz) is less than 0.05 s, forcing an invalid gate time on the standard block.
- The scaled flow value must feed downstream logic such as a PID controller, threshold comparator, or additional arithmetic block.
- The display requires a configurable number of decimal places beyond what the standard threshold trigger exposes.
- Multiple high-speed flow channels must be measured synchronously against a common time base.
The three solutions below address each case with increasing capability, ranging from display-only up to full engineering-unit analog output usable across the LOGO! program.
Prerequisites
| Item | Specification |
|---|---|
| LOGO! hardware | LOGO! 8 base module (6ED1052-1MD08-0BA2 or later), LOGO! 8.3 (6ED1052-xxx08-0BA3), or LOGO! 8.4 (6ED1052-xxx08-0BA4) |
| Firmware | LOGO! Soft Comfort V8.4 or later; LOGO! BM firmware FS:04 recommended for enhanced HSC filtering |
| High-speed input | I3, I4, I5, or I6 (LOGO! 8 supports up to 5 kHz on these inputs; I1/I2 are limited to 100 Hz) |
| Sensor | Flow meter producing 0–N Hz proportional to 0–M GPM, with N ≤ 5 kHz for direct input to LOGO! |
| Sensor supply | 24 V DC sourced from LOGO! sensor power (verify cumulative HSC current does not exceed LOGO! supply rating, typically 300 mA continuous) |
| Programming software | LOGO! Soft Comfort V8.4 or later (free download from Siemens Industry Online Support) |
| Wiring | Shielded twisted-pair cable for HSC signal runs; shield grounded at LOGO! end only |
Reference documentation: LOGO! 8 System Manual (Siemens Industry Online Support, article ID 109741465).
Frequency-to-Flow Scaling Math
The conversion between pulse frequency and flow rate is a linear relationship of the form:
Q (GPM) = f (Hz) × m
Where Q is the flow rate in gallons per minute, f is the measured pulse frequency in Hz, and m is the translation factor (GPM per Hz) derived from the flow meter calibration certificate.
For the example calibration provided in the field case:
- 0 Hz → 0 GPM
- 1 kHz → 20 GPM (interpreting the original posting "1lhz=20 gpm" as a typographical shorthand for "1 kHz = 20 GPM" consistent with the linear trend to 2 kHz = 40 GPM)
- 2 kHz → 40 GPM
This gives a translation factor:
m = 20 GPM / 1000 Hz = 0.02 GPM/Hz
The Threshold Trigger function counts pulses over a gate time G_T (in seconds) and reports:
f_out (Hz) = pulse_count / G_T
To produce a reading directly in GPM from the trigger output, set G_T equal to the translation factor m. However, the LOGO! 8 System Manual specifies that G_T must be ≥ 0.05 s for the standard Threshold Trigger block. Since m = 0.02 s < 0.05 s in this example, the standard block cannot be used directly. Solutions 2 and 3 below address this constraint.
Solution 1: Built-In Threshold Trigger with Gate Time Scaling
The simplest approach uses the standard LOGO! Threshold Trigger with the gate time set to the translation factor m. This is only viable when m ≥ 0.05 s.
Configuration Steps
- Insert a Threshold Trigger block (Special Functions > Counter > Threshold Trigger) in LOGO! Soft Comfort.
- Connect input I5 (or I6) to the trigger's trigger input terminal.
- Set parameter G_T to the translation factor m (in seconds). For m ≥ 0.05 s, this scales the displayed value directly to GPM.
- Place a Message Text block and connect the trigger's "out" output to the value input of the message.
- In Message Text properties, configure bar graph HI/LO limits matching the sensor's range (e.g., HI = 100 GPM, LO = 0 GPM).
Limitations
- G_T minimum = 0.05 s per the LOGO! 8 System Manual, chapter on counter functions.
- Trigger output cannot be referenced as an analog input by other LOGO! blocks; it can only drive the Message Text display.
- No direct support for arbitrary decimal-place scaling; the value displays as an integer Hz-derived count.
- At short gate times near the 0.05 s floor, display jitter becomes pronounced on pulsating flows.
Solution 2: Frequency Divider Plus Threshold Trigger
To overcome the G_T minimum, a digital pre-divider reduces the input frequency before the Threshold Trigger. The effective frequency at the trigger becomes f_input / n, allowing G_T to be chosen within the legal range while still producing a scaled output.
Block Sequence
- Up/Down Counter (Special Functions > Counter) with parameter ON = n.
- Digital Flag block that toggles on each overflow of the counter.
- Threshold Trigger fed by the digital flag output.
Wire the digital flag output to the counter's clear input so the counter resets every n input pulses. The threshold trigger then sees a frequency of f_input / n.
Parameter Selection Example
For m = 0.02 GPM/Hz and a chosen pre-divider ratio n = 10:
G_T_effective = n / m = 10 / 0.02 = 500 s (impractical)
A more practical selection keeps G_T reasonable while still satisfying the ≥ 0.05 s minimum. The displayed value must then be divided by n in the Message Text configuration to recover the true GPM reading:
- n = 10, G_T = 0.2 s → effective m at the trigger output = n / G_T = 50; divide the displayed count by 10 to recover GPM.
- n = 4, G_T = 0.2 s → effective m = 20; divide displayed count by 4.
Limitations
- Trigger output still cannot be referenced as an analog input by other LOGO! blocks.
- Display requires a manual integer division by n to recover engineering units, which must be configured in the Message Text scaling tab.
- Counter overflow handling must be considered for high-frequency inputs — at 5 kHz with n = 10, the counter reaches ON every 2 ms.
Solution 3: Modified Threshold Trigger (Counter + Impulse Generator + Analog Mux)
This approach replaces the built-in threshold trigger with discrete LOGO! blocks that produce a usable analog value referencing physical units. The result can feed downstream logic (PID, comparators, additional math) and supports configurable decimal-place scaling. This is the recommended solution for any application where the scaled GPM value must drive control logic or display with sub-integer resolution.
Block List and Parameters
| Block ID | Block Type | Function | Key Parameters |
|---|---|---|---|
| B110 | Impulse Generator | Defines the gate window (TH + TL = gate time; TL = 0.01 s fixed) | TH = (G_T − 0.01) s |
| B113 | Up Counter | Counts incoming HSC pulses during each gate window | ON = free-running; reset on impulse generator edge |
| B007 | Analog Multiplexer | Latches the previous count value while the next measurement is in progress | EN = impulse generator output |
| B003 | Analog Amplifier | Unity-gain buffer for the latched count value | GAIN = 1, OFFSET = 0 |
| B008 | Analog Amplifier | Scales the buffered count into engineering units (GPM) | GAIN = (10k × m) / (TH + TL), OFFSET = 0 |
Where k is the number of decimal places chosen for the Message Text display, m is the GPM/Hz translation factor, and TH + TL is the total gate time in seconds.
Derivation of the Final Analog Amplifier Gain
During each gate period T_G = TH + TL, the counter accumulates:
N = f_input × T_G
The analog amplifier B008 multiplies this count by the configured GAIN:
Ax (B008) = N × GAIN = (f_input × T_G) × (10k × m / T_G) = f_input × m × 10k
When the Message Text displays Ax with k decimal places, the LOGO! divides the shown value by 10k:
displayed_value (GPM) = f_input × m
This produces a continuously updated, engineering-unit value at the B008 output that can be referenced by any other LOGO! block.
Worked Numerical Example
For the example calibration m = 0.02 GPM/Hz, k = 1 decimal place, and G_T = 1 s:
- TH = G_T − 0.01 = 0.99 s
- TL = 0.01 s
- GAIN(B008) = (101 × 0.02) / 1.0 = 0.2
- OFFSET(B008) = 0
At f_input = 2 kHz, the counter accumulates N = 2000 pulses over the 1 s gate. The analog amplifier B008 produces Ax = 2000 × 0.2 = 400. The Message Text with k = 1 decimal place displays 40.0 GPM.
Connection Diagram
Synergetic Benefits Over the Built-In Threshold Trigger
- The final Ax value at the B008 output can be referenced by any other LOGO! block (PID controller, threshold comparator, additional math, analog output, etc.).
- The displayed value supports any number of decimal places via the k exponent in the GAIN formula and matching Message Text configuration.
- Multiple modified threshold triggers can be synchronized using a common Run/Stop impulse generator, useful for averaged flow measurement over multiple sensors or for differential flow (inlet minus outlet) leak detection.
- The counter approach supports long-term averaging via a sliding-window counter bank (eight counters rotating to a memory counter), improving stability for slow-varying flow rates with pump pulsation.
- The architecture is firmware-agnostic across LOGO! 8.x generations, provided the Impulse Generator and Analog blocks remain in the function library.
Step-by-Step Programming Procedure (Solution 3)
- Open LOGO! Soft Comfort and create a new circuit diagram.
- From the Special Functions palette, place: one Impulse Generator (B110), one Up Counter (B113), one Analog Multiplexer (B007), one Analog Amplifier (B003), one Analog Amplifier (B008).
- Wire input I5 (or I6) to the count input of B113.
- Wire the Impulse Generator output (B110) to the reset input of B113 and to the enable (EN) input of B007. Set TH = (G_T − 0.01) s, TL = 0.01 s. With G_T = 1 s, set TH = 0.99 s.
- Wire the count value output of B113 to input A of the Analog Multiplexer B007.
- Wire the multiplexer output to Analog Amplifier B003 with GAIN = 1 and OFFSET = 0.
- Wire the B003 output to Analog Amplifier B008 with GAIN = (10k × m) / (TH + TL) and OFFSET = 0. For m = 0.02, k = 1, G_T = 1 s: GAIN = 0.2.
- Place a Message Text block and connect the B008 output to the value input. Set the Message Text to display with k = 1 decimal place.
- In LOGO! Soft Comfort, choose Simulation > Run to verify the math against a pulse generator test source.
- Download the program to the LOGO! base module via Ethernet or SD card.
Display Configuration
In Message Text properties:
- Set the value source to the B008 analog output.
- Set the number of decimal places to match k (here k = 1).
- Enable bar graph with HI = maximum expected GPM and LO = 0 GPM.
- Enable the acknowledge key if the message should require operator dismissal on out-of-range conditions.
- Set message priority (low, medium, high) to control whether the message appears during scrolling or interrupts other displays.
Verification
| Test Input | Expected Count (G_T = 1 s) | Expected B008 Ax | Expected Display (1 decimal) |
|---|---|---|---|
| 0 Hz | 0 | 0 | 0.0 GPM |
| 500 Hz | 500 | 100 | 10.0 GPM |
| 1 kHz | 1000 | 200 | 20.0 GPM |
| 2 kHz | 2000 | 400 | 40.0 GPM |
| 5 kHz (max HSC) | 5000 | 1000 | 100.0 GPM |
Verify in LOGO! Soft Comfort simulation mode before deploying to hardware. Right-click the diagram and select "Simulate" to step through each input frequency scenario. Confirm that downstream comparators and the Message Text display agree on the same value to within the displayed decimal precision.
Comparison with Other PLC Platforms
| Feature | Siemens LOGO! 8 | AutomationDirect BRX Do-More | AutomationDirect CLICK |
|---|---|---|---|
| HSC max frequency | 5 kHz (I3–I6) | Up to 1 MHz (model dependent) | Up to 100 kHz |
| Built-in frequency-to-engineering-units scaling | No (custom blocks required) | Yes (via HSC tag setup with HI ENG / LO ENG parameters) | Yes (via HSC setup with preset scaling) |
| Direct scaled value usable by downstream logic | No (requires Solution 3 implementation) | Yes, native scaled integer/float | Yes, native scaled value |
| Decimal-place display | Configurable in Message Text | Configurable in tag properties | Configurable in HSC setup |
| Programming environment | LOGO! Soft Comfort | Do-More Designer | CLICK Programming Software |
| Typical applications | Low-frequency flow metering, small-machine control | Mid-range machine control, multi-axis motion | Small stand-alone machine control |
For applications requiring native engineering-unit scaling above 5 kHz HSC rates, migrating to a BRX Do-More or CLICK platform is more efficient than implementing Solution 3. A common field error when migrating is leaving the HI ENG parameter at the default RPM value when the sensor actually produces GPM-calibrated pulses; the HI ENG must be set to the maximum expected GPM corresponding to the maximum pulse rate. The LOGO! remains the cost-optimized choice for sub-5 kHz flow metering with integrated HMI where the engineering effort of Solution 3 is acceptable.
Troubleshooting Matrix
| Symptom | Likely Cause | Corrective Action |
|---|---|---|
| Display always reads 0 GPM | Impulse generator not running, or TL ≠ 0.01 s | Verify B110 configuration; confirm TH + TL equals desired G_T; check that impulse generator EN input is true |
| Display value flickers or is unstable | Gate time too short, or electrical noise on HSC input | Increase G_T to 1–2 s; use shielded twisted-pair cable grounded at LOGO! end only; add input debouncing capacitor (100 nF) across HSC input |
| Display correct but downstream comparator does not respond | Standard threshold trigger output is display-only | Switch to Solution 3; route the B008 analog output to the comparator reference input |
| Counter overflows or wraps unexpectedly | Gate time too long for input frequency range; counter ON value too low | Reduce G_T or split into multiple shorter sub-windows; raise counter ON to f_max × G_T |
| Value off by factor of 10 | Wrong k value in GAIN formula or in Message Text decimal places | Recompute GAIN = (10k × m) / (TH + TL) with correct decimal-place count; ensure Message Text decimals match |
| HSC not counting at all | Wrong input terminal (I1/I2 used instead of I3–I6) or sensor supply missing | Rewire sensor to I3, I4, I5, or I6; verify 24 V DC sensor supply at the LOGO! sensor power terminal |
| Value stable but biased high or low | Wrong m value used in GAIN calculation | Re-derive m from flow meter calibration certificate; recalculate GAIN and OFFSET |
| Display reads correct value but with incorrect sign | Counter wired to down-count mode or input polarity reversed | Switch counter to up-count mode; verify HSC input polarity against sensor output type (PNP vs NPN) |
| Value updates only when input frequency changes | Analog Multiplexer EN not toggling on each gate | Verify Impulse Generator output reaches Mux EN input; check that EN polarity matches Mux configuration (level vs edge triggered) |
Field Commissioning Notes
- LOGO! 8.4 (firmware FS:04) introduced improved HSC input filtering. Verify firmware version via LOGO! BM menu > System > Firmware before commissioning.
- For 24 V DC flow sensors, ensure the LOGO! sensor power supply can source the required current (typically 100-200 mA per HSC input device). Cumulative HSC current must not exceed the LOGO! supply rating (typically 300 mA continuous).
- Use shielded twisted-pair cable for HSC wiring to prevent EMI-induced false counts; ground the shield at the LOGO! end only to avoid ground loops.
- Maintain separation of at least 100 mm between HSC signal cables and VFD power cables or other noise sources.
- For safety-critical flow measurement, the LOGO! is not a SIL-rated controller. Use a Safety PLC (e.g., Siemens S7-1200F or SIPLUS) for those applications.
- Save the LOGO! Soft Comfort project file (.lsc) and export the parameterized block list as documentation for maintenance technicians. Include the m, k, GAIN, and G_T values in the documentation.
- When commissioning Solution 3, verify the B008 analog value with a multimeter or the LOGO! online monitor before connecting downstream logic to confirm the math produces the expected result.
- For applications requiring more than 8 hours of stable display, consider the sliding-window averaging extension to reduce the impact of pump pulsation on the displayed GPM value.
Related Edge Cases and Advanced Techniques
Sliding-Window Averaging
For flow signals that exhibit short-term noise (e.g., pump pulsation), a single gate time produces a noisy display. The Solution 3 architecture can be extended with a sliding-window counter bank: eight counters rotate, each integrating over a sub-window of length G_T / 8, and a ninth counter memory latches the most recent complete measurement for display. This reduces the effective update period by 8× while maintaining the same averaging window, smoothing pulsation artifacts without sacrificing response time.
Multi-Sensor Synchronization
When measuring differential flow (inlet vs. outlet) for leak detection, two modified threshold triggers share a common Impulse Generator. The shared RUN/STOP signal ensures both counters sample the same time window, eliminating skew between the two measurements. The differential GPM can then be computed by an Analog Subtractor block fed from both B008 outputs.
Display-Only Versus Control Hybrid
If the application requires only display, Solution 1 suffices when m ≥ 0.05 s. If the scaled value must also drive a control output (e.g., shutoff valve when GPM exceeds a threshold), only Solution 3 produces a value that can be referenced by a comparator or analog threshold trigger. Hybrid applications (display + control) require Solution 3 regardless of the m value.
Migration to BRX Do-More or CLICK
For new designs where the application anticipates HSC frequencies above 5 kHz or where multiple flow channels must be processed without Solution 3 overhead, evaluate the BRX Do-More or CLICK platforms. Both provide native engineering-unit scaling in the HSC configuration dialogue, eliminating the need for custom analog blocks and reducing commissioning time. The LOGO! remains the appropriate choice when the application is constrained to ≤ 5 kHz HSC, requires an integrated text display, and benefits from the LOGO! Soft Comfort programming environment.
What is the minimum gate time for the LOGO! Threshold Trigger?
The LOGO! 8 System Manual specifies G_T ≥ 0.05 s for the standard Threshold Trigger block. For shorter gate times (i.e., translation factors m < 0.05 s), use the frequency divider (Solution 2) or the modified threshold trigger (Solution 3) with an Impulse Generator driving an Up Counter and Analog Multiplexer.
Can the standard threshold trigger output be referenced as an analog value by other blocks?
No. The standard threshold trigger output is display-only and cannot feed downstream logic. For downstream logic such as a PID controller or comparator, implement Solution 3 with the count value routed through an Analog Multiplexer and one or more Analog Amplifiers to produce a referenceable analog output.
How is the final analog amplifier gain value calculated for Solution 3?
GAIN = (10k × m) / (TH + TL), where k = number of decimal places, m = GPM/Hz translation factor, and TH + TL = total gate time in seconds. OFFSET is normally set to 0. For m = 0.02 GPM/Hz, k = 1 decimal place, and G_T = 1 s, GAIN = 0.2.
Which LOGO! inputs support high-speed counting above 100 Hz?
Inputs I3, I4, I5, and I6 on the LOGO! 8 base module support up to 5 kHz. Inputs I1 and I2 are limited to 100 Hz and are unsuitable for direct flow-meter pulse counting. Verify the LOGO! model variant (e.g., 6ED1052-1MD08-0BA2 for the 24 V DC variant) supports the HSC terminal mapping before wiring.
Why is my displayed GPM value off by a factor of 10?
The decimal place setting k in the Message Text divides the displayed value by 10k. If GAIN was calculated for k = 1 but the Message Text is set to k = 0 decimal places, the shown value will be 10× higher than expected. Recompute GAIN with the correct k and ensure Message Text decimal places match. Conversely, if Message Text shows more decimals than GAIN was sized for, the trailing digits will reflect the un-scaled residual and appear noisy.