ASN Filter Designer supports all Arm Cortex-M demo-boards

,

Sometimes clients ask us if we support their Arm Cortex-M based demo-board of choice. The answer is simply: yes!

200+ IC vendors supported

The ASN Filter Designer has an automatic code generator for Arm Cortex-M cores, which means that we support virtually every Arm based demo-board: ST, Cypress, NXP, Analog Devices, TI, Microchip/Atmel and over 200+ other manufacturers. Our compatbility with Arm’s free CMSIS-DSP software framework removes the frustration of implementing complicated digital filters in your IoT appplication. Leaving you with code that is optimal for Cortex-M devices and that works 100% of the time.

The Arm Cortex-M family of microcontrollers are an excellent match for IoT applications. Some of the advantages include:

  • Low power and cost – essential for IoT devices
  • Microcontroller with DSP functionality all-in-one
  • Embedded hardware security functionality
  • Cortex-M4 and M7 cores with hardware floating support (enhanced microcontrollers)
  • Freely available CMSIS-DSP C library: supporting over 60 signal processing functions

Automatic code generation for Arm’s CMSIS-DSP software framework

Simply load your sensor data into the ASN Filter Designer signal analyser and perform a detailed analysis. After identifying the wanted and unwanted components of your signal, design a filter and test the performance in real-time on your test data. Export the designed design to Arm MDK, C/C++ or integrate the filter into your algorithm in another domain, such as in Matlab, Python, Scilab or Labview.

Use the tool in your RAD (rapid application development) process, by taking advantage of the automatic code generation to Arm’s CMSIS-DSP software framework, and quickly integrate the DSP filter code into your main application code.

Let the tool analyse your design, and automatically generate fully compliant code for either the M0, M0+, M3, M4 and the newer M23 and M33 Cortex cores. Deploy your design within minutes rather than hours.

Proud Arm knowledge partner

We are proud that we are an Arm knowledge partner! As an Arm DSP knowledge partner, we will be kept informed of their product roadmap and progress for the coming years.

Try it for yourself and see the benefits that the ASN Filter Designer can offer your organisation by cutting your development costs by up to 75%!

 

 

Download demo now

 

Licencing information

 

ASP vs DSP – which one do I choose for my IoT application?

,

The sensor measurement challenge

Sensors come in all type of shapes and forms…There are sensors for audio, pressure, temperature, weight, strain, light, humidity…the list is almost endless.

The challenge for most, is that many sensors used in these IoT measurement applications require filtering in order to improve the performance of the sensor’s measurement data in order to make it useful for analysis.

Before jumping into the disussion, let’s first have a look at what sensor data really is….

All sensors produce measurement data. These measurement data contain two types of components:

  • Wanted components, i.e. information what we want to know
  • Unwanted components, measurement noise, 50/60Hz powerline interference, glitches etc – what we don’t want to know

Unwanted components degrade system performance and need to be removed.

So, the challenge for every designer is first to identify what aspects of the data we want to keep, i.e. ‘the wanted components’ and what we need to filter out, the so called ‘unwanted components’. After establishing what need to be filtered out, the challenge then which domain do we tackle this problem in, i.e. the analog domain or in the digital domain ? Each domain has its pros and cons, as we will now discuss for a practical classic sensor measurement challenge using a loadcell.

Loadcell analog

A classic sensor measurement challenge using a loadcell is shown below.

Looking at the hardware setup, we see that have a loadcell excited by a DC excitation voltage, and the general idea is that the sensor’s differential bridge voltage is amplifier by the instrumentation amplifier (IA) when strain is applied.

For those of you unfamiliar with this type of technology, a loadcell is a strain measurement sensor that is comprised of 4 strain gauges, it’s also referred to as a Wheatstone bridge, hence the terminology bridge sensor.

Analysing the signals in the schematic, we see that the differential voltage is passed through 2 filters in order to remove powerline interference and reduce measurement noise.

What are the challenges?

The Instrumentation amplifier (IA) has high impedance inputs, which makes it easy to connect EMI (electromagnet interference) filters to the inputs. However, any mismatches with these filters will generally degrade the instrumentation amplifier’s common-mode rejection ratio, which is undesirable.

The instrumentation amplifier usually has a large gain (100 is quite typical), so any unwanted differential voltage on the inputs will be amplified. Looking at the filters, the notch depth of the powerline cancellation (50Hz/60Hz) filter will be dependent on component tolerances, and will vary over time and with temperature…This is problematic as we’ll discuss in the following section.

Finally, any analog filter or filters will require careful PCB layout and eat up precious board space, which is undesirable for many modern devices.

Loadcell digital – is digital any better ?

Replacing the instrumentation amplifier with a 24bit sigma-delta ADC (analog-to-digital converter), we simplify the circuitry – although many ADCs don’t tolerate high impedance at their inputs, which may be problematic for good RFI (radio frequency interference) filter design.

Nevertheless, some sigma-delta devices have an in-built 50/60Hz notch filter which simplifies the filtering requirement. Although these devices are more expensive, and the choice of sampling frequency is limited, they may be good enough for some applications.

ASP vs DSP

So, which domain is best for solving our measurement challenge, i.e. do we use analog signal processing (ASP) or digital signal processing (DSP)? In order to answer this objectively, we need to first breakdown the pros and cons of each domain.

Analog filters

Let’s first look at an implementation using ASP.

The most obvious advantage is that analog filters have excellent resolution, as there are no ‘number of bits’ to consider. Analog filters have good EMC properties as there is no clock generating noise. There are no effects of aliasing, which is certainly true for the simpler op-amps, which don’t have any fancy chopping or auto-calibration circuitry built into them, and analog designs can be cheap which is great for cost sensitive applications.

Sound great, but what’s the bad news?

Analog filters have several significant disadvantages that affect filter performance, such as component aging, temperature drift and component tolerance. Also, good performance requires good analog design skills and good PCB layout, which is hard to find in the contemporary skills market.

One big minus point is that filter’s frequency response remains fixed, i.e. a Butterworth filter will always be a Butterworth filter – any changes the frequency response would require physically changing components on the PCB – not ideal!

Digital filters

Let’s now look at an implementation using DSP.

The first impression is that a digital solution is more complicated, as seen above with the five building blocks. However, digital filters have high repeatability of characteristics, and as an example, let’s say that you want to manufacture 1000 measurement modules after optimising your filter design. With a digital solution you can be sure that the performance of your filter will be identical in all modules. This is certainly not the case with analog, as component tolerance, component aging and temperature drift mean that each module’s filter will have its own characteristics.

Digital filters are adaptive and flexible, we can design and implement a filter with any frequency response that we want, deploy it and then update the filter coefficients without changing anything on the PCB!

It’s also easy to design filters with linear phase and at very low sampling frequencies – two things that are tricky with analog.

Sound great, but what’s the bad news?

The effect of aliasing and if designing in fixed point, finite word length issues must be taken into account, including the limitation of the ADC and DAC. As there is clock source, digital designs will produce more EMI than analog filters.

Conclusion

When designing modern IoT sensor measurement applications, digital filters offer a greater degree of design flexibility and high repeatability of characteristics over their analog counterparts.

With the advent of modern processor technology and design tooling, it is estimated that about 80% of IoT smart sensor devices are currently deployed using digital devices, such as Arm’s Cortex-M family. The Arm Cortex-M4 is a very popular choice with hundreds of silicon vendors, as it offers DSP functionality traditionally found in more expensive DSPs. Implementation is further simplified by virtue of ASN’s strong partnership with Arm who together provide a rich offering of easy to use filter design tooling and a free DSP software framework (CMSIS-DSP). These tools and well documented software framework allow you to get your IoT application up and running within minutes.

Drones and DC motor control

,

 

Drones and DC motor control – How the ASN Filter Designer can save you a lot of time and effort

Drones are one of the golden nuggets in IoT. No wonder, they can play a pivotal role in congested cities and far away areas for delivery. Further, they can be a great help to give an overview of a large area or places which are difficult or dangerous to reach. However, most of the technology is still in its experimental stage.

Because drones have a lot of sensors, Advanced Solutions Nederland did some research on how drone producing companies have solved questions regarding their sensor technology, especially regarding DC motor control.

Until now: solutions developed with great difficulty

We found out that most producers spend weeks or even months on finding solutions for their sensor technology challenges. With the ASN Filter Designer, he/she could have come to a solution within days or maybe even hours. Besides, we expect that the measurement would be better too.

The biggest time coster is that until now algorithms were developed by handwork, i.e. they were developed in a lab environment and then tested in real-life. With the result of the test, the algorithm would be tweaked again until the desired results were reached. However, yet another challenge stems from the fact that a lab environment is where testing conditions are stable, so it’s very hard to make models work in real life. These steps result in rounds and rounds of ‘lab development’ and ‘real life testing’ in order to make any progress -which isn’t ideal!

How the ASN Filter Designer can help save a lot of time and effort

The ASN Filter Designer can help a lot of time in the design and testing of algorithms in the following ways:

  • Design, analyse and implement filters for drone sensor applications with real-time feedback and our powerful signal analyser.
  • Design filters for speed and positioning control for sensorless BLDC (brushless DC) motor applications.
  • Speed up deployment to Arm Cortex-M embedded processors.

 

Real-time feedback and powerful signal analyser

One of the key benefits of the ASN Filter Designer and signal analyser is that it gives real-time feedback. Once an algorithm is developed, it can easily be tested on real-life data. To analyse the real-life data, the ASN Filter Designer has a powerful signal analyser in place.

Design and analyse filters the easy way

You can easily design, analyse and implement filters for a variety of drone sensor applications, including: loadcells, strain gauges, torque, pressure, temperature, vibration, and ultrasonic sensors and assess their dynamic performance in real-time for a variety of input conditions.  With the ASN Filter Designer, you don’t have do to any coding yourself or break your head with specifications: you just have to draw the filter magnitude specification and the tool will calculate the coefficients itself.

Speed up deployment

Perform detailed time/frequency analysis on captured test datasets and fine-tune your design. Our Arm CMSIS-DSP and C/C++ code generators and software frameworks speed up deployment to a DSP, FPGA or micro-controller.

An example: designing BLDC motor control algorithms

BLDC (brushless DC) BLDC motors have found use in a variety of application areas, including: robotics, drones and cars. They have significant advantages over brushed DC motors and induction motors, such as: better speed-torque characteristics, high reliability, longer operating life, noiseless operation, and reduction of electromagnetic interference (EMI).

One advantage of BLDC motor control compared to standard DC motors is that the motor’s speed can be controlled very accurately using six-step commutation, making it a good choice for precision motion applications, such as robotics and drones.

Sensorless back-EMF and digital filtering

For most applications, monitoring of the back-EMF (back-electromotive force) signal of the unexcited phase winding is easier said than done, since it has significant noise distortion from PWM (pulse width modulation) commutation from the other energised windings. The  coupling  between  the  motor parameters, especially inductances, can induce ripple in the back-EMF signal that is synchronous with the PWM commutation.  As a consequence, this induced ripple on the back EMF signal leads to faulty commutation. Thus, the measurement challenge is how to accurately measure the zero-crossings of the back-EMF signal in the presence of PWM signals?

A standard solution is to use digital filtering, i.e. IIR, FIR or even a median (majority) filter. However, the challenge for most designers is how to find the best filter type and optimal filter specification for the motor under consideration.

The solution

The ASN Filter Designer allows engineers to work on speed and position sensorless BLDC motor control applications based on back-EMF filtering to easily experiment and see the filtering results on captured test datasets in real-time for various IIR, FIR and median (majority filtering) digital filtering schemes. The tool’s signal analyser implements a robust zero-crossings detector, allowing engineers to evaluate and fine-tune a complete sensorless BLDC control algorithm quickly and simply.

So, if you have a measurement problem, ask yourself:

Can I save time and money, and reduce the headache of design and implementation with an investment in new tooling?

Our licensing solutions start from just 125 EUR for a 3-month licence.

Find out what we can do for you, and learn more by visiting the ASN Filter Designer’s product homepage.

All-pass filter

All-pass filters

All-pass filters provide a simple way of altering/improving the phase response of an IIR without affecting its magnitude response. As such, they are commonly referred to as phase equalisers and have found particular use in digital audio applications.

In its simplest form, an All-pass  filter can be constructed from a first order transfer function, i.e.,

\( A(z)=\Large{\frac{r+z^{-1}}{1+r z^{-1}}}  \, \,  \normalsize{; r<1} \)

Analysing \(A(z)\), notice that the pole and zero lie on the real z-plane axis and that the pole at radius \(r\) has a zero at radius \(1/r\), such that the poles and zeros are reciprocals of another. This property is key to the all-pass filter concept, as we will now see by expanding the concept further to a second order all-pass filter:

\( A(z)=\Large\frac{r^2-2rcos \left( \frac{2\pi f_c}{fs}\right) z^{-1}+z^{-2}}{1-2rcos \left( \frac{2\pi f_c}{fs}\right)z^{-1}+r^2 z^{-2}} \)

Where, \(f_c\) is the centre frequency, \(r\) is radius of the poles and \(f_s\) is the sampling frequency. Notice how the numerator and denominator coefficients are arranged as a mirror image pair of one another.  The mirror image property is what gives the all-pass filter its desirable property, namely allowing the designer to alter the phase response while keeping the magnitude response constant or flat over the complete frequency spectrum.

Frequency response of all-pass filter:
Notice the constant magnitude spectrum (shown in blue).

Implementation

An All-pass filter may be implemented in ASN FilterScript as follows:

ClearH1;  // clear primary filter from cascade

interface radius = {0,2,0.01,0.5};   // radius value
interface fc = {0,fs/2,1,fs/10};     // frequency value

Main()
Num = {radius^2,-2*radius*cos(Twopi*fc/fs),1};  
Den = reverse(Num); // mirror image of Num
Gain = 1;

 

 

Download demo now

 

Licencing information

 

All-pass Peaking/Bell filter

A  Peaking or Bell filter is a type of audio equalisation filter that boosts or attenuates the magnitude of a specified set of frequencies around a centre frequency in order to perform magnitude equalisation. As seen in the plot in the below, the filter gets its name from the shape of the its magnitude spectrum (blue line) which resembles a Bell curve.

Frequency response (magnitude shown in blue, phase shown in purple) of a 2nd order Bell filter peaking at 125Hz.

All-pass filters

Central to the Bell filter is the so called All-pass filter. All-pass filters provide a simple way of altering/improving the phase response of an IIR without affecting its magnitude response. As such, they are commonly referred to as phase equalisers and have found particular use in digital audio applications.

A second order all-pass filter is defined as:

\( A(z)=\Large\frac{r^2-2rcos \left( \frac{2\pi f_c}{fs}\right) z^{-1}+z^{-2}}{1-2rcos \left( \frac{2\pi f_c}{fs}\right)z^{-1}+r^2 z^{-2}} \)

Notice how the numerator and denominator coefficients are arranged as a mirror image pair of one another.  The mirror image property is what gives the all-pass filter its desirable property, namely allowing the designer to alter the phase response while keeping the magnitude response constant or flat over the complete frequency spectrum.

A Bell filter can be constructed from the \(A(z)\) filter by the following transfer function:

\(H(z)=\Large\frac{(1+K)+A(z)(1-K)}{2}\)

After some algebraic simplication, we obtain the transfer function for the Peaking or Bell filter as:

\(H(z)=\Large{\frac{1}{2}}\left[\normalsize{(1+K)} + \underbrace{\Large\frac{k_2 + k_1(1+k_2)z^{-1}+z^{-2}}{1+k_1(1+k_2)z^{-1}+k_2 z^{-2}}}_{all-pass filter}\normalsize{(1-K)} \right] \)

  • \(K\) is used to set the gain and sign of the peak
  • \(k_1\) sets the peak centre frequency
  • \(k_2\) sets the bandwidth of the peak

Implementation

A Bell filter may easily be implemented in ASN FilterScript as follows:

ClearH1;  // clear primary filter from cascade
interface BW = {0,2,0.1,0.5}; // filter bandwidth
interface fc = {0, fs/2,fs/100,fs/4}; // peak/notch centre frequency
interface K = {0,3,0.1,0.5}; // gain/sign

Main()

k1=-cos(2*pi*fc/fs);
k2=(1-tan(BW/2))/(1+tan(BW/2));

Pz = {1,k1*(1+k2),k2}; // define denominator coefficients
Qz = {k2,k1*(1+k2),1}; // define numerator coefficients
Num = (Pz*(1+K) + Qz*(1-K))/2;
Den = Pz;
Gain = 1;

This code may now be used to design a suitable Bell filter, where the exact values of \(K, f_c\) and \(BW\) may be easily found by tweaking the interface variables and seeing the results in real-time, as described below.

Designing the filter on the fly

Central to the interactivity of the FilterScript IDE (integrated development environment) are the so called interface variables. An interface variable is simply stated: a scalar input variable that can be used modify a symbolic expression without having to re-compile the code – allowing designers to design on the fly and quickly reach an optimal solution.

As seen in the code example above, interface variables must be defined in the initialisation section of the code, and may contain constants (such as, fs and pi) and simple mathematical operators, such as multiply * and / divide. Where, adding functions to an interface variable is not supported.

An interface variable is defined as vector expression:

interface name = {minimum, maximum, step_size, default_value};

Where, all entries must be real scalars values. Vectors and complex values will not compile.

Real-time updates

All interface variables are modified via the interface variable controller GUI. After compiling the code, use the interface variable controller to tweak the interface variables values and see the effects on the transfer function. If testing on live audio, you may stream a loaded audio file and adjust the interface variables in real-time in order to hear the effects of the new settings.

 

 

Download demo now

 

Licencing information

 

FIR Comb Filter

Comb filters have found use as powerline (50/60Hz) harmonic cancellation filters in audio applications, and form the basis of so called CIC (cascaded integrator–comb) filters used for anti-aliasing in decimation (sample rate reduction), and anti-imaging in interpolation (sample rate increase) applications.

The frequency response of a comb filter consists of a series of regularly-spaced troughs, giving the appearance of a comb. As seen in the plot below, the spacing of each trough appears at either odd or even harmonics of the desired fundamental frequency.

Frequency response of a typical FIR comb filter (odd harmonics cancellation):
\(f_s=500Hz\),  \(f_c=25Hz\), \(L=10\) and \(\alpha=1\)

An FIR comb filter can be described by the following transfer function:

\(H(z)=1+\alpha z^{-L}\)
\(\Rightarrow Y(z)=X(z)\left[1+\alpha z^{-L}\right]\)

Clearly, the comb filter is simply a weighted delayed replica of itself, specifiied by \(L\). Taking inverse z-transforms, we obtain the difference equation needed for implementation,

\(y(n)=x(n)+\alpha x(n-L)\)

where, \(\alpha\) is used to set the Q (bandwidth) of the notch and may be either positive or negative depending on what type of frequency response is required. In order to elaborate on this, negative values of \(\alpha\) have their first trough at DC and their second trough at the fundamental frequency. Clearly this type of comb filter can be used to remove any DC components from a measured waveform if so required. All subsequent troughs appear at even harmonics up to and including the Nyquist frequency.

Positive values of \(\alpha\) on the other hand, only have troughs at the fundamental and odd harmonic frequencies, and as such cannot be used to remove any DC components.

Application to powerline interference cancellation

The affectivity of the comb filter is dependent on the sampling frequency, \(f_s\), as \(L\) is limited to integer values only. Also, a relationship between \(f_s\), as \(L\) and will be dependent on the sign of \(\alpha\). Thus, for the purposes of the mains cancellation application considered in this discussion, only positive values of will be considered, as we need only cancel odd harmonics.

A simple relationship for determining  \(L\) can be summarized for positive values of \(\alpha\) as follows:

\(L=ceil\left( \large{\frac{f_s}{2f_c}}\right)\)

where, \(f_c\) is the desired centre point of the fundamental notch frequency. Based on this expression, we can re-calculate the sampling frequency, such that \(f_c\) is a true multiple of \(f_s\)

\(f_{snew}=2f_c L\)

Example

For the example considered herein, i.e. \(f_s=500Hz\) and \(f_c=25Hz\), we obtain \(L=10\). However, if \(f_c=60Hz\), we would need \(L=5\), and a new sampling rate of \(600Hz\) respectively, although it’s interesting to note that \(f_s=480Hz\) for \(L=4\) would also suffice.

Implementation

An FIR comb filter may be implemented in ASN FilterScript as follows:

ClearH1;  // clear primary filter from cascade
interface L = {4,20,1,5}; // delay
interface alpha = {-1,1,0.01,1};

Main()
Num = {1,zeros(L-1),alpha}; // numerator coefficients
Den = {1};  
Gain = 1/sum(abs(Num));

 

 

Download demo now

 

Licencing information

 

Fractional Farrow Delay Filter

In signal processing, the need sometimes arises to nudge or fine-tune the sampling instants of a signal by a fraction of a sample. An FIR Farrow delay filter is typically employed to achieve this task, and may be combined with a traditional integer delay line in order to achieve a universal fractional length delay line.

A Fractional delay based on an FIR Farrow structure may be defined as:

\(H(z)=(1-\alpha)+\alpha z^{-1}; \; 0 \leq \alpha \leq 1 \)

Which produces a fractional linear delay of \(\alpha\) between 0 and 1 samples. However, a more universal building block can be achieved by combining the Farrow delay structure with an integer delay, \(\Delta\)

\(H(z)=(1-\alpha) z^{-\Delta}+\alpha z^{-(\Delta+1)}\)

The plot shown below shows the magnitude (blue) and phase (purple) spectra for \(\Delta=9, \, \alpha=0.52\). As seen, the fractional delay element results in a non-flat magnitude spectrum at higher frequencies.


Frequency reponse of Farrow delay filter.

Implementation

A Farrow delay filter may be implemented in ASN FilterScript as follows:

ClearH1;  // clear primary filter from cascade

interface alpha = {0,1,0.02,.5}; // fractional delay
interface D = {1,30,1,10};       // integer delay

Main()
Num = {zeros(D),1-alpha,alpha}; // numerator coefficients
Den = {1};                      // denominator coefficient
Gain = 1/sum(Num);              // normalise gain at DC

 

 

Download demo now

 

Licencing information

 

The moving average filter

The moving average (MA) filter is perhaps one of the most widely used FIR filters due to its conceptual simplicity and ease of implementation. As seen in the diagram below, notice that the filter doesn’t require any multiplications, just additions and a delay line, making it very suitable for many extreme low-power embedded devices with basic computational capabilities.

However, despite its simplicity, the moving average filter is optimal for reducing random noise while retaining a sharp step response, making it a versatile building block for smart sensor signal processing applications.

A moving average filter of length \(L\) for an input signal \(x(n)\) may be defined as follows:

\(y(n)=\large{\frac{1}{L}}\normalsize{\sum\limits_{k=0}^{L-1}x(n-k)}\) for \(\normalsize{n=0,1,2,3….}\)

Where, a simple rule of thumb states that the amount of noise reduction is equal to the square-root of the number of points in the average. For example, an MA of length 9 will result in a factor 3 noise reduction.

Frequency response of an MA filter of length 9. Notice the poor stopband attentuation at around -20dB.

 

Advantages

  • Most commonly used digital lowpass filter.
  • Optimal for reducing random noise while retaining a sharp step response.
  • Good smoother (time domain).
  • Unity valued filter coefficients, no MAC (multiply and accumulate) operations required.
  • Conceptually simple to implement.

Disadvantages

  • Inflexible frequency response: nudging a conjugate zero pair results in non-unity coefficients.
  • Poor lowpass filter (frequency domain): slow roll-off and terrible stopband attenuation characteristics.

Implementation

The MA filter may be implemented in ASN FilterScript as follows:

ClearH1;  // clear primary filter from cascade

Main()
Hd=movaver(8,"symbolic");  // design a MA of length 8
Num = getnum(Hd);   // define numerator coefficients
Den = {1};          // define denominator coefficients
Gain = getgain(Hd); // define gain

Further reading

  • Understanding Digital Signal Processing, Chapter 5, R. G. Lyons
  • The Scientist and Engineer’s Guide to Digital Signal Processing, Chapter 15, Steven W. Smith

 

 

Download demo now

 

Licencing information