So far, we have developed the serial communication driver in C and built an IR motion detection application. In order to improve the performance (that is, reduce false alarms), we made use of the advanced feature of the IR sensor and integrated a data-processing algorithm developed in MATLAB into the application.
If you prefer a Simulink development environment, you can follow the section Writing a Simulink device driver block for BeagleBoard discussed in the previous chapter to integrate these C driver code into a Simulink S-Function block for graphical programming. As a result, you will get a serial communication driver block for BeagleBoard in Simulink.
As you can see in the filtering algorithm for reducing false alarms, we have to wait for five readings and then calculate their average in a batch off-line mode. For a better computation efficiency and shorter response time, the algorithm can be improved by using a moving average filter that calculates the mean in a recursive...