Forum Rule: Always post complete source code & details to reproduce any issue!
Page 21 of 22 FirstFirst ... 11 19 20 21 22 LastLast
Results 501 to 525 of 532

Thread: Bat detector

  1. #501
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,913
    Just a note that this forum is worth the price of admission with development like this! Even if you guys are a SPAM factory

    Seeing expertise in analysis to refine/improve and push out text in p#495 get a picture in #498 - that it cross references to approval from SPICE is way cool.

    I have bats around my house - would be interesting to see it in action when there is one I can assemble - put a Teensy to use and see if it can tell me how many/often and what kind.

    One got in the house one day - flying up and down my stairwell - very quick and SILENT. Sad outcome because until I saw he landed in an inverted 100W ceiling light downstairs and turned it off to get him out - he was non-living outside in the morning … and much smaller.

  2. #502
    Quote Originally Posted by pe1pwf View Post
    I was just wondering though, would it not be better to filter before amplifying?


    Edwin
    Absolutely not! The mic and preamp are going to produce noise (or stray signal, RF, etc) at frequencies above the Nyquist. Any noise or signal coming out of the preamp above the Nyquist will fold back into the passband. Folded back noise will add to the noise already in the desired passband and any folded back signals will also appear as signals in the pass band. The second order LP attenuates signal and noise at/above the Nyquist. Ideally we would use a very steep deep cut-off LP filter of 6 to 8 orders to reduce anything above Nyquist by 60-90dB, but that's a pretty complex filter. This little second order should help quite a bit. Let's wait and see how it performs with the circuit overall. The LP filter's frequency should be appropriate for the fastest sample rate. Lower SR's will require reducing the filter's frequency.

    aethertech
    Last edited by aethertech; 09-25-2019 at 02:29 AM.

  3. #503
    Member
    Join Date
    Nov 2018
    Location
    Netherlands
    Posts
    84
    aethertech

    Sorry some parts went missing... I also tried to put the part numbers back where they came from.

    I guess it should look like this...

    Click image for larger version. 

Name:	amp3.png 
Views:	20 
Size:	16.1 KB 
ID:	17706

    vcc/2 was not used anywhere else


    I guess if I do not need the low frequency sounds could use a quadopamp to use one configured as highpass filter and maybe even using the 4th as an extra stage in the lowpass filter? Or would connecting these filters to each other get me into troubles.

    Edwin

  4. #504
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,365
    Quote Originally Posted by aethertech View Post
    Absolutely not!
    Does it not depend on type of filter?
    Active filter, absolutely yes, the must be avoided, but they could be constructed with gain, right?

    But there is space for passive filtering, reducing the input C1 to about 10 nF would generate a 6dB/octave HP Filter (in the order of 1 kHz) that would suppress the LF noise somewhat and for a ultrasonic bat detector LF noise is not needed. The 1 uF value seems to be for human audio applications.

    Also your note on 6-8 order Nyquist filter may not be applicable for Sigma/Delta ADC. (SGTL500 is sigma/delta). I agree, for a SAR type ADC a 6-8th order LP filter is required.

    BTW, I have used ADA4841-2 , but now I'm using OPA2836

  5. #505
    Senior Member CorBee's Avatar
    Join Date
    Jun 2018
    Location
    Netherlands
    Posts
    258

    SGTL5000 tests part 6: REF_CTRL and harmonics

    REF_CTRL, 1st/2nd HARMONIC

    This is the final part of the analysis based on the files Edwin has collected for many different samplerates, gains and REF_CTRL settings. The graph below shows on the Y-axis
    the value in dB (input was 0.05Vpp) for the signalpeak (green) and 1st (red) and 2nd(blue) harmonics for 3 samplerates (columns), 3 gains (0,8,16) and
    all tested REF_CTRL settings. Each graph shows 3 groups of lines with equal-colours, the top-line in each group is associated with the highest gain.
    REF_CTRL settings range from 0002 on the left to 01F2(SGTL5000 default) on the right. The Y-axis has been limited to -80 to -20 dB to make the graphs easier to compare.

    Click image for larger version. 

Name:	harm192_281_352.jpg 
Views:	10 
Size:	43.1 KB 
ID:	17707
    The 2nd harmonic is for 192 and 281 always less strong than the 1st harmonic, this is however not as simple as it seems. The 2nd harmonic for a frequencysweep from 20-60 Khz covers a range from 60-180Khz. The maximum frequency that is (properly) recorded is around 0.42*SR for our setup(see earlier posts). The 192 samplerate reaches thus until 80Khz,
    the 281 until 118Khz, and for 352 its 148Khz. From this it is clear that the estimates for the 2nd harmonic are based on a rather limited sample for the 192 and 281 samplerate.


    1st HARMONIC vs NOISE
    For the 192 samplerate I also include a graph showing the "contrast" in dB between the peakvalue and the estimated noise ("silence"-section) in BLUE and between the peakvalue and the 1st harmonic in RED. The reason that I am showing this only for 192 is due to the fact that for the two other samplerates these graphs are unclear. What causes this is something I want to find out, it might be related to the problems I have stated before in estimating median noise. So for 281 and 352 I only include a graph where the contrast between peak and 1st harmonic is shown for the 3 gain levels as this estimate is only based on the part of the recording where a signal was present.

    192
    Click image for larger version. 

Name:	harm192-contrast.png 
Views:	7 
Size:	60.4 KB 
ID:	17708
    281
    Click image for larger version. 

Name:	harm281-contrast.png 
Views:	3 
Size:	52.7 KB 
ID:	17709
    352
    Click image for larger version. 

Name:	harm352-contrast.png 
Views:	5 
Size:	57.0 KB 
ID:	17710

    The graph for the 192 samplerate is thusfar the only situtation where it is very clear and based on multiple assesments that changing the REF_CTRL setting has a strong and consistent effect. Especially for a lower gain this effect is large (>20dB). When the gain increases these differences are diminished. Setting REF_CTRL lower or equal to 0132 is for this samplerate logical. For the other samplerates conclusions seem to be less clear, is samplerate 192 a "magic" setting producing less jitter in the system ??

    EDIT: I have added an attachment for samplerate 192 where for a larger group of GAINS the contrasts for peak-noise and peak-1st_harmonic is show.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	192-allcontrast.png 
Views:	9 
Size:	86.9 KB 
ID:	17711  

  6. #506
    Senior Member
    Join Date
    Oct 2015
    Location
    Vermont, USA
    Posts
    191
    Lowpass filtering at Nyquist is not nearly as important for the sigma-delta ADCs used in audio codecs (such as the Teensy Audio board). Try it for yourself...run a frequency sweep into the board, one that extends above Nyquist. You'll find a tiny bit of foldover as you cross Nyquist, but once you're 5-10% above Nyquist, you won't see any aliased signal at all.

    You might get some bleedthrough if your injected signal is way up at the MHz speed of the sigma-delta chopping rate (or whatever it's called) but there's certainly no need for a high order analog filter attempting to brickwall at Nyquist. A simple first order RC filter somewhere around Nyquist is totally adequate IMO.

    The invention of sigma-delta converters decades ago was an amazing leap. This is one of the benefits.

    Chip

  7. #507
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,365
    Quote Originally Posted by chipaudette View Post
    A simple first order RC filter somewhere around Nyquist is totally adequate IMO.
    correct. All sigma/delta ADC datasheets show a RC LP filter at in input, the values of which are tricky to be estimated. So, always best to follow the datasheet.
    As example see https://d3uzseaevmutz1.cloudfront.ne...te/an241-1.pdf

  8. #508
    Quote Originally Posted by WMXZ View Post
    correct. All sigma/delta ADC datasheets show a RC LP filter at in input, the values of which are tricky to be estimated. So, always best to follow the datasheet.
    As example see https://d3uzseaevmutz1.cloudfront.ne...te/an241-1.pdf
    WMXZ,

    All your recent posts make valid points. I have utilized and driven both SAR and sigma/delta ADC's.

    However, we do not have access to the ADC in SGTL5000, the ability to drive it, or any "real" data regarding it. Looking at the data sheets for a "proper" ADC and trying to compare any of that data to the SGTL5000 is at best a bit like "apples and oranges".

    I have looked at countless converter data sheets and quite a few codecs, but the only data I can find for the 5000 is very inadequate with regard to analog performance specs and graphs.

    At best, all we know regarding the 5000 is that there are analog mic and line inputs followed by a multiplexer feeding a gain stage that drives the ADC. Using the mic input places an additional gain stage in the signal path.

    There are very few useful analog specs given to us, with some specs very confusing at best.

    LINEIN Input Level -1.0-VRMS
    LINEIN Input Impedance (at 1.02kHz) -29-k


    LINEIN -> ADC -> I2S OUT

    SNR (-60dB input) -90-dB
    THD+N- -72-dB
    Frequency Response- 0.11-dB
    Channel Separation -80-dB

    The (-60 input) for a S/N test is strange. The frequency response spec of +/- 0.11 is a bit ambiguous, I assume it is actually frequency "flatness" and that it "maybe" covers a bandwidth that extends to the Nyquist. About the best we can glean from the provided data is that it appears to have an adequate noise spec and that THD apparently dominates the THD+N spec of -72dB (using VCC=3.3V, 48ksps, and BIAS_CTRL=-37.5%, etc). Also, the THD spec appears to be made using a test frequency of 1.04kHz. What happens at higher input frequencies, sample rates, or greater bias is but a guess without making measurements.

    Regarding the mic input, its performance is not even mentioned, is labeled as being used for voice, and inserts another performance modifying (likely more noise and distortion) gain stage in the signal path.

    Using the circuit as Edwin has recently drawn to feed the LINE input of the 5000, with no gain used within the 5000, is a good first place to start. Overall, mic self-noise will likely dominate the detector's noise spec and the 5000's inherent distortion will likely dominate the THD performance.

    Regarding low frequencies, I think you guys are making a mountain out of a mole hill. Perhaps focus on achieving the best performance at all frequencies before worrying about eliminating unwanted frequencies. It is easy enough to modify the circuit to produce a low frequency rolloff.

    aethertech
    Last edited by aethertech; 09-25-2019 at 06:44 PM.

  9. #509
    CorBee,

    Just a bit of FYI:

    When referring to distortion components, the second harmonic is at a frequency that is twice the frequency of the fundamental. The third harmonic is at a frequency that is three times the fundamental, the 4th=4X, the 5th=5X, etc.

    As an example, using a sine wave of 40kHz as our input signal, our fundamental is 40kHz, the 2nd harmonic is at 80kHz, the 3rd is at 120kHz, the 4th is at 160kHz, etc.

    The 2nd, 4th, etc, harmonics are referred to as "even" harmonics and the 3rd, 5th, etc, harmonics are referred to as "odd" harmonics.

    The expression "1st harmonic" is not typically used.

    at
    Last edited by aethertech; 09-25-2019 at 06:40 PM.

  10. #510
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,365
    Quote Originally Posted by aethertech View Post
    However, we do not have access to the ADC in SGTL5000, the ability to drive it, or any "real" data regarding it. Looking at the data sheets for a "proper" ADC and trying to compare any of that data to the SGTL5000 is at best a bit like "apples and oranges".
    I know, the datasheet of the SGTL5000 is only inviting not to use it.
    The first thing I did was to test id there is a Sigma Delta or not. By sweeping over Nyquist, it seems that there is a sigma delta, as typical aliasing is not occurring.
    Anyhow, for my application I'm not using it.
    edit: obviously using line-in.

  11. #511
    Senior Member CorBee's Avatar
    Join Date
    Jun 2018
    Location
    Netherlands
    Posts
    258
    Hi at

    When referring to distortion components, the second harmonic is at a frequency that is twice the frequency of the fundamental. The third harmonic is at a frequency that is three times the fundamental, the 4th=4X, the 5th=5X, etc.

    As an example, using a sine wave of 40kHz as our input signal, our fundamental is 40kHz, the 2nd harmonic is at 80kHz, the 3rd is at 120kHz, the 4th is at 160kHz, etc.

    The 2nd, 4th, etc, harmonics are referred to as "even" harmonics and the 3rd, 5th, etc, harmonics are referred to as "odd" harmonics.

    The expression "1st harmonic" is not typically used.
    Thanks for that info. I was simply not aware of that and after reading up on the internet I see the 1st harmonic is used as another name for the fundamental-frequency. My explanation of what was tested is unambigous I think. From now on I will try to keep myself to the standards

    regards
    Cor
    Last edited by CorBee; 09-26-2019 at 06:08 AM.

  12. #512
    Senior Member CorBee's Avatar
    Join Date
    Jun 2018
    Location
    Netherlands
    Posts
    258
    Quote Originally Posted by WMXZ View Post
    I know, the datasheet of the SGTL5000 is only inviting not to use it.
    The first thing I did was to test id there is a Sigma Delta or not. By sweeping over Nyquist, it seems that there is a sigma delta, as typical aliasing is not occurring.
    Anyhow, for my application I'm not using it.
    edit: obviously using line-in.
    When line-in will be used for tests be aware that there are quite some reports on the difference between the line-input L and R see: https://community.nxp.com/thread/467119
    It seems line-in L has cross-over talk from the MIC-IN section.

    Cor

  13. #513
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,365
    BTW
    concerning integrated active HP and amplification, I found this
    https://hackaday.io/project/8353-wor...t-bat-detector

  14. #514
    Quote Originally Posted by WMXZ View Post
    I know, the datasheet of the SGTL5000 is only inviting not to use it.
    'Twas good for a chuckle...

    Thanks for your test info.

    at

  15. #515
    Quote Originally Posted by CorBee View Post
    When line-in will be used for tests be aware that there are quite some reports on the difference between the line-input L and R see: https://community.nxp.com/thread/467119
    It seems line-in L has cross-over talk from the MIC-IN section.

    Cor
    It seems that a cap between mic in and mic gnd is a possible solution. I would think setting mic gain to minimum might also be helpful. Also, it appears that it is not so much noise (a non repetitive waveform/signal) as it is a fixed frequency clock, etc, leaking or folding and appears to be SR dependent. The issue could be layout or grounding related as well. Will have to see if it shows up during line input use.

    Does not the mic input feed both L and R ADC input? When you use the mic input as is currently done, which data stream do you use, L, R, L+R?

    at
    Last edited by aethertech; 09-26-2019 at 05:34 PM.

  16. #516
    Senior Member CorBee's Avatar
    Join Date
    Jun 2018
    Location
    Netherlands
    Posts
    258
    The digital stream is MONO when using MIC_IN according to me. The docs tell that we can even switch to a LEFT_ONLY mode when using MIC_IN. This is controlled in bit 6 of the CHIP_ANA_POWER register. In the current setup (at least as far as I have seen) in the routine sgtl5000.inputselect() we do not change that register when switching from LINE_IN as a source to MIC_IN. So in all modes the system is operating in a stereo mode, switching bit 6 is also only mentioned as a way to save energy.

    When using the MIC it seems likely that the MIC is connected to the LEFT channel. The output of both LINE_IN and MIC_IN will be coming out of a AudioInputI2S element that in both cases has a LEFT(0) and a RIGHT(1) channel. In the current code that uses only MIC_IN we are only using the LEFT channel.

    Cor

  17. #517
    CorBee,

    With only one mic input, I would have thought it logical for it to feed both L & R ADC inputs ( as well as both sides of the line/headphone output when fed thru).

    at

  18. #518
    Senior Member CorBee's Avatar
    Join Date
    Jun 2018
    Location
    Netherlands
    Posts
    258
    When you look at the schematic Click image for larger version. 

Name:	SN3Kn.png 
Views:	20 
Size:	82.6 KB 
ID:	17720 it is not clear.

  19. #519
    Member
    Join Date
    Nov 2018
    Location
    Netherlands
    Posts
    84
    Well, here we are again finally a bit of hobby time.

    Unfortunately it is wet and cold so no bats to play with and for testing we only have our digital pet-bat in a noisy in house environment.

    I built the amplifier as described by aetertech. (Fortunately I had some bats around when I actually tested it)

    It looks like a great amplifier, maybe the "best" one yet with lowest noise I ever buit.
    However I was not so very pleased with the results. Every noise I made myself by walking or pushing a button or whatever sound was heard like a low frequency rumble, drum beats or other sounds like that.
    Of course I also needed a high frequency sound to start the time expansion but I just love to have some kind of high pass filtering to keep the low frequencies out.


    I could notice quite a bit less noise with the aetertech amplifier on the higher frequencies, in the end this could be expected.

    Since the microphone I use has much more signal on 20Khz than 60Khz is made my amplifier so that gain was quite a bit more on 60kHz than 20Khz. So this could very well be the reason I see more more noise on higher frequencies using my old amplifier.

    The gain on the aetertech amplifier was quite a bit higher than what I had constructed, especially near 20kHz, a recording of some social call near 20Khz already showed up with quite some harmonics in Audacity.

    So I guess I have to admit I still do like the old amplifier.


    Just for fun a few recordings, this one was outdoor recording bat and passing vehicle. Unfortunately the gain settings were not exactly matched.
    I guess it is clear which one is the old amplifier and which one the aetertech circuit.
    I don't quite understand where the vertical lines come from, they seem to rise out of the low frequency sounds but probably is some noise the passing vehicle makes.

    Click image for larger version. 

Name:	a01outdoor.jpg 
Views:	7 
Size:	124.8 KB 
ID:	17840


    This recording is not a real bat, I did try to match the gain settings for the bat sounds around 40Khz.
    You can see the stronger signals on the aetertech amplifier on the lower frequencies.

    Click image for larger version. 

Name:	a01petbat.jpg 
Views:	3 
Size:	128.4 KB 
ID:	17841


    If we want the best of both worlds, we could probably try and build something like this.
    I don't know if this is something one could do but this is the amplifier, followed by a two stage low pass filter to het a steeper filtering of the unwanted higher frequencies, and at the end we have a high pass filter. I tried to find values that give about the same results as the older amplifier.

    Click image for larger version. 

Name:	a01newamp.jpg 
Views:	10 
Size:	73.9 KB 
ID:	17842

    These are te output gain curves to compare the older and newer filter. Yes, i also should have showed the same for the aetertech filter, but I did not store the circuit and it is near bedtime for me now.

    Click image for larger version. 

Name:	a01acpcomp.jpg 
Views:	9 
Size:	109.8 KB 
ID:	17843

    I hope this starts the spam factory back up.

    Edwin

  20. #520
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,365
    Quote Originally Posted by pe1pwf View Post
    However I was not so very pleased with the results. Every noise I made myself by walking or pushing a button or whatever sound was heard like a low frequency rumble, drum beats or other sounds like that.
    I would decrease the values of C1 and C5 from 1uF to 10nF, as I suggested in #504. This would suppress low frequencies that for Bat frequencies are not at all of interest.
    Play with a spice program to find the actual value of the HP cutoff frequency. I would aim for a 1-10 kHz HP corner frequency.

  21. #521
    To reduce unwanted LF signals, I would start with reducing only the feedback shunt capacitor (C3 in post 503) to somewhere in the .47uF to .22uF range. You can further reduce C3 to .1uF to .05uF if necessary. All that is really important is to ensure LF sounds do not clip the preamp output (which would produce a large amount of higher frequency harmonics in the "desired passband").

    Reducing C1 will affect noise performance, but could also be used to reduce LF performance if necessary. However, I'd try to get what is needed using only C3.

    If a steeper than -6dB/octave HP filter is deemed necessary, I would stick with a single opamp unity gain second order filter. For best performance, the only place you want gain is at the preamp. As well, a multiple section HP filter is going to introduce additional noise and distortion.

    If a HP filter is used, it should be inserted between the preamp and the LP filter.

    at
    Last edited by aethertech; 10-08-2019 at 06:04 PM.

  22. #522
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,365
    Quote Originally Posted by aethertech View Post
    Reducing C1 will affect noise performance
    mind to explain why?

  23. #523
    Quote Originally Posted by WMXZ View Post
    mind to explain why?
    A very simplistic way to look at it...

    With the input open circuit, there are several noise sources at the input that are being amplified. These include R2's Johnson noise and IC1A's input noise sources (post 503 schematic). The mic's output resistance is ca 400R. If we place an _ideal_ 400R resistor between the input and ground, that resistance will form a voltage divider with the impedances of the noise sources mentioned above which reduces the noise voltage seen at the amp's input.

    C1's reactance effectively increases the value of the 400R resistor placed across the input. Reducing C1 to .01uF will reduce gain by 6dB at 1500Hz. However, at 15KHz, a .01uF C1 would still have a reactance of around 1000R. Therefore, at 15KHz, the amp would effectively see an input impedance of 1400R which would not reduce (divide/load) the input noise sources as much as the 400R resistor would.

    C1 can be used to reduce very low frequency noise with minimal effect. However, I would tend to make C1's value no smaller than .01uF.

    Again, a very simplistic way to look at it...

    at

  24. #524
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,365
    Quote Originally Posted by aethertech View Post
    A very simplistic way to look at it...
    I see what you aiming for, reactance per se does not increase noise (it is imaginary and not real), but changes gain, so impact of real noise sources have a higher impact.
    Will have to play with that and see if that is relevant for my ultrasound application.

  25. #525
    Quote Originally Posted by WMXZ View Post
    Will have to play with that and see if that is relevant for my ultrasound application.
    What is your ultrasound application?

    at

Posting Permissions

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