Case Study: ARM Cortex-M-Based Industrial Data Acquisition System Development ARM Cortex-M-based industrial data acquisition system development. STM32F407 with 16 analog inputs, FreeRTOS firmware, Modbus RTU over RS-485, mixed-signal PCB design, and IEC 61000-4 EMC compliance for manufacturing plant monitoring.

ARM Cortex-M-Based Industrial Data Acquisition System Development

1. Project Overview and Requirements

This case study narrates the whole process of a creation and implementation of an industrial DAQ system using an ARM Cortex-M microcontroller unit which is supposed to be used in a manufacturing plant environment to monitor temperature, pressure, and vibration.

The system allows to work with as many as 16 analog sensor inputs, perform local data processing, and transfer data to the SCADA control system with the help of the RTU Modbus protocol using an RS-485 interface.

The main technical requirements were: the sampling accuracy not exceeding 0.5% of full scale, minimum sampling rate of at least 1kSPS for each interface, deterministic response in real-time mode, possibility of working in the temperature range of –20 °C – +70 °C, and abiding by IEC 61000-4 standards for EMC in industrial application.

ARM Cortex-M-Based Industrial Data Acquisition System Development

2. Hardware Architecture and Sensor Interfacing

2.1 Microcontroller Selection

The STM32F407VGT6 is primarily a CPU that uses the ARM Cortex-M4F processor which works at a speed of 168 MHz and comes equipped with an FPU, 1MB of Flash memory and 192 KB of SRAM.

The Cortex-M4F structure is capable of accelerating floating-point calculations which enable real-time filtering and linearization of various sensors, as well as having built-in ADC with 12-bit accuracy and ensuring data transfers via the DMA controllers without extra CPU involvement.

ARM Cortex-M-Based Industrial Data Acquisition System Development

2.2 Sensor Interfacing

This system relies on three essential kinds of sensors:

  • RTD temperature sensors (PT100/PT1000) which are connected through a precise current source (1mA) and a delta-sigma ADC (AD7793) to measure temperature accurately.
  • Transmitters that work at a current range of 4–20 mA that are connected using a 165 Ω burden resistor, this serves as an interface between the transmitter and a 0.66–3.3 V signal range recognized by STM32's ADC input.
  • IEPE vibration sensors which are conditioned in an AC-coupling charge amplifier stage.

The MAXREFDES67# reference design provided by Maxim Integrated shows the design of a unified architecture that works for voltage, current, RTD, and thermocouple signals.

2.3 Signal Conditioning Design

For the construction of the signal conditioning chain for each analog input channel, 3 levels were implemented, namely: input protection → amplification → anti-aliasing filtering. The amplification stage was accomplished by means of INA333 instrumentation amplifier, with gain equal to 10, which proves to be important for weak levels and which provides high common mode rejection (>100 dB) and low input offset.

The anti-aliasing filtering stage was constructed using Sallen-Key second order low-pass topology and requires low-noise JFET operational amplifier (AD8510). The cut-off frequency was selected to be 5 kHz, which provides that the attenuation of the signal at the Nyquist frequency of 10kSPS sampling frequency is >60 dB.

ARM Cortex-M-Based Industrial Data Acquisition System Development

3. ADC Design and DMA-Based Acquisition

The 12-bit SAR ADC of the STM32F407 was designed to operate in scan mode over 16 channels at conversion time of 3.0 µs per channel (total scan time ≈48 µs). Circular mode DMA2 Stream 0 was used to transfer data directly to a double-buffer in SRAM hence relieving the CPU from performing this data movement.

One crucial aspect of the design was the configuration of the sampling time. For low impedance sources (RTD and burden resistor outputs), sampling time of 15 ADC clock cycles (≈0.2 µs) was deemed reasonable.

Whereas in case of higher impedance sensor interfaces, sampling time was lengthened to 144 cycles for a complete settling process. The reference voltage for the ADC was retrieved from an external precision reference of 3.000 V (REF5030), allowing for a theoretical resolution of 0.732 mV/LSB.

Each channel of acquisition was recording 16 samples in a sliding window buffer. Along with digital filtering technique combining median filtering (removing impulse noise) and the first order IIR low-pass filter with α = 0.2, sent ADC noise from ±15 LSB to ±2 LSB which is an 87% improvement in the stability.

4. FreeRTOS Firmware Architecture

4.1 Task Design

The firmware was organized around a pre-emptive FreeRTOS scheduler (v10.5) with a 1 ms tick period. Five tasks were defined:

TaskPriorityStack SizeFunction
Task_Acquisition 4 (Highest) 512 words ADC buffer processing, digital filtering
Task_Modbus 3 4096 words Modbus RTU slave polling and response
Task_Processing 2 1024 words Sensor linearization, unit conversion
Task_Diagnostics 1 512 words Watchdog feed, self-test routines
Task_Idle 0 128 words Low-power idle hook

The DMA transfer-complete interrupt activated the acquisition process through a binary semaphore, which allowed for a quick response to new data without polling.

Data transmission between tasks made use of FreeRTOS queues, which transmitted filtered sensor data from acquisition to processing, as well as mutexes to protect UART resources.

4.2 Modbus RTU Protocol Stack

The Modbus RTU slave was created with FreeModbus open-source software that was adapted to STM32 HAL.

The protocol supported function codes 03 (Read Holding Registers) and 04 (Read Input Registers), hence mapping 32 data registers that were used for filtering sensor data, the status of the system, and diagnostics.

The Modbus task operated with a baud rate of 115200; the time needed for frame delimitation was 3.5 characters without any speed of transmission.

5. PCB Layout and EMC Considerations

5.1 Mixed-Signal Partitioning

The four-layer PCB (FR-4, 1.6 mm) was divided into separate analog and digital zones using one ground plane.

The placing of components obeyed this partition rule: the analog front-end devices were on the left side, while the MCU, RS-485 transceiver, and power regulation circuits were on the right-hand side.

The STM32 analog power ports (VDDA/VSSA) had their own ferrite bead and had a separate 100 nF + 10 µF capacitor network for decoupling, and the analog ground was connected to the digital ground through just one common point below the ADC.

5.2 EMC Hardening

For EMC countermeasures, TVS diodes were installed on all external I/O lines for protection from ESD and power surges, common-mode chokes were installed in RS-485 pairs, 120 Ω termination resistors with fail-safe biasing were included, and ground stitching vias were added at λ/20 distances around the board perimeter.

The RS-485 transceiver (SN65HVD1780) was chosen, since it has high resistance to ESD (±16 kV) according to IEC 61000-4-2 standards and can work at common mode levels of −7 V to +12 V.

6. Field Testing and Validation

6.1 Functional Testing

The system underwent undergone a 72-hour long test under laboratory conditions during which no data loss incidence occurred and there were no communication errors as well. The tests proved that ADC noise readings fulfilled the target stated in ±2 LSB stability.

6.2 EMC Compliance Testing

Pre-compliance testing was performed in accordance with the standards set in the IEC 61000-4 series. The emissions test showed the measured radiated emissions level below 40 dBµV/m for the frequency range of 30 MHz to 1 GHz. Immunity tests included EFT/burst tests (±2 kV on power and I/O lines), surge tests (±1 kV on RS-485), and radiated RF immunity tests (10 V/m in the frequency range of 80 MHz to 1 GHz) — all of which passed without any failures.

6.3 Environmental Testing

This unit was subjected to tests in a climatic chamber at −20°C to +70°C. The temperature drift of the analog front-end was determined to be 15 parts per million per degree Celsius, with the firmware compensate for this through a polynomial correction based on the temperature measured by the onboard sensor. Vibration testing (5 to 500 Hz, 2 g RMS) confirmed that the mechanical integrity of the connectors and the solder points was intact.

6.4 Field Deployment

A six-month field trial was held in a manufacturing plant that was focused on monitoring the bearing temperature and vibration of motors on the production line. The system was able to achieve a data availability of 99.97%, with the only downtime experienced due to routine maintenance of the host SCADA and Modbus system. The Modbus communication error rate was kept below 0.01% throughout the trial period.

7. Lessons Learned and Conclusion

Key engineering lessons from this project include:

  • The criticality of proper analog partitioning in mixed-signal PCB design, inadequate grounding can degrade effective ADC resolution by 2–3 bits.
  • The necessity of hardware filtering at the sensor interface to reduce ADC noise before digital processing.
  • The importance of deterministic task scheduling in FreeRTOS to meet real-time constraints under all load conditions.

The finished system has shown that the ARM Cortex-M4F based platform, used with structured mixed-signal design along with FreeRTOS firmware design can offer similar performance to that of manual data acquisition modules and with better customization options at lower cost.

What Our Clients Say About Us

Client satisfaction is our ultimate goal. Here are some kind words of our precious clients they have used to express their satisfaction with our service.

Leadership That Leads Worldwide

With a physical presence in over 15 countries and a global footprint spanning 25+ countries, we are ready to serve you anywhere. Location, language, or culture is never a barrier, because our global team can work with you in your language. Our strong international team ensures seamless collaboration across borders We have a strong tech team, highly recognized in their domains, with extensive technical expertise.