SSZTAA3 april 2017 MSP430FR5994
Modern day life demands smarter sensors which provide more accurate data about an event that we want to both detect and measure with ultra-low power consumption.
In this series, I will discuss some smart sensing applications and how to use TI’s MSP430™ microcontroller (MCU) as a platform for implementing them. The first smart sensor I would like to discuss is a glass break detector.
A glass break detector is a sensor used in building automation security systems. It generates an alarm when a pane of glass is shattered or broken. The sensors are commonly installed near glass doors or glass storefront windows.
Glass break detectors have been around for many years. They usually use a microphone to monitor noise or vibrations coming from the glass. Simpler detectors merely monitor the sound in those frequencies typical of glass shattering and trigger an alarm when the sound level is above a certain threshold. A high false-alarm rate is the main complaint with this kind of system.
More complex designs monitor the sound with glass-break sound profiles.
Examining the physics of glass breaking reveals a process. First, when an object strikes the glass, the relatively dull, low-frequency sound of a flex wave emanates from the point of breakage, traveling outward, followed by a high-frequency sound. If implemented properly, checking the microphone output with a sound profile reflective of this process can greatly reduce false alarm rates.
Due to the limitations of cost and the computing power, most “smart” glass break detectors on the market today use digital or analog filtering to check the signal at only two or three fixed frequencies. In the products’ user’s guides, you will find limitations of glass size and type, because the signal frequencies in a glass-breaking process vary with the type, size of the glass and position of the detector
Pushing the performance of glass break detectors to the next level requires a “glass-independent” glass break detector. This smart glass break detector will be able to extract important signatures from glass breaking sound to make decisions. Those signatures will not be limited to the type and size of the glass – they should work similarly to a “speaker-independent” speech detector. Figure 1 is a conceptual system block diagram of a smart glass detector.
In the block diagram, the microphone picks up the sound from the window/glass. The analog voltage output from the microphone passes through an anti-aliasing amplifier for proper sampling by the analog-to-digital converter (ADC). The function of the ADC is to convert the analog voltage to a digital stream for processing by the microcontroller or digital signal processor (DSP). Typically, the ADC is an on-chip peripheral on the microcontroller. A timer triggers the start of analog-to-digital conversion. The analog-to-digital sample frequency needs to be at least twice that of the highest signal frequency of interest (Nyquist’s Law).
The frequency spectrum of the glass breaking sound is time-variant. In order to examine how the spectrum changes over time, the microphone data is divided into short periods, and a Fast Fourier Transform (FFT) algorithm calculates a spectrum for each short period. This short period needs to be long enough to cover the lowest frequency of interest. Figure 2 illustrates the output of the short-time FFT over time.
The pattern-recognition algorithm examines the spectrum and change over time to determine if a glass breaking event is happening. When computing power is available, the pattern-recognition algorithm can check the complete range of frequency of interest instead of two to three fixed frequency components.
Figure 1 includes three outputs:
There are two key signal-processing functions: short-time FFT and pattern recognition. They have to be complete within the scheduled time.
The following example shows the processing requirements and how you can meet the requirements with a MSP430FR5994 MCU with an integrated low energy accelerator (LEA).
Assume that the frequency range of the glass breaking sound is from 30Hz to 5KHz. To meet this frequency range, set the analog-to-digital sample frequency to 12.8KHz and the period for short-time FFT to 40ms. With this setting, a 512 real-point FFT can generate a spectrum up to 6.4KHz with 25Hz resolution.
Let’s take a look at what resources are needed to calculate a 512 real-point FFT. Without the overhead of data movement and windowing, it will take about 1ms for an ARM® Cortex®-M4F CPU at 48MHz, 26ms for a Cortex-M0+ CPU at 24MHz, and 16ms for a MPS430FR5994 CPU at 16MHz. In order to complete FFT in time and leave enough resources for pattern recognition, you will have to choose a CPU running at a higher frequency, which means that the system will consume more power.
The MSP430FR5994 MCU solves this math-performance and power-consumption conflict by integrating the LEA peripheral. The LEA module speeds up the math for vector calculations such as finite impulse Response (FIR) filtering and FFT. The module runs independently from the CPU and only consumes 67µA/MHz, up to 16MHz. It takes the LEA module only about 1ms for the 512 real-point FFT when running at 16MHz. The ARM Cortex-M4F CPU can complete the task in the same amount of time, but at a frequency three times higher.
Considering the overheads of data movement and windowing, you will need an additional 0.5ms of LEA time and 0.5ms of CPU time. For each 40ms interval, 39.5ms of CPU time and 38.5 of LEA time are available for pattern recognition and other system functionalities.
With 256KB of ferroelectric random-access memory (FRAM), the MSP430FR5994 MCU offers a fast read-and-write speed that enables the accumulation of data for pattern analysis. The MSP430FR5994 MCU also has a DMA module, which can move data from peripherals such as the ADC to memory, or from memory to memory, without CPU intervention. The 12-bit ADC on the MSP430FR5994 MCU can run up to 200KSPS. It provides more than enough performance for this application.
In the next installment of this series, I will discuss the benefits of the MSP430FR5994 MCU with the LEA module in other designs such as fault indicators and smart microphones.