Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: How to utilise digital filter for raw adc data

  1. #1
    Junior Member
    Join Date
    Nov 2019
    Posts
    2

    How to utilise digital filter for raw adc data

    i have raw adc data for teensy 3.6.i want to apply filter(ex. Biquad filter) and after that want to print filtered data to serial monitor port.is there any way because audio library is directly taking reading from adc and there is no option to send filtered data on serial port

  2. #2
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    505
    Have a look at the "record queue"-object, which allows you to send realtime audio data from an input (eg. the internal ADC) to the queue object.

    You will find an example how to use this object in Audio->examples-> Recorder [instead of recording the data onto an SD card, you can simply take the data and print it out on the Serial Monitor for your purpose]

  3. #3
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,236
    Do you need the audio library at all? Since you've started with the audio library, we can assume the frequency you're interested in is not too high. You could just take raw analog readings every so-many micro-seconds and implement the transfer function directly...
    Code:
    inline float Biquad::process(float in) { // direct form II transfer function example (I think)
        double out = in * a0 + z1;
        z1 = in * a1 + z2 - b1 * out;
        z2 = in * a2 - b2 * out;
        return out;
    }
    Assuming it's a static filter and you can get the coefficients sorted; otherwise there are libraries like the one it nicked this transfer function code from that will do that for you too if you need to process conventional filter parameters.

    But what do you mean by filtered data? A time series? At what rate and why on the serial port?

    Being a bit more explicit about the problem you're solving might get you better advice (and from better sources than me!).

  4. #4
    Junior Member
    Join Date
    Nov 2019
    Posts
    2
    on teensy 3.6 board on pin A22 i have analogue signal input,i want to filter this signal(16666hz + noise) to remove noise and want to use output filter data(signal) to derive data.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •