日本語 English

Digital filters

What Is a Digital Filter?

A digital filter is a signal processing technique for removing unwanted noise from a signal or extracting only specific frequency components. PLC analog input values often contain noise, and low-pass or notch filters make stable control and measurement possible.

Overview

This page introduces digital filter sample programs that can be used on the OMRON NX/NJ series.
To remove noise from analog inputs and extract specific frequency components, low-pass filters (LPF), high-pass filters (HPF), band-pass filters (BPF), notch filters and more are implemented as function blocks.
The operating waveforms of each filter and the sample programs are provided, so use them as a reference for signal processing and analog data analysis on PLCs.

Creates simple digital filters

Original waveform: 30 Hz sine wave with 500 Hz noise added

Original waveform

The original waveform contains a 30 Hz sine wave with 500 Hz noise
We apply the following 8 types of filters

Waveform after applying the low-pass filter

Low-pass filter

Cuts off frequencies above 100 Hz to remove noise

High-pass filter waveform

High-pass filter

Cuts off frequencies below 100 Hz to remove noise

Band-pass filter waveform

Band-pass filter

Passes one octave of frequencies around 30 Hz

Notch filter waveform

Notch filter

Removes one octave of frequencies around 30 Hz

Low-shelf filter waveform

Low-shelf filter

Amplifies frequencies below 100 Hz

High-shelf filter waveform

High-shelf filter

Amplifies frequencies above 100 Hz

Peaking filter waveform

Peaking filter

Amplifies one octave of frequencies around 30 Hz

All-pass filter waveform

All-pass filter

Shifts the phase around the cutoff frequency

Symbols

Input/output variables common to all functions

In-out
buf
Stores the inputs and outputs from two samples ago (always assign a variable and do not use it outside the FB)
Input
In
Input value
SampFreq
Sampling frequency
Freq
Cutoff frequency
BandWidth
Bandwidth
gain
Gain
Output
Result
Result

The sampling frequency defaults to the task period of the executing task; for high-speed analog units that acquire multiple analog values per scan, enter the sampling frequency (Hz) according to the setting
The graphs below show a 30 Hz + 500 Hz waveform collected at a sampling frequency of 10000 Hz and passed through the filters

LPF (low-pass filter)

A filter that passes frequencies below the cutoff frequency

LPF

HPF (high-pass filter)

A filter that passes frequencies above the cutoff frequency

HPF

BPF (band-pass filter)

A filter that passes only the bandwidth around the cutoff frequency
With a cutoff frequency of 30 Hz and a bandwidth of 1 octave, the range is 30/2 to 30x2, so 15 Hz to 60 Hz is passed

BPF

NotchF (notch filter)

A filter that passes everything except the bandwidth around the cutoff frequency
The opposite of BPF, it passes everything except 15 Hz to 60 Hz

Notch

LowShelfF (low-shelf filter)

A filter that amplifies frequencies below the cutoff frequency by the specified gain

LowShelf

HiShelfF (high-shelf filter)

A filter that amplifies frequencies above the cutoff frequency by the specified gain

HiShelf

PeekingF (peaking filter)

A filter that amplifies the bandwidth centered on the cutoff frequency by the specified gain

Peeking

AllPassF (all-pass filter)

A filter that changes only the phase around the cutoff frequency

AllPass

Example

Ladder logic

lpfLadder2

Applies a filter that passes only frequencies of 100 Hz or less to the AnalogIn data and outputs it to FilterAnalog

Source

Low-pass filter (LPF)

As an example, the low-pass filter is calculated as follows

Related pages

Download

References

Implementing simple digital filters (Japanese)

Comments