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

Thread: Teensy 3.6 to try to hear osteoarthritis

  1. #1
    Banned
    Join Date
    Mar 2019
    Location
    Cardiff, UK
    Posts
    5

    Teensy 3.6 to try to hear osteoarthritis

    Hey,

    I'm in the first year of my PhD, I've got a couple of Teensy 3.6 and am looking at taking an analog input of ultrasound wavestreams and converting them (ADC) to be stored on an SD card for later interpretation. I'm currently trying to figure out things like sampling rate of the signal and how fast the teensy can convert ADC for storage later.
    I'm quite new to this, I've not used microcontrollers before and was hoping for some advise just about where there may be problems or what to look out for. Also any recommended reading would be greatly appreciated

    Many thanks
    Polly

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,932
    Some time ago on this forum was a thread about ultrasonic sampling for measuring sounds make by bats....

  3. #3

  4. #4

  5. #5
    Banned
    Join Date
    Mar 2019
    Location
    Cardiff, UK
    Posts
    5
    Hi both,

    Thanks, I've been looking at that project I'm trying to find out the maximum ADC speed of the teensy, do you happen to know if there is any technical specs about for the 3.6?

    Hopefully I'll be able to show if it's working soon!

    Polly

  6. #6
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,385
    It's all on the PJRC website, MCU spec sheets and reference manuals : https://www.pjrc.com/teensy/datasheets.html

  7. #7
    Banned
    Join Date
    Mar 2019
    Location
    Cardiff, UK
    Posts
    5
    So.. quick update for anyone who is following this very slow progress of mine

    Been trying to get my filtering and amplification of my signal correct.
    I am thinking about using a charge amplifier but am struggling to find the right op amp at the moment got some great help from the electronics lab here, but we were all struggling with this problem.

    Any help appreciated.

    Want a Bandpass filter so my signal is between 20kHz and 300kHz
    And amplification from +/- 10mV up to between 0 to + 3 V

    Charge amplifiers have a filter as part of the circuitry so its the balance of getting the right charge amplifier without filter the whole signal away

    Polly

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,932
    I would design this in 3 stages, at least for a first attempt. If you plan to mass produce this as a commercial product, you can always try to optimize later. Don't be shy about using more parts and not having the most optimal, lowest cost or lowest power consuming solution from the start. Optimizing makes everything so much harder. Do it the simple way first.

    I'd design this as 3 separate circuits.

    1: An amplifier with gain of 300. I'd first do this as 2 amplifiers with a gain of 17.32. Then you can use fairly ordinary opamps and the normal circuit with just 2 resistors to set the gain.

    2: A low-pass filter (with passband gain of 1) which removes the spectrum above 300 kHz.

    3: A high-pass filter (with passband gain of 1) which removes the stuff under 20 kHz.

    Build each part so it can be easily tested separately!

    For both of these filters, you can use the normal Sallen-Key circuit, probably using the same type of opamp. There are lots of website with calculator tools for these types of filters. Here's one:

    http://sim.okawa-denshi.jp/en/OPseikiLowkeisan.htm

    Scroll down to the 2nd part "Calculate the R and C values for the Sallen-Key filter at a given frequency and Q factor". I tried it just now for 20000 Hz, and it recommended 8.2K resistors and 1nF capacitors. That's probably a decent starting point.

    Here's another page with a tool for high-pass filters.

    https://daycounter.com/Filters/Salle...lculator.phtml

    One final trick you might wish to consider, is how to get the proper DC bias. If do to the high pass filter last, you can just modify this circuit slightly.

    Click image for larger version. 

Name:	Sallen-Key-HP-Filter-Schematic.gif 
Views:	3 
Size:	17.1 KB 
ID:	16205

    Instead of connecting R2 to GND, you would connect R2 to 1.65 volts. That will cause the high-pass filter to shift your filtered signal into the right voltage range for Teensy's 0-3.3V ADC to properly measure.

    The simplest way to get 1.65V is with a resistor divider, plus capacitors. I'd use 1K resistors. Two of them in series will draw 1.65 mA current when placed across the 3.3V power and GND. You will also need capacitors from the 1.65V middle point to GND. Use a 0.1uF and also a 10uF. The capacitors cause the impedance seen by the filter to be very close to zero, so you don't unintentionally add more resistance in series with R2 from the filter.


    Choosing the opamp can be tricky. You're going to need something with at least 10 to 15 MHz gain-bandwidth product, so check that spec carefully. Avoid the really low power opamps, since they usually have ~1 MHz gain-bandwidth, which isn't enough. Unless you get opamps that are rail-to-rail on both input and output (check carefully - many that say rail-to-rail are only one but not both), you'll need special power so the opamp is able to handle your desired signal range.

    As one final precaution, I'd recommend you connect a resistor between the final opamp and Teensy's ADC pin. A value in the 220 to 1K range is fine. Some opamps, especially the higher bandwidth types, can be sensitive to the switched capacitor behavior of the ADC. Adding a capacitor directly from the ADC pin to AGND also helps. Opamps love driving resistors and hate directly driving capacitors, and the ADC loves having an extra capacitor... this this arrangement gives both what they like most. Capacitors in the range of 100pF to 1nF are fine. But be careful not to use too much, since this cap and the resistor form another low-pass filter. If you use 330 ohms and 470 pF as the final parts between the opamp and Teensy, that will pass everything below 1 MHz, so your 300 kHz won't get attenuated much.

    Analog circuit design can be tough. I highly recommend building each piece as a separate unit, so you can easily troubleshoot each one. If you do testing with a signal generator and oscilloscope, remember to test with pulses or other waveforms other than a pure sine wave. Sine waves are great for testing frequency response, but filters also change the phase of your waveforms, not only the frequency. Don't make the rookie mistake of looking only at frequencies with sine waves, then later discover your filter has terrible time settling time response (or even sustained resonance) to pulses.

Posting Permissions

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