Sleep apnea is a condition where people pause while breathing in their sleep; this can be of great concern for infants and premature babies. Current monitoring systems either require physical attachment to a user or may be unreliable. This project is meant to develop a device that can accurately detect breathing through sound and issue appropriate warnings upon its cessation. The device produced is meant to be a standalone device and thus was developed as an embedded systems project on a Xilinx Spartan 6 FPGA.
This project is a continuation of a project that has been ongoing in Cal Poly’s BMED department with support from Raytheon. The initial phase was to research possible methods for breath detection, that resulted in a recommendation of audio detection and CO2 monitoring. Audio monitoring was pursued with emphasis on an application inside a hospital. Such a noisy environment would require special consideration and a method to use two microphones to detect breathing and cancel out background noise by differential audio. A solution utilizing a general purpose computer was also pursued.
One of the first steps in the project’s design was a Matlab model created by Ricky Hennessy. This served as a proof of concept and a much easier platform to debug than methods used than hardware can easily provide. The program took in audio data from a microphone and detected the peaks in the signal, as seen in Figure 1 below. From the Matlab code a Simulink model was derived, the filtering portion of this code was used to produce the VHDL filter that will be discussed shortly.
A filter too complex for C to run in real time was desired but greater flexibility than a hardware filter was desired, as a compromise a VHDL filter was used. The first stage is a band pass filter for the 300 to 800 Hz range, as Figure 4 shows this is where there is clearly information sufficient to detect breathing but reduces the influence of external noise.
Microblaze is what is called a soft core processor, unlike other micro controllers it is only implemented in VHDL. This is provided by Xilinx as part of their development software as well as many other hardware components. This project utilized the basic components of Microblaze, the processor, a data, instruction and peripheral busses and a memory block for the processor. Other peripherals included: three SPI cores used to talk to the ADC and DAC; a clock divider to create the desired clocks; a timer to generate the 8 kHz interrupts; and several general purpose IO modules for the LEDs, and switches on the board.
SYSTEM INTEGRATION AND TESTING
The system was rather closely knit and thus integration was done over the course of development rather than entirely at the end. An example would be the input and output, these are related systems and can be used to verify each other. The input and output systems are also crucial to the development and testing of the VHDL filter since signals needed to be given as input and verified on an oscilloscope through the output device.
I believe this project was rather successful, it was a difficult process and development was quite a bit slower than desired but the final pro duct is rather close to the designed system. It could probably require a bit more fit and finish but the system is at least workable. An incoming signal is filtered for the desired range an envelope is created, peaks are detected and a timer is kept. Mainly the problem is in that there has been no testing on sound from actual infants and that might require a change in the VHDL filter and audio setups.
There is also a noticeable presence of false positives which is unacceptable for a final device. This is probably due to a lack of testing and calibration and could be remedied with more testing. The peak detection currently has a minimum level for peaks and this could be raised to reduce false positives but could also introduce a number of false positives and would vary depending upon audio input parameters. A maximum level could also be added to reduce the impact of sudden noises not currently being filtered out. Averaging a number of past maximums to rule out infrequent behavior would also be helpful.
Source: California Polytechnic State University
Author: Brian Berg