Electromagnetic Flow Meter Embedded Controller for Industrial and Water Management

CASE STUDY SNAPSHOT

Customer : A Chennai-based manufacturer of industrial measurement and instrumentation equipment
Size : > 51–200
Project vertical : Industrial Automation, Flow Measurement, Water Management
Challenge : Design and develop a complete production embedded hardware and firmware solution for an electromagnetic flow meter, covering low-frequency rectangular wave coil excitation, precision analog front-end signal acquisition, graphical LCD operator interface, and a comprehensive industrial output and communication interface set
Solution : Production embedded flow meter controller on Freescale Kinetis K series ARM Cortex-M4 MCU with low-frequency rectangular wave excitation, precision analog signal conditioning, graphical LCD with keypad navigation, 4-20mA current output, pulse output, relay output, RS485/RS232 Modbus communication, and automatic self-configuration with diagnostics
Services & Products Availed :  Turnkey Product Engineering, Embedded Hardware Design, Embedded Firmware Development
Tools and Technologies:
  • Target MCU:  Freescale Kinetis K series (ARM Cortex-M4)
  • Display:  Graphical LCD
  • Input:  Keypad navigation
  • Outputs:  4-20mA current loop, pulse output, relay output
  • Communication:  RS485/RS232, Modbus RTU
  • Excitation:  Low-frequency rectangular wave
  • Analog Front End:  Precision signal conditioning, high-resolution ADC
  • Languages:  C
  • Tools:  Kinetis Design Studio

Introduction

Electromagnetic flow meters are among the most widely used flow measurement instruments in industrial and water management applications. Unlike mechanical flow meters that use rotating parts or obstruction elements, electromagnetic flow meters operate on Faraday's law of electromagnetic induction, measuring the voltage induced in a conductive liquid as it flows through a magnetic field generated by the meter's coil assembly. With no moving parts, no flow obstruction, and no pressure drop, electromagnetic flow meters offer exceptional reliability, longevity, and accuracy for measuring the flow of conductive liquids including water, wastewater, slurries, chemicals, and food-grade fluids.

A Chennai-based manufacturer of industrial measurement and instrumentation equipment approached Embien to design and develop the complete embedded hardware and firmware solution for their electromagnetic flow meter product. The meter had to deliver accurate, stable flow measurement across a wide range of flow rates and pipe diameters, with a comprehensive set of industrial outputs and communication interfaces that would allow it to integrate into diverse industrial automation, SCADA, and water management infrastructure environments.

Challenge

The fundamental measurement challenge in an electromagnetic flow meter is extracting a small, noise-sensitive signal, the flow-induced voltage across the liquid, from a measurement environment that includes significant electrical interference from the coil excitation current, mains frequency interference from the industrial environment, and electrochemical noise at the electrode-liquid interface. The signal conditioning and acquisition strategy had to achieve sufficient signal-to-noise performance for accurate flow measurement across the full specified flow range, from very low flow rates where the induced signal is smallest and most susceptible to noise, to full-scale flow where the signal is large but the measurement bandwidth requirements are highest.

The low-frequency rectangular wave excitation technique, alternating the direction of the magnetic field at a frequency well below the mains frequency, is the standard approach in modern electromagnetic flow meters for separating the flow signal from mains interference and electrode noise. Implementing this correctly in firmware required precise timing control of the excitation switching, careful synchronisation of the analog acquisition windows with the excitation cycle, and correct application of the differential measurement technique that extracts the flow signal from the alternating excitation phases.

Supporting multiple flow tube diameters, each with different full-scale flow velocities, electrode sensitivities, and coil electrical characteristics, within a single instrument design required a configurable calibration and scaling architecture in the firmware that could be adapted to different meter body sizes through parameter configuration rather than code changes.

The comprehensive industrial output and communication interface set, 4-20mA current loop, pulse output, relay output, and RS485/RS232 Modbus, each required dedicated firmware implementation and careful electrical design to ensure correct, interference-free operation in industrial environments where ground loops, cable capacitance, and electromagnetic interference are common.

Solution

Dual-Core Hardware Architecture

Kinetis K Series Platform and Firmware Architecture

The flow meter controller was implemented on the Freescale Kinetis K series MCU, the Kinetis K60 providing the combination of ARM Cortex-M4 processing capability, hardware floating-point unit for flow calculation, high-resolution ADC for analog signal acquisition, and rich peripheral set required for the meter's output and communication interfaces, in an appropriate package for the flow meter's controller PCB form factor. The firmware was structured around a foreground/background architecture, with time-critical excitation control and ADC acquisition managed in interrupt context at the excitation frequency, and flow calculation, display update, output management, and Modbus communication handled in the background task loop.

Low-Frequency Rectangular Wave Excitation

The magnetic field coil is driven by a low-frequency rectangular wave excitation circuit controlled by the firmware's excitation timing engine. The excitation frequency, typically in the range of 6.25Hz to 25Hz depending on the fluid and application, is generated by the firmware using a hardware timer, with the excitation direction switched at each half-cycle boundary through control of the H-bridge driver circuit. The excitation frequency is configurable through the instrument's setup menu, allowing the operator to select the optimal frequency for the specific fluid and application, lower frequencies for fluids with high electrode noise, higher frequencies for applications requiring faster flow response.

The firmware's ADC acquisition is synchronised with the excitation cycle through the same timer interrupt that controls excitation switching. Acquisition windows are positioned within each excitation half-cycle to capture the settled flow signal, after the transient associated with the excitation switching has decayed, and avoid the switching transient periods where the signal contains artefacts rather than valid flow information. This synchronised acquisition approach, combined with the differential processing of the two excitation half-cycle measurements, achieves effective rejection of mains frequency interference and electrode DC offset from the flow measurement.

Precision Analog Signal Conditioning

The flow-induced electrode voltage, a small differential signal typically in the millivolt range at low flow rates, is processed through a precision analog signal conditioning chain before reaching the Kinetis ADC. The signal conditioning provides differential-to-single-ended conversion, selectable gain amplification to optimise the signal level for the ADC input range at different pipe diameters and flow rates, and anti-aliasing filtering matched to the ADC sampling rate. Component selection throughout the analog chain prioritised low offset voltage, low noise, and low temperature drift, ensuring that the analog chain's contribution to measurement error was small relative to the flow signal over the specified operating temperature range.

The high-resolution ADC of the Kinetis K60 was configured for maximum resolution in the flow measurement context, using hardware averaging across multiple samples per acquisition window to further reduce measurement noise and improve the stability of the flow reading at low flow rates where the signal-to-noise ratio is most challenging.

Flow Calculation and Calibration

The flow velocity is calculated from the acquired electrode voltage using the electromagnetic flow meter's fundamental measurement equation, relating the induced voltage to the flow velocity, the magnetic flux density, and the electrode spacing. The calculation incorporates the meter's calibration constants, determined during factory calibration against a traceable flow reference, which account for the specific characteristics of the meter body, coil assembly, and electrode configuration. The Kinetis K60's hardware floating-point unit performs the velocity calculation, unit conversion, and totaliser integration efficiently without impacting the timing of the excitation control and acquisition interrupt.

A configurable low-flow cutoff threshold suppresses the flow display and outputs when the measured flow is below a defined minimum, preventing noise-induced false readings from appearing as low flow in the output signals when the actual flow is zero. Empty pipe detection, identifying when the meter tube is not full of liquid, which invalidates the flow measurement, was implemented through electrode impedance monitoring.

Graphical LCD Operator Interface

The operator interface uses a graphical LCD display with keypad navigation, providing the instrument operator with a clear, organised display of flow rate, flow velocity, totalised volume, and instrument status. The graphical display capability was used to present flow trend information as a real-time bar graph alongside the numerical flow rate, giving operators an intuitive visual indication of flow dynamics without requiring them to interpret numerical values alone. The menu system, accessible through the keypad, provides access to the instrument's configuration parameters, calibration constants, output scaling, communication settings, and diagnostic information through a structured, hierarchical menu structure designed for ease of use in a typical industrial instrumentation context.

Industrial Outputs and Modbus Communication

The 4-20mA current loop output provides a standard analog representation of the flow rate for integration with analog process controllers, data loggers, and SCADA systems, with the 4mA and 20mA points configurable to any flow rate values within the meter's measurement range. The pulse output generates a pulse train whose frequency or pulse width is proportional to flow rate or volume, supporting integration with pulse-counting PLC inputs and flow totalisation systems. The relay output provides a configurable alarm output, activating when the flow rate exceeds or falls below configurable thresholds, for use in process alarm and interlock systems.

RS485 and RS232 communication interfaces support Modbus RTU, the dominant industrial serial communication protocol, enabling integration with SCADA systems, PLCs, and data acquisition systems over industrial serial networks. The Modbus register map provides access to all flow measurement values, totaliser readings, instrument status, and configuration parameters, enabling remote reading and configuration of the flow meter from the supervisory system without physical access to the instrument.

Automatic Self-Configuration and Diagnostics

The firmware implements an automatic self-configuration sequence on power-up, checking the coil circuit continuity, electrode contact quality, and signal conditioning chain operation before entering normal measurement mode. Diagnostic trouble codes are generated for detected faults, coil open or short circuit, empty pipe, electrode fouling, and signal overrange, and presented on the LCD display with descriptive fault messages. Diagnostic information is also accessible through the Modbus interface, enabling remote fault diagnosis from the supervisory system.

Benefits

  • Synchronised low-frequency excitation and acquisition Hardware timer-controlled rectangular wave excitation with synchronised ADC acquisition windows delivers effective mains interference rejection and electrode noise separation, achieving clinical-grade measurement accuracy across the full flow range
  • Configurable multi-diameter calibration Parameterised calibration architecture accommodates different meter body sizes and electrode configurations through factory calibration constant loading, enabling a single firmware base to support the full product range without code variants
  • Comprehensive industrial output set 4-20mA current loop, configurable pulse output, and relay alarm output cover the full range of integration requirements for industrial process control, SCADA, and alarm systems
  • Modbus RTU over RS485/RS232 Standard industrial Modbus communication enables remote reading, totalisation access, and configuration from SCADA systems and PLCs without physical instrument access
  • Automatic diagnostics on power-up Self-configuration sequence with coil, electrode, and signal chain validation on every power-up provides immediate fault visibility, reducing installation commissioning time and simplifying field troubleshooting

Conclusion

This electromagnetic flow meter project demonstrates Embien's capability to develop complete, production-grade embedded solutions for precision industrial measurement instruments. By implementing low-frequency rectangular wave excitation with synchronised analog acquisition, precision signal conditioning, comprehensive industrial outputs, and Modbus communication on the Freescale Kinetis K series platform, Embien delivered a flow meter controller that meets the accuracy, reliability, and integration requirements of industrial and water management applications. This project reflects Embien's experience in precision analog instrument design and industrial automation embedded development, a combination that is essential for measurement instruments where accuracy directly impacts process efficiency, product quality, and regulatory compliance.

Looking to develop embedded firmware for an electromagnetic flow meter or other precision industrial measurement instrument?

Partner with Embien for complete flow meter controller development covering precision analog acquisition, industrial outputs, and Modbus communication.

For further information on how your personal data is processed, please refer to the Embien Privacy Policy.