Strategy for Designing Digital Filters for Embedded Platforms

- This research focuses on the use of a methodological strategy for the implementation of digital filters on embedded systems. The purpose of the document is to perform a results analysis for the implementation of a FIR filter on a PSOC 5LP, comparing the proposed strategy with the actual response of the architecture used by the selected platform. In the document it will be shown the block diagram of the proposed solution, configuration parameters, algorithmic structures used, computational tools used to calculate operating parameters and the development of validation tests for the proposed strategy

range. The attenuation level is a factor that indicates how much the amplitude of the original signal is reduced at the filter output, normally expressed in dB (a decibel is used to express the power level of a signal). When a filter is constructed taking into account its domain in the frequency it is classified as follows [14][15][16][17]:  Low-pass filter: This type of filter attenuates the signals with high frequencies and lets the low frequency signals pass (related to a given cutoff frequency).  High-pass filter: This type of filter works in the opposite way to the low pass filter, since it attenuates the low frequency signals and lets the high frequency signals pass.  Band-pass filter: This type of filter combines the characteristics of the aforementioned filters, since it lets signals pass with frequencies in a certain range.  Eliminated band filter: This type of filter is the inverse of the band pass filter, since it eliminates signals with frequencies that are in a certain interval. As mentioned before the filters can be classified as analog or digital. Analog filters are used to process signals that are in the continuous time domain and their complement are digital filters, since they process the signals that have a domain in discrete time. Discrete time signals are ideal for digital controllers, because they do not process signals in continuous time [14][15][16][17].
Digital controllers determine the magnitude of a signal in different ways. However, the fidelity of the processed signal regarding the original depends on the sampling time used to capture the information. The sampling frequency is the system's ability to sample a continuous time signal for one unit of time. For example, the sampling frequency used by a analog to digital converter (ADC) to digitize a voice signal is normally 44.1 kHz, since the human voice is below this value (less than 20 kHz).
The sampled signals are filtered in a digital system using various filter types, of which the two most commonly used are mentioned: IIR filter: The Infinite Impulse Response filter (IIR) is a type of filter that by inducing the system into an input with a unit impulse form, said system will not be at rest again. The output of the filter depends on the previous and present values in the input, which are temporarily stored in the memory of the controller. This type of filter is represented by the mathematical expressions of equations 1 and 2 [13].
In the expressions P and Q determine the filter order, a andb determine the filter coefficients, an approximate model of the system is represented by the transfer function H (z) [13]. FIR filter: The finite impulse response filter (FIR) has a response limited by a finite number of terms, which is estimated from the current and previous input values, because they depend on the input they are only known as non-recursive filters and their output is represented by the mathematical expression of equation 3 [11].
is the filter transfer function, x is the input value and L determines the order of the filter. This relationship can also be represented by a transfer function as shown in equation 4. ∑ … … ( 4 ) Some differences between the two filter types are: The difficulty in the design, since the FIR filters are usually designed by iterative methods and the IIR by means of transformations of numerical expressions or mathematical equations. Efficiency, FIR filters usually require less time to estimate the output than type IIR, since FIR type filters are not recursive, that is, they do not need feedback from the output, even though FIR filters require a greater memory space for its implementation.
However, these characteristics vary depending on the methodology used to design the filter, in particular to design a FIR filter, 3 methods are usually used: The method of the window or Fourier transform, the method of sampling in frequency and the method of optimal approximations. Of which the transformation method will be analyzed, since it allows an approximate model of the transfer function to be obtained analytically [11].
III. DESIGN AND IMPLEMENTATION An approximate filter model is achieved by applying the window method, which consists of finding the appropriate coefficients of a FIR of order L, making a convolution between the transfer function that characterizes the ideal filter by different values of a function called a window [12].
To determine the function that characterizes the filter, it is assumed that is the Fourier transform in discrete time (from English, Discrete-time Fourier transform) of h[n], as shown in equations 5 and 6 [11].
This methodology is applied in the filters that work as a function of the frequency, in this example we have a low pass filter, which is established with a cutoff frequency as shown in equation 8 represented graphically in Fig.1. The negative component observed is due to the fact that the Fourier transform is symmetric around 0, however, in practice the frequencies are always assumed to be positive.
a) Answer of b) Rectangular window  The coefficients are generated in a plain text file, which is incorporated into the controller through a routine (as shown in Algorithm 1). This routine is responsible for taking samples of the signal to be filtered using the digital analog converter of the controller with the frequency established during the design. When sampling the signal, each sample is stored inside a memory, whose quantity is determined by the order of the filter and each of them is multiplied by the coefficients mentioned above.  . 5 shows the architecture used in the microcontroller to perform the filter function. As seen there is an analog to digital converter and its complement that are responsible for filtering and modulating the input and output information. The PWM function is responsible for establishing the sampling time used by the converters to reconstruct the signal.

IV. EXPERIMENTAL RESULTS
The methodology shown to implement a FIR filter in PSOC 5LP was tested by implementing several filter schemes. The coefficients of the low-pass, high-pass, band-pass and eliminated-band filters were determined, whose resulting transfer function was simulated before being implemented in the controller and the results obtained are shown in Tables I and II. To measure the results, an oscilloscope was connected to the output of a signal generator, which is connected in parallel to the input of the microcontroller and the output of the controller is connected to another channel of the oscilloscope.
The low-pass and high-pass filters were designed at a cutoff frequency of 4 KHz and the signal is sampled at 48 KHz. Band-pass and band-eliminated filters were designed at cutoff frequencies at 2 KHz and 6 KHz. The test signal varies in frequency from 2 to 4 KHz and has an amplitude of 1 V. The order of the filters implemented is 50 for low-pass and high-pass filters and 100 for band-pass and bandelimination filters, since when performing experimental tests with a lower order the filter did not work properly. In such a way, this was the lowest order obtained with the strategy proposed in this paper, to design FIR architecture filters.

Freq
ACKNOWLEDGMENT This work was supported by the Universidad Distrital Francisco José de Caldas Technological Faculty. The views expressed in this paper are not necessarily endorsed by District University. The authors thank the research group ARMOS for the evaluation carried out on prototypes of ideas and strategies