Bat Detector - 96khz sample, FFT and iFFT?

Status
Not open for further replies.
This article lists two other ultrasonic noise makers: recording ultrasonic vocalisations. Though the conclusions agree with the findings here.

I've been seeing this hoping a way to detect the high freq could work - I often go 23 feet to my detached garage at all hours of the night and very earie to detect bats on the periphery against the sky. Last night my cat and I 'detected' one flying around the house. Amazing silent like a butterfly. It ended in an inverted light fixture so I could detach it and got the bat outside. Was so much smaller curled up than when adeptly flying around! He was stunned last night outside but breathing - but seems to have recovered and gone off.

Just searched and found commercial ones for €2102 and EUR 1 725 though they have a EUR 185 basic heterodyne detector
 
Hi, Just came across the following link which may or may not be of any use to you!
http://www.qsl.net/dl4yhf/spectra1.html
It is for a Audio Spectrum Analyzer software package (free but not Open Source?) which includes instructions for Bat Detection. If nothing else it has some recordings of Bat sounds that you could use for testing.
BW, Bill.
 
I've been reading through this thread with great interest...less about bats and more in terms of someone finding success with frequency domain (ie, FFT->IFFT) processing.

In my own signal processing experiments, I generally find it to be better to start by recording your audio and post-processing it. Then, once you've got your algorithms all figured out and happy, *then* you switch to trying to implement it in real-time. Getting stuff to work in real-time is always hard, even for relatively simple processing. And frequency domain processing is never simple.

Have you recorded bat sounds and tried processing it off-line?

Chip
 
I just saw this: https://hackaday.io/post/27615 posted on OSH 1/20/16

World’s Smallest Bat Detector
There are more bats around than you think!

Shows AMP circuit and this:
... I chose the Knowles SPU0410HR5H MEMS microphone. The response is a bit lumpy and likely drops off somewhat above 80kHz but it is cheap, durable and will work well for this project.
 
Hi Defragster!

What a good memory you have - this thread has been quiet for a long time (like my bat detector).

By a strange coincidence, I was discussing this project at a raspberry pi event just this weekend - considering spooling it back up again.

This link looks really interesting - the weak point on my original project was definitely the microphone!

Right now, I'm trying to get a robotic clock finished (using 28 servos controlled by a teensy) but once that's done, I think I might get back on this.

Perhaps I'll order a new microphone now and get it in stock...

Thanks,
 
Hi!

I have coded a simple heterodyne detector which you can find here (works on Teensy 3.5 / 3.6):

https://forum.pjrc.com/threads/38988-Bat-detector?p=121623&viewfull=1#post121623

Frank

Hi Franck - thanks for pointing me towards your project - I never knew you got ultrasound from jangling keys! (I'll test that later...)

I recently demonstrated my mark1 Teensy bat detector at a school STEM event and got a bit of interest.

I'm currently in the middle of working on mark 2 using a RaspberryPi (with a soundcard and a touchscreen)

I never did get a satisfactory heterodyning detector working - I might see if I can learn enough from your example to write a version compatible with my Pi. Else I'll have to add a mark 3 to the end of my project queue...

Many thanks.
 
Hi Mike,

there is a very sophisticated Raspberry PI Bat detection and recording system here:

http://www.fledermausschutz.de/forschen/fledermausrufe-aufnehmen/raspberry-pi-bat-project/

It even fulfills professional needs for bat monitoring! Maybe you would like to get in touch with them.

I would be very interested in your mark1 Teensy bat detector, is there a description/code somewhere in the web? Heterodyning is quite simple with the audio library, just an oscillator (sine object) and a multiply-object that multiplies your input mic signal and the oscillator signal. The output of the multiplier is your heterodyned audio.

Have fun!

Frank
 
Would be a waterfall-display like this be useful ?

(It's from a - until now - unpublished "extended" version of my Minimal-Teensy-Internetradio.)

Was'nt there a way to insert video here ? can't find it anymore...
Edit: Video is enabled :)

 
Last edited:
Awesome! That´s exactly what is needed for a bat detector / and is very useful for SDR radio! And I have been scratching my head for a long time how to implement that myself ;-). There is a version of a waterfall display in our mcHF SDR running in a STM32F4. Google this to see the code: df8oe mchf github

Now: - I will have another version (v0.3) of my bat detector ready tonight. It will have an additional detector for ultrasound that is not inside the heterodyne range and would otherwise go unnoticed. So, with the start of detecting, we could put samples into a buffer (say 1 sec) and then "play" that buffer in the waterfall display for lets say 10sec. The bat calls are very short (2 - 30ms), so a realtime waterfall would be nice and instructive, but to see the structure, we need to be more precise and maybe stretching the waterfall will reveal what we want ;-).
I will think more about that.

It would be very nice, if we could collaborate with the waterfall display! However, I will have to wait for the Teensy 3.6 to arrive here, the 3.5 is at its limits with 192k.

Frank
 
Maybe it works with 3.5.. the radio works good with 120MHz, and it does additional mp3-decoding (+ 4.6mBps Serial..) .. on 3.6. But i did not try on 3.5 (- less cache)

I'll post the code later this evening. Needs the std. 1024FFT.
 
OK, the FFT I use at the moment is a 256point FFT. I tried to add an additional FFT1024 to the code just now, works nicely in 96k on the Teensy 3.5 :), but no way to work properly in 176k or 192k. And also the display will be too slow if we do not use DMA, which needs the additional RAM of the Teensy 3.6. The (T3.6) mail package will arrive tomorrow . . .

Frank
 
Should work with 256FFT, too.. (try it ?)

A snippet from the radio-code:
Code:
void waterfall(void)
{ 
  static int count = 0;
  uint16_t lbuf[320];  
  if (fft1024_1.available()) {
    for (int i = 0; i < 240; i++) {
      int val = fft1024_1.read(i) * 65536.0; //v1
      //int val = fft1024_1.read(i*2, i*2+1 ) * 65536.0; //v2      
      lbuf[240-i-1] = tft.color565(
              min(255, val), //r
              (val/8>255)? 255 : val/8, //g
              ((255-val)>>1) <0? 0: (255-val)>>1 //b
             ); 
    }
    tft.writeRect(count, 16, 1, 239-16, (uint16_t*) &lbuf);
    tft.setScroll(319 - count);
    count++;
    if (count >=320) count = 0;
  }
}

Just call waterfall() in your loop() - add the 1024fft before to your code, and use tft.setRotation(3); in setup()

The idea is not mine - it was used for a "supercon-badge" (don't ask me what that is... )
I rewrote that, since it was buggy.

Edit: The scrolling does the display-hardware
 
Last edited:
Ahh.almost forgot to mention: Use the newest ILI9341-t3 lib from yesterday - it contains my fix re: the horrible flickering when scrolling!

Edit: Tried on T3.5 : Is fast enough, at least with my radio-code...
 
Last edited:
perhaps try something like this for 256-fftt:

Code:
void waterfall(void)
{ 
  static int count = 0;
  uint16_t lbuf[320];  
  if (fft1024_1.available()) {
    for (int i = 0; i < 240; i++) {
      int val = fft256_1.read(i) * 65536.0; //v1
      //int val = fft1256_1.read(i*2, i*2+1 ) * 65536.0; //v2      
      uint16_t col = tft.color565(
              min(255, val), //r
              (val/8>255)? 255 : val/8, //g
              ((255-val)>>1) <0? 0: (255-val)>>1 //b
             ); 
      lbuf[240-2*i-1] = lbuf[240-2*i] = col;
    }
    tft.writeRect(count, 16, 1, 239-16, (uint16_t*) &lbuf);
    tft.setScroll(319 - count);
    count++;
    if (count >=320) count = 0;
  }
}

..but...1024-fft looks MUCH better :)
 
Last edited:
yap, thanks! It works, but it takes all my text away that I had on my display ;-). Have to look into that.

Amazing, that such a few lines of code implement all that! Works on the Teensy 3.5 up to 96k with a 1024point FFT! Wow, thanks a lot!

Will take me some days to import that properly. is there a way to not scroll the whole screen, but leave the upper 40 pixels or so as they are?
 
Thanks!

Ahemm, I found the section "Vertical Scrolling Definition" on page 120 of 245 pages . . .

but sorry, that´s far too much for me and lightyears beyond my capabilities.

I will try to build in a switch to toggle between SPECTROGRAM and spectrum display/settings.

all the best,

Frank
 
Status
Not open for further replies.
Back
Top