Provided below is custom component (MedianFilter v0.0) for filtering streamed data.
The MedianFilter component implements Phil Extrom’s sliding window median algorithm for scalar data. Sampled signals with few amounts of erroneous data can be effectively de-noised using this filter. Component doesn’t consume hardware resources, performing all operations by CPU, which is useful for systems with little resources, such as PoC4. The filter is non-decimating, producing the output on every sample added. Multiple instances of the component can be added to the project for processing independent signal streams.
-Data range: int8, int16, int32, uint8, uint16, uint32
-Has fixed execution time
-Grows linear with size
The component was tested using CY8CKIT-059 PSoC5 prototyping kit and CY8CKIT-042 PSoC4 Pioneer Kit. Demo projects are provided.
Attached archive contains component library, component datasheet and demo projects for PSoC5 and PSoC4. Please read installation instructions in the readme.txt.
The component provided as-is, no liabilities. It is free to use and modify.
P.S. Demo projects use optional annotation components (which are also provided here in Support_libs.zip):
PSoC Annotation Library: PSoC Annotation Library v1.0
KIT-042 annotation stub: KIT-042: annotation component for CY8CKIT-042 Pioneer Kit
SerialPlot library: SerialPlot: interface to real-time data charts
SerialPlot open source charting tool for Linux/Windows can be downloaded here
SerialPlot charting SW: SerialPlot – Realtime Plotting Software for UART/Serial Port
Download SerialPlot: Hackaday.io: SerialPlot - Realtime Plotting Software
Figure 1. PSoC5 demo project schematic.
Figure 2. Data output using SerialPlot charting software. Black - signal w/o noise, Green - signal with disturbance, Red - FIR output, Blue - median filter output (recovered signal).
Figure 3. Project annotation using PSoC Annotation Library.
PSoC 345 LP
- community component
- custom component
- median filter
- serial plot