1 2 Previous Next 24 Replies Latest reply on Jul 16, 2016 10:43 AM by user_144695799

    Accessing  filter data for data viewing and analysis??

    user_144695799

      Hello,

         

          I want to access output data of filter in order to visualize the data by plotting. I have used example project ADC_Filter_DMA_Polled. Attached is the old project which I created as a case. At the input I have got a biomedical signal, which goes through filtering. I want to observe filtered signal in digital domain by plotting it. If I convert it in analog domain and then observe then I am not getting expected result. May be that it adds nonlinearities of DAC. What can be the solution for this?  Can I put output of DMA to SRAM and access the data.. and how? Any guidelines??

         

      Thanks in Advance !!

        • 1. Re:  Accessing  filter data for data viewing and analysis??
          user_1377889

          Your timings do not match:

             

          WaveDAC delivers a 1kHz sine, SAR converts controlled by PWM at ~1kHz, but should be quite more (Nyquist). Your Filter expects 0.5kHz.

             

          I would suggest you to use a frequency of at least 10kHz, change PWM and filter accordingly.

             

          You can easily use a second DMA that transfers to a ram-area, maximum size are 4095 bytes with one burst.

             

           

             

          Bob

          • 2. Re:  Accessing  filter data for data viewing and analysis??
            user_144695799

            Thanks Bob for your time. I have configured 50 Hz notch filter. If I change the filter sample rate, it does not give appropriate response, the notch disappears, rather attenuation decreases. Hence I had seleted such settings. Morover in order to test if filter passes all other frequencies than 50 Hz, I had set 1 KHz at waveform generator. Anyway I will try DMA with SRAM as well. 

            • 3. Re:  Accessing  filter data for data viewing and analysis??
              user_1377889

              I was wrong with the filter settings. Try those on the picture.

                 

               

                 

              Bob

              • 4. Re:  Accessing  filter data for data viewing and analysis??
                user_144695799

                Thanks Bob. It has solved my notch filter problem. I am getting nice frequency response. However when I add one more filter stage, Band pass filter with Biquad, it is not giving appropriate response. If I add FIR stage for bandpass, I am getting response shown in figure attached. Should I add filter gain ?? How does it affect the performance of filter?

                • 5. Re:  Accessing  filter data for data viewing and analysis??
                  user_1377889

                  "Should I add filter gain ??" As I understand: just the other way, you have to reduce the gain, so that there will be no internal overflows possible. This of course reduces the peak-to-peak output of the filter. Check for your prerequisites of the project if you really need a filter that steep. Maybe a filter with a 20db attenuation would be quite sufficient and 140db is quite a bit too much.

                     

                   

                     

                  Bob

                  • 6. Re:  Accessing  filter data for data viewing and analysis??
                    user_144695799

                    In my case, signal is in the range of 0.5 Hz to 150 Hz. Hence I want a notch filter to remove power line noise and bandpass filter to pass frequencies of interest. If I configure filter as Biquad, it is adding high ripples and the filtered signal I get is distorted. The problem is if I increase sampling frequency, frequency response is getting worst and if I decrease sampling frequency, time response i.e. step response is getting worst. I tried various combinations, however no suitable settings with acceptable frequency and time response. I think, I will have to implement opamp based filters instead of digital filter. Any suggestions on this??

                    • 7. Re:  Accessing  filter data for data viewing and analysis??
                      user_1377889

                      Wouldn't be that enough?

                         

                      Do not forget to increase the ADC conversion rate to 10ksps

                         

                       

                         

                      Bob

                      • 8. Re:  Accessing  filter data for data viewing and analysis??
                        user_144695799

                        Thanks Bob. I tried these settings, however no improvements found. My signal of interest is very low amplitude and low frequency, so step response is badly affecting temporal features of the signal. Frequency response is excellent but step response not good. If I go for FIR filter, reverse is the case, good time response but frequency response is poor so lot of interference in output signal. How to achieve both is the question..

                        • 9. Re:  Accessing  filter data for data viewing and analysis??
                          user_144695799

                          Is it possible to use multiple filter blocks ? If yes, how may ?? Any example regarding this?? 

                          • 10. Re:  Accessing  filter data for data viewing and analysis??
                            user_1377889

                            The filter block is hardware within the PsoC. So you can only use one 2-channel filter.

                               

                             

                               

                            Bob

                            • 11. Re:  Accessing  filter data for data viewing and analysis??
                              user_302397898

                              RE: "Should I add filter gain?" The error message you get on the screenshot you submitted is simply that each filter stage offers unity gain. So with two stages you get twice the gain and you are up by 6db for the two stages. You do not need to increase the analog input gain. Instead, reduce each filter stage's gain to -3db and they sum up to 0db output or unity gain. You will not be cheated in the end.
                              Stay with digital filtering. If you set your parameters right, digital filters offer greater precision than analog filters with their component tolerances and temperature dependence.
                              I offer two questions to consider. Does your analysis have to be done in real time? If not, I could suggest parameter calculations you could do in C code in your MCU, including Chebyshev or stacked moving average filters. The parameters will be expressed as a fraction of bandwidth.
                              Another question is what biological processes you are measuring. Are you actually measuring pulses of higher frequencies or do you just need to measure heart beat amplitude and rate or similar amplitude bursts? Perhaps you could eliminate the filter and just use a timer to measure the time between certain threshholds above a certain amplitude. Then you could use a potentiometer or a touchsense to adjust the threshold in real time.

                              • 12. Re:  Accessing  filter data for data viewing and analysis??
                                user_144695799

                                Thanks for your suggestions and concern !! 

                                   

                                <<Does your analysis have to be done in real time?  

                                   

                                well.. yes, I am measuring Electrocardiogram in real time. I want to monitor this signal continuously or frequently. I have plans for signal processing as well in future.

                                   

                                But right now focusing on clear signal that can be reliable for primary/basic diagnosis. That is the reason I can not compromise on signal in time domain.

                                   

                                Further it is small in amplitude and low frequency.

                                   

                                I have got good results with discrete component circuit and now trying for single chip solution.

                                   

                                I must say PSoC digital filter responses are actually replicated in filtered signal. Thus you can rely on it as long as you get expected response with component settings.

                                   

                                However as I mentioned earlier I want time as well as frequency response at  acceptable level. I basically need 3 filters. LPF for 150 Hz, HPF at 0.05 Hz and Notch at 50 Hz. So I used, compound filter as given earlier. I am not able to find suitable solution. 

                                   

                                I think if I can have one digital filter in MCU and rest in DFB .. may be can solve it. Since I get good frequency and time response for Notch and LPF combo. Will it be sensible option?? Am I missing out anything? Pl. suggest..

                                • 13. Re:  Accessing  filter data for data viewing and analysis??
                                  user_302397898

                                  Are you being too strict in your filter requirements? "HPF at 0.05Hz" or I think you said earlier 0.5Hz. Either way, most transducers can't output a signal frequency that low. I'm just asking.
                                  As for the notch filter, I referred to "The Scientist and Engineer's Guide to Digital Signal Processing" by Steven W. Smith. In Chapter 19 he states that the narrowest notch bandwidth (0.707 amplitude) that can be obtained with single precision is 0.00003 of the sample frequency. Pushed beyond this limit, attenuation degrades.

                                  • 14. Re:  Accessing  filter data for data viewing and analysis??
                                    user_302397898

                                    Re: "I think if I can have one digital filter in MCU and rest in DFB .. may be can solve it." If you put your third filter in the MCU your main{} program is going to have to process this while real time data is coming in. Your DFB will continue to accept data until its Transaction Discriptors buffers are full. You can have multiple TDs but as Bob said, each is limited to 4095 bytes -- preferably a multiple of 16 spoke width. When the TDs are full, you would have to handle the interrupt and process your third filter in the MCU and send to your output device. Meanwhile you would be losing real time data until you restarted your filters in the DFB. If I'm wrong, someone please correct me.

                                    1 2 Previous Next