Wiring Festo SFAB-600U Flowmeter to S7-1200 PLC: Complete Guide

David Krause14 min read
S7-1200SiemensTutorial / 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

Wiring Festo SFAB-600U Flowmeter to S7-1200 PLC: Complete Guide

This reference walks an automation engineer through the full integration of a Festo SFAB-600U (order code 8046862 / variant 2SA Q10) compressed-air flow sensor with a Siemens SIMATIC S7-1200 CPU 1214C for an energy-reduction application. The flowmeter is field-mounted in a portable test rig, wired through an SM 1231 analog input module, scaled in TIA Portal with NORM_X and SCALE_X, totalised into a litres-used accumulator, multiplied by a configurable cost rate, and visualised on a SIMATIC HMI Panel connected over PROFINET / Ethernet.

The document covers pin-level wiring, module selection, TIA Portal hardware configuration, ladder and SCL code, cost calculation, HMI tag mapping, commissioning, and a troubleshooting matrix keyed to the most common first-build faults.

Field note: The on-board I/O of an S7-1200 CPU is voltage-only (0-10 V). A 4-20 mA current output from the SFAB-600U must land on an SM 1231 or SB 1231 current-input module. Connecting a current source directly to a voltage input will produce a pegged-at-zero or pegged-at-full-scale reading and can damage the channel.

1. System Overview and Application Context

The application is a portable compressed-air audit station. An air line feeding a candidate user (nozzle, actuator, blow-off) is broken and the SFAB-600U is inserted in series. The PLC samples the flow, integrates the volume over the audit window, and reports an annualised cost saving when the user is removed. The result is a defensible kWh / £ figure for the energy team.

1.1 Functional Block Diagram

Air supply (plant) Festo SFAB-600U 4-20 mA / 0-600 L/min S7-1200 CPU 1214C + SM 1231 AI TIA Portal V17+ SIMATIC HMI PROFINET / Ethernet Real-time flow · totaliser · £/min · £/year

1.2 Bill of Materials (minimum, single-channel build)

Item Manufacturer / Order Code Qty Notes
Compressed air flow sensor Festo SFAB-600U-WQ10-2SA (P/N 8046862) 1 4-20 mA + 2x PNP + IO-Link
PLC CPU Siemens 6ES7214-1AG40-0XB0 (CPU 1214C DC/DC/DC) 1 Firmware V4.4 or later recommended
Analog input module Siemens 6ES7231-4HD32-0XB0 (SM 1231, 4 AI, ±10 V / 0-20 mA) 1 Configured for 0/4-20 mA on channel 0
Power supply Siemens SITOP 6EP1332-1LA00 or equivalent 24 V / 5 A 1 Class 2 / LPS, fused
M12 5-pin cable, female, 5 m Festo NEBU-M12G5-K-5 (8043870) or equivalent 1 Pre-wired, A-coded
HMI panel (optional) Siemens SIMATIC KTP700 Basic / Comfort 1 Ethernet connected

2. Festo SFAB-600U Signal Specification

The SFAB family is a thermal-mass flow sensor. The "-2SA Q10" variant exposes one analogue output, two switching outputs, and an IO-Link interface. This article uses the analogue output (Out C) only; the binary and IO-Link lines are not used for the audit application.

2.1 M12 5-Pin Pinout (A-coded, male on sensor)

Pin Assignment Core Colour (Festo convention) Signal Direction Use in this build
1 DC +24 V operating voltage Brown (BN) In (to sensor) Supply 24 V from SITOP
2 Binary output B (Out B) White (WH) Out (from sensor) Spare / not wired
3 0 V (GND) Blue (BU) In (to sensor) Common 0 V return
4 Binary output A (Out A) Black (BK) Out (from sensor) Spare / not wired
5 Analogue output C (Out C) Grey (GY) Out (from sensor) 4-20 mA signal to AI
3-wire rule: The SFAB-600U is not loop-powered. The current output on pin 5 is an active sourcing output referenced to the 0 V on pin 3, so the sensor must receive its own 24 V on pin 1 and 0 V on pin 3. Two-wire loop wiring will not function.

2.2 Analogue Output Transfer Function

Flow (L/min) Output current (mA) Notes
0 4.000 Live-zero standard
150 8.000 Quarter scale

3. S7-1200 Analog Input Module Selection

The S7-1200 family offers two analog-input form factors:

Form factor Typical order code Channels Current input supported? When to use
Signal Board (SB) 1231 6ES7231-4HA30-0XB0 (1 AI) 1 Yes, 0/4-20 mA Single sensor, no DIN space
Signal Module (SM) 1231 6ES7231-4HD32-0XB0 (4 AI) 4 Yes, ±10 V or 0/4-20 mA per channel Multi-sensor or future expansion

For a portable audit rig the SM 1231 4 AI is preferred because (a) it gives spare channels if the energy team adds a pressure transmitter, and (b) the channel-to-channel isolation is more robust for shop-floor wiring.

Verify the module firmware supports the type D rating (4 AI, 16-bit, ±10 V / 0-20 mA selectable). Modules with a "C" suffix (e.g. 6ES7231-4HC32-0XB0) are 2-channel only.

4. Physical Wiring: 3-Wire Current Loop to the SM 1231

4.1 Wiring Table

SFAB-600U pin / colour Function Lands on Terminal on SM 1231
1 / Brown +24 V supply SITOP +24 V (fused ≤ 1 A) n/a (lands on PSU)
3 / Blue 0 V supply return SITOP 0 V and SM 1231 M terminal (must be common) M (terminal 13 / 17 / 21 / 25 depending on channel group)
5 / Grey 4-20 mA signal + SM 1231 channel 0 positive input AI0+ (terminal 10 for channel 0)
Common 0 V is mandatory. The SFAB-600U's 0 V on pin 3 must be bonded to the SM 1231's M terminal and to the SITOP 0 V. If the sensor is powered from a separate PSU without tying the commons, the 4-20 mA loop will float and the AI channel will read near zero or noise.

4.2 Wiring Diagram (channel 0 only)

Festo SFAB-600U M12 5-pin A-coded 1 BN+24 V 2 WHOut B (n.c.) 3 BU0 V 4 BKOut A (n.c.) 5 GY4-20 mA SITOP 24 V +24 V (≤1 A fuse) 0 V (common) SM 1231 4 AI 6ES7231-4HD32-0XB0 M (terminal 13) AI0+ (terminal 10) Channel 0 configured as 4-20 mA

5. TIA Portal Hardware Configuration

5.1 Device Configuration Steps

  1. Open the TIA Portal project and add the CPU 1214C from the hardware catalog (order code 6ES7214-1AG40-0XB0).
  2. From Catalog > DI/DO > AI > SM 1231, drag the 4-AI module onto slot 1 of the CPU. Slot 1 is the first signal-module position to the right of the CPU.
  3. Open the SM 1231 properties and select "AI0" > "Inputs" > "Measuring type: Current (4-wire transducer)" and "Measuring range: 0 to 20 mA" (or "4 to 20 mA" if offered; if only 0-20 mA is shown the 4 mA live-zero is still respected by the engineering-unit scaling).
  4. Set the smoothing to "Weak" (or use the default 1-cycle filter) for first commissioning. Strong smoothing hides wiring problems.
  5. Under Diagnostics > Overflow / Underflow, enable the diagnostics bits so the OB82 diagnostic interrupt fires on a broken wire.
  6. Compile and download the hardware configuration.

5.2 Tag Declaration for the Application

Tag name Data type Address / I/O Description
i_FlowRaw INT %IW64 Raw value from SM 1231 channel 0 (0-27648)
r_FlowNorm REAL DB / global Output of NORM_X (0.0 - 1.0)
r_FlowLpm REAL DB / global Engineering flow in L/min (0.0 - 600.0)
r_FlowLps REAL DB / global Flow in L/s for HMI display
r_TotalLitres LREAL DB / global, retentive Accumulates litres used since last reset
r_CostPer10L REAL DB / global, settable from HMI Default 0.10 (GBP per 10 L)
r_CostPerMin REAL DB / global Instantaneous £ / min
r_CostTotal LREAL DB / global, retentive Running £ cost
x_ResetTotals BOOL DB / global Pulse to reset both totalisers
x_WireBreak BOOL DB / global Set by OB82 if AI diagnostics fires

6. PLC Programming: NORM_X and SCALE_X Scaling

The S7-1200 AI channel returns an integer in the range 0 to 27648 for the configured 0-20 mA (or 4-20 mA) input. The IEC functions NORM_X and SCALE_X are the recommended way to convert this to engineering units, as they keep the maths linear, type-safe, and easy to audit.

6.1 Transfer Function

For 4-20 mA into 0-27648 counts and an output range of 0-600 L/min:

r_FlowLpm = ( ( i_FlowRaw - 0 ) / ( 27648 - 0 ) ) * ( 600 - 0 ) + 0

For full 4-20 mA live-zero awareness (catches a broken wire, which would read 0 mA = 0 counts):

r_FlowLpm = ( ( i_FlowRaw - 5530 ) / ( 27648 - 5530 ) ) * 600

where 5530 counts = 4 mA (since 27648 / 5 = 5529.6, rounded to 5530).

6.2 SCL Block: FC_FlowScale

FUNCTION "FC_FlowScale" : Void
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
   VAR_INPUT
      i_RawValue : Int;        // 0 - 27648 counts from SM 1231 ch0
   END_VAR
   VAR_OUTPUT
      r_FlowLpm : Real;        // 0.0 - 600.0 L/min
      x_Underflow : Bool;      // < 4 mA (broken wire / sensor unpowered)
      x_Overflow  : Bool;      // > 20 mA (overrange / fault)
   END_VAR
   VAR_TEMP
      r_Norm : Real;
   END_VAR
BEGIN
   // Live-zero check
   IF i_RawValue < 5530 THEN
      x_Underflow := TRUE;
      r_FlowLpm   := 0.0;
   ELSIF i_RawValue > 27648 THEN
      x_Overflow := TRUE;
      r_FlowLpm  := 600.0;
   ELSE
      x_Underflow := FALSE;
      x_Overflow  := FALSE;
   END_IF;

   // NORM_X scales RawValue into 0.0 - 1.0
   r_Norm := NORM_X_REAL(    // alternate: NORM_X with WORD input for raw counts
                  MIN    := 5530,           // 4 mA
                  VALUE  := INT_TO_REAL(i_RawValue),
                  MAX    := 27648           // 20 mA
                );

   // SCALE_X stretches 0.0 - 1.0 into the engineering range
   r_FlowLpm := SCALE_X_REAL(
                  MIN    := 0.0,
                  MAX    := 600.0,
                  VALUE  := r_Norm
                );
END_FUNCTION

Call the block in OB1 / OB35 on a 100 ms cycle so the totaliser math below has a deterministic dt.

6.3 Ladder Equivalent (Main OB1, network 1)

Network 1: Scale raw input to L/min
   |---[ %IW64 ]---[ NORM_X (MIN=5530, MAX=27648) ]---[ r_FlowNorm ]---|
   |---[ r_FlowNorm ]---[ SCALE_X (MIN=0.0, MAX=600.0) ]---[ r_FlowLpm ]---|

7. Real-Time Totaliser and Cost Calculation

The audit application requires two derived values:

  • L per minute consumed in the current window (or instantaneous L/s on the HMI).
  • Running cost = total litres × (cost-per-10-L / 10).

7.1 Discrete-Time Integration

On a fixed 100 ms cycle:

r_TotalLitres := r_TotalLitres + ( r_FlowLpm / 60.0 ) * 0.1;

That is, litres-per-second (L/min ÷ 60) times the cycle time in seconds (0.1 s) added to the running total.

For a £/min display:

r_CostPerMin := ( r_FlowLpm / 10.0 ) * r_CostPer10L;

For a running £ total:

r_CostTotal := ( r_TotalLitres / 10.0 ) * r_CostPer10L;

7.2 Annualised Projection (per the application brief)

The brief asks for a "running-all-year" extrapolation. If the energy team runs the audit for N minutes and the projected annual operating profile of the load is Y minutes per year, the annual saving is:

AnnualLitres = ( r_TotalLitres / N ) * Y;
AnnualCost   = AnnualLitres * r_CostPer10L / 10;

Both N and Y should be exposed as HMI-settable tags (REAL, in minutes).

Methodology caveat: A linear annualisation is only valid if the load is approximately continuous over the audit window. Pulsed loads (e.g. solenoid-actuated blow-offs) must be characterised over at least one full production cycle, or the projected figure will be misleading.

8. HMI Tag Configuration and Display Layout

8.1 Tag List (HMI side)

HMI tag PLC tag Format Display element
HMI_FlowLps r_FlowLps 999.9 Numeric output, L/s
HMI_FlowLpm r_FlowLpm 999.9 Numeric output, L/min
HMI_TotalLitres r_TotalLitres 9999999 Numeric output, L
HMI_CostPerMin r_CostPerMin £0.00 Numeric output, £/min
HMI_CostTotal r_CostTotal £99999.99 Numeric output, £
HMI_AnnualCost r_AnnualCost £99999.99 Numeric output, £/yr
HMI_Reset x_ResetTotals bool Button (pulse)
HMI_EditRate r_CostPer10L £0.0000 Input field

8.2 Connection

The HMI connects to the CPU 1214C's PROFINET port (X1) on the same subnet as the engineering PC. Default CPU IP 192.168.0.1, HMI IP 192.168.0.10, subnet mask 255.255.255.0. Use a shielded Cat-5E / Cat-6 patch lead and earth the shield at one end only.

9. Commissioning and Verification

9.1 Pre-Power Checklist

  1. Confirm the SM 1231 is seated and the bus connector is fitted between the CPU and the SM.
  2. Verify 24 V and 0 V are present at pins 1 and 3 of the SFAB-600U with a DMM before plugging the M12.
  3. Confirm the shield of the M12 cable is bonded to PE at the panel gland, not at the sensor end (avoids ground loop).
  4. With the sensor powered but no flow, observe the current on pin 5 — it must read 4.000 mA ± 0.02.

9.2 End-to-End Verification

  1. Download the TIA Portal project to the CPU and go online.
  2. Add the AI tag %IW64 to a watch table. With no flow the value should sit at 0 (4 mA = 0 counts when the channel is set for 0-20 mA) or at 5530 (4 mA live-zero offset if configured for 4-20 mA).
  3. Force a known flow on the regulator (e.g. 300 L/min on a rotameter) and confirm the raw count is half scale, and r_FlowLpm reads 300.0 ± 0.5 L/min.
  4. Pulse the HMI Reset button; both totalisers must return to zero.
  5. Disconnect the grey wire at the sensor end; x_WireBreak (or x_Underflow) must assert within 200 ms.

9.3 Acceptance Test Sheet

Test point Acceptance criterion Result
Current at pin 5, no flow 4.000 mA ± 0.020
Current at pin 5, 300 L/min 12.000 mA ± 0.060
Raw count, 300 L/min 13824 ± 50
r_FlowLpm, 300 L/min 300.0 ± 0.5
Totaliser drift, 60 s, zero flow < 0.1 L
Wire-break detection Asserts < 500 ms
HMI update rate ≥ 1 Hz, no flicker

10. Troubleshooting Matrix

Symptom Likely root cause Diagnostic Fix
Raw value pegged at 0 / 32767 Voltage input configured where current expected, or vice versa Inspect SM 1231 channel properties "Measuring type" Set channel to "Current (4-wire transducer)" / 4-20 mA range
Raw value noisy / floating 0 V not common between SITOP and SM 1231 Measure V between sensor 0 V and SM M terminal with DMM Bond the 0 V return; check PSU commoning
Reading stuck at 5530 (4 mA) Sensor not powered, or current loop open Measure 24 V at pin 1; measure 4 mA at pin 5 with inline meter Repair supply; check M12 connector pin engagement
Reading stuck at 27648 (20 mA) Overrange / sensor fault / wiring short Check sensor LED / IO-Link diagnostics Inspect for pinched cable; replace sensor if internal short
Flow reads correctly, totaliser drifts up when flow is zero Live-zero not used; underflow condition adds residual Check x_Underflow bit Gate the integration: only add to r_TotalLitres when NOT x_Underflow AND NOT x_Overflow
HMI shows ### / connection error Subnet mismatch, firewall, or wrong HMI connection Ping CPU from HMI configuration PC Set HMI IP/subnet to match CPU; disable Windows firewall for PROFINET
Cost figure wildly high after 24 h Totaliser is in L/min rather than L/s when integrated Inspect the dt term in the integration Use r_FlowLpm / 60.0 * dt_seconds
Reading accurate at low flow, off by 2-3 % at high flow Averaging / smoothing set too high, or sensor still in run-up Watch raw count stability Lower smoothing; allow 30 s warm-up after power-on

11. Safety, Best Practices and Field Notes

Pressure safety. The SFAB-600U is rated for a maximum working pressure of 16 bar on compressed air. The portable rig must include a pressure-relief path and a regulator upstream of the sensor. Do not exceed the sensor's stated pressure, flow, or temperature limits.
Electrical safety. The 24 V supply must be fused (typically 1 A slow-blow per sensor) and the 0 V bonded to the panel PE at a single point. The SFAB-600U is not intrinsically safe — do not deploy in hazardous areas without an approved barrier.
  • Use retentive tags for the totalisers so a power cycle does not lose the audit result.
  • Add the SM 1231's diagnostics interrupt OB (OB82) to your project; without it wire-break will fail silently.
  • Calibrate the loop annually. Festo publishes a recommended recalibration interval of 12 months for the SFAB series when used with air.
  • Document the cost-per-10-L value in the project comments; it is a financial input and will be challenged by the energy team.
  • Keep the HMI tag polling time at 1 s; faster polling on a LREAL totaliser adds no value and clogs the PROFINET bus.

12. Frequently Asked Questions

Why does the S7-1200 onboard analog input not work with the Festo SFAB-600U?

The CPU 1214C on-board inputs are 0-10 V voltage only. The SFAB-600U outputs 4-20 mA current on pin 5. You must add an SM 1231 (e.g. 6ES7231-4HD32-0XB0) or SB 1231 current-input module and configure the channel as "Current (4-wire transducer)" in TIA Portal.

Is the SFAB-600U loop-powered, and can I wire it as a 2-wire device?

No. The SFAB-600U is a 3-wire / 4-wire device. It requires its own 24 V supply on pin 1 and 0 V return on pin 3, and the 4-20 mA signal on pin 5 is an active sourcing output. Two-wire loop wiring will not function and may damage the sensor.

What raw integer value should I see at 0 L/min and at 600 L/min?

At 0 L/min the raw count is 0 (0-20 mA mode) or 5530 (4-20 mA live-zero mode). At 600 L/min the raw count is 27648. Always scale 0-27648 to 0-600 L/min via NORM_X and SCALE_X, and gate the integration on a valid live-zero check to detect a broken wire.

Can I read the binary outputs on pins 2 and 4 at the same time as the 4-20 mA on pin 5?

Yes. Pins 2 and 4 are PNP switching outputs that can be wired to any S7-1200 digital input rated for 24 V sourcing, independently of the analog channel. The SFAB-600U is commonly used with one analog channel for trend and one binary channel for threshold alarm.

How do I avoid the totaliser drifting up when the flow is genuinely zero?

Add a live-zero check. In the scaling block, if the raw count is below 5530 (4 mA) set a boolean underflow flag and force the flow to 0.0 L/min. Only add to the totaliser when the underflow flag is false, otherwise noise around 0 mA accumulates into a phantom volume.

Back to blog