Author Topic: Want to hear the bat flying in the front yard  (Read 27420 times)

0 Members and 1 Guest are viewing this topic.

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Want to hear the bat flying in the front yard
« on: August 02, 2021, 12:02:13 pm »
A bat keeps flying almost every night above a certain piece of green yard, right in front of the building, at about the same level with the balcony, so quite close (no more than 10-30 meters, or 30-100 feet in straight line).  The drawback is this is inside the city, so during the night it might be more noise pollution than in the wilderness.

Would like to DIY an ultrasonic receiver, only for the fun of it, so without buying a dedicated ultrasound microphone.  Already having around:

- a few analog electret microphones, mostly from former mobile phones or former headsets
- about 10 of HC-SR04 ultrasonic sensors that can be used as donors for microphones, or even for a directional array
- some piezo discs from singing postcards and toys
- a very old ultrasonic-remote receiver board from an old TV (don't know the model)

Mostly concerned about the available signal to noise ratio (inside a city) and the expected power levels (if there is any hope such microphones would be sensitive enough).  The frequency range is said to be between 20kHz-160kHz, but mostly the signals would be expected to be around 50KHz or so.

Any chances to receive the bat's echolocation signals with microphones like the ones in the list?

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #1 on: August 02, 2021, 12:25:52 pm »
I believe electrect microphones are the best.

Piezo discs from greetings cards have a resonant spike at around 30kHz and the HC-SR04 and old remote controls have a peak at 40kHz.

Do you plan to record the sound, or down convert it to the audiable range? Either way you'll need to high pass filter it at 20kHz, or whatever the lowest frequency of interest is. Down conversion can be done the old fashioned way, by heterodynining, or digital signal processing.

 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #2 on: August 02, 2021, 02:38:36 pm »
From wikipedia it appears to be many types of receivers for bat sounds: https://en.wikipedia.org/wiki/Bat_detector

- heterodyne/superheterodyne (local osc mixed with the Rx signal, so all analog)
- frequency division (amplify to square wave, then use a digital counter/divider to shift down the frequency)
- time expansion (high speed digital sampling and recording then playback the recorder samples but slower, so no real time audio)

Not sure yet how to post process the signal.

At first it would be great only to test if any signal at all can be received, so just the ultrasound mic and an analog amplifier in the 12kHz ... 160 kHz band.

Can test these two in the field, with a DS202 hendheld oscilloscope to see if anything at all can be received.  The DS202 mini oscilloscope has 1MHz analog input band with 1Mohm impedance input, min 20mV/div, max 10MSa/s (also has a signal generator output, 10Hz~1MHz square wave duty adjustable or 10Hz~20Khz Sine/Square/Triangle/Sawtooth wave, might be usable as a local oscillator to improvise a heterodyne but I don't have any connector that fits).

Good point about sensor resonances, thanks!   :-+
(could test for that in the lab at first, to eliminate the worst candidates)

Offline nali

  • Frequent Contributor
  • **
  • Posts: 735
  • Country: gb
Re: Want to hear the bat flying in the front yard
« Reply #3 on: August 02, 2021, 06:02:15 pm »
I know you didn't want to buy another microphone, but just to say you can get MEMS mics pretty cheap now, including on carrier PCBs e.g. eBay auction: #114874902126

There are also some homebrew projects already out there:

Rasp Pi http://pibat.afraidofsunlight.co.uk/
Teensy https://www.teensybat.com/

 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #4 on: August 02, 2021, 08:01:18 pm »
Somebody else PM-ed about a MEMS microphone, too, https://www.digikey.com/en/products/detail/pui-audio-inc/AMM-3742-T-WP-R/14289962 with very good response around 50kHz and above, indeed, but I don't think I have any analog MEMS based mikes.

Might be a few MEMS mikes through the scraped parts boxes, but AFAIK those were with digital output only, and not sure if their sampling rate would be high enough to record at 50kHz or more.  Never tested any of those digital MEMS microphones.  Should look for some analog MEMS microphones, but not sure if I have any.

Tested today some miniature speakers and the piezo discs from singing post cards.  Nothing promising so far.  The speakers doesn't play well at more than a few kHz, and the piezo disks have some strong resonance peak at approx. 7kHz and multiples, but above 30kHz couldn't get any signal with them.   ???

Searching the scrap boxes for electret microphones now.  Would search for any MEMS mikes, too.

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #5 on: August 03, 2021, 07:45:41 am »
Somebody else PM-ed about a MEMS microphone, too, https://www.digikey.com/en/products/detail/pui-audio-inc/AMM-3742-T-WP-R/14289962 with very good response around 50kHz and above, indeed, but I don't think I have any analog MEMS based mikes.

Might be a few MEMS mikes through the scraped parts boxes, but AFAIK those were with digital output only, and not sure if their sampling rate would be high enough to record at 50kHz or more.  Never tested any of those digital MEMS microphones.  Should look for some analog MEMS microphones, but not sure if I have any.

Tested today some miniature speakers and the piezo discs from singing post cards.  Nothing promising so far.  The speakers doesn't play well at more than a few kHz, and the piezo disks have some strong resonance peak at approx. 7kHz and multiples, but above 30kHz couldn't get any signal with them.   ???

Searching the scrap boxes for electret microphones now.  Would search for any MEMS mikes, too.
It looks like a MEMS microphone is the way to go.

Regarding the piezo disc: the resonant peak is very sharp, so I wouldn't recommend it anyway. I'll have to test some piezo discs I have at the moment. It was awhile ago, when I did it, so it might have just been lucky with the ones I had back then.
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #6 on: August 03, 2021, 08:46:27 am »
About the piezo discs, mine are much bigger than the average piezo discs we see nowadays.  The ones I tested are 5cm (2 inch) in diameter, and the setup wasn't very careful (for example the audio amplitude can vary a lot by simply putting a little tension on the disks (bending them a little from the sides), etc.

I'm using them now only as a piezo speaker, to evaluate other (electret for now) mikes.

So far i seems like an electret mike would do it, and the size does matter again.  The ones of about 5mm in diameter are doing much better than the 8mm ones (when it's coming to ~50kHz or higher).

Last night found a 5mm electret mike that can go up to 110kHz (with the same big piezo disks to generate the testing ultrasounds  :-// ) only to realize later that the signal I was seeing on the oscilloscope was caused by induction (radio) and not by ultrasounds.   ;D

I need a much careful measuring setup.
Couldn't see any bats last night.

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #7 on: August 03, 2021, 10:48:57 am »
If the piezo disc isn't a very good microphone, at ultrasonic frequencies, then it will also be a poor speaker. How do you know it's producing any ultrasound?
 

Online nfmax

  • Super Contributor
  • ***
  • Posts: 1624
  • Country: gb
Re: Want to hear the bat flying in the front yard
« Reply #8 on: August 03, 2021, 01:49:46 pm »
A good way to generate ultrasound, so I am told, is to jingle a bunch of keys in front of the sensor
 

Offline Gary350z

  • Regular Contributor
  • *
  • Posts: 241
  • Country: us
Re: Want to hear the bat flying in the front yard
« Reply #9 on: August 03, 2021, 07:56:24 pm »
A good way to generate ultrasound, so I am told, is to jingle a bunch of keys in front of the sensor

I have done this. It makes ultrasonic receivers go crazy.
 

Offline nali

  • Frequent Contributor
  • **
  • Posts: 735
  • Country: gb
Re: Want to hear the bat flying in the front yard
« Reply #10 on: August 03, 2021, 08:10:46 pm »
You'll be suprised what generates ultrasound - a biscuit or crisp packet is also pretty good.

I do have a cheap-ish hetrodyne bat detector which my wife bought me as a birthday present. I went for a walk with it one night but couldn't work out what the "chink chink chink" sound was that I could hear in my headphones. As it turned out it was the small metal tab of the zip on my jacket tapping against the zip's metal teeth.

The detector unit itself is OK but noisy as hell, it's like a small radio with no antenna. It's one of my "maybe one day" projects to make something a bit better.
 

Offline Gyro

  • Super Contributor
  • ***
  • Posts: 10195
  • Country: gb
Re: Want to hear the bat flying in the front yard
« Reply #11 on: August 03, 2021, 08:23:41 pm »
A good way to generate ultrasound, so I am told, is to jingle a bunch of keys in front of the sensor

Even simpler, rub your thumb and fingertip together. The ridges riding over each other produce abundant ultrasound without all the loud audible jangling that you get with keys.
Best Regards, Chris
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #12 on: August 04, 2021, 05:29:21 pm »
If the piezo disc isn't a very good microphone, at ultrasonic frequencies, then it will also be a poor speaker. How do you know it's producing any ultrasound?

The piezo disc might work better with a high impedance input preamplifier than with the 1M\$\Omega\$/13pF of the oscilloscope input.  I was using the probe in 1x mode to get the max sensitivity of 500uV/div from the scope.

To see if what's seen on the oscilloscope is indeed the ultrasounds and not just induction from wires it's enough to block the space between Tx and Rx with a piece of foam.  Also, when the distance changes, for example by slowly moving the Tx back and forth, the phase shift can be seen on the oscilloscope.

It's funny to observe the ultrasounds' wavelength by slowly moving the piezo disc back and forth while watching on the oscilloscope how the reference sine wave from the generator and the received sound slides with the move.   :)




The non-repetitive ultrasound sources are hard to measure without a preamplifier.  For now I am doing the lock-in amplifier trick with the oscilloscope (synchronous detection + averaging) so signals as small as tens of \$\mu V\$ coming directly from the sensor can be easily observed.

I didn't make any preamplifier yet because I was not sure which type of sensor will work better with ultrasounds.  So far the winners seem to be electret microphones scavenged from decade old mobile phones.  The smaller diameter ones are the best.

The only MEMS mikes I have are from very recent phones, so it is expected that they'll have local preamplifiers integrated with the MEMS, and they will be limited to the audio only band, if not voice only.

Looking through the opamps stash, I found only lame generic opamps 741-like, needing at least 10V supply to run and with a slew-rate that is too small for 160kHz.  So, to make the specs for a preamplifier opamp:
  • - working at a supply voltage of 3V or lower, so it can run from a single cell Li-ion battery, 3...4.2V, without any voltage step-up converters

  • - able to output 3Vpp at 160kHz.  This is rare with general purpose opamps because of the slew-rate needed to output a sinusoidal signal of, let's say, 3Vpp at 160kHz.

    (Trying some \$LaTeX\$ on EEVblog, to show (off) the finding of required slew-rate for such a signal)   :P
    The instantaneous voltage \$v_i\$ at any moment \$t\$ is given by the generic formula of the \$harmonic\ oscillator\$:
    \[
    v_i(t) = A_0 \cos(2 \pi f t + \phi_0)  \tag{1}  \label{eq:n1}
    \]
    where \$A_0\$ is the \$amplitude\$ of the signal, \$f\$ is the \$frequency\$, \$\phi_0\$ is the \$phase\$, and \$t\$ is the \$time\$.  The phase doesn't matter in regard to the maximum slew-rate.  Thus, \$\eqref{eq:n1}\$ becomes:
    \[
    v_i(t) = A_0 \cos(2 \pi f t)  \tag{2}  \label{eq:n2}
    \]
    By definition, the first derivative corresponds to the slope, or the slew-rate in opamp language.  To find the max slope for the signal means to find the max of the derivative of \$\eqref{eq:n2}\$, which derivative is:
    \[
    v'_i(t) = A_0 2 \pi f (- \sin(2 \pi f t))  \tag{3}  \label{eq:n3}
    \]
    Since any \$\sin(x)\$ is bounded between -1 and 1, the max slope, or slew-rate, \$SR_{max}\$ of the signal is:
    \[
    SR_{max} = \left|v'\right|_{max} = A_0 2 \pi f  \tag{4}  \label{eq:n4}
    \]
    Plugging the numbers in \$\eqref{eq:n4}\$:
    \[
    SR_{max} = 1.5V \cdot 2 \cdot 3.14 \cdot 160kHz = 1.507\ V/\mu s
    \]
    so the opamp should have a slew rate of at least \$1.5\ V/\mu s\$.

  • - be available at hand.  With such specs, I could find so far only comparators through the scrap boxes:
       - LM393 - dual comparator, open collector, min supply 2V
       - TCA520 - opamp/comparator, TTL output compatible (so good current sinking but low current when sourcing), min supply 2V, SR max 25V/us




- Anybody tried using LM393 or TCA520 as amplifier?
- Is there any chance to make them stable, or better just make a preamplifier with discrete transistors?
« Last Edit: August 04, 2021, 07:09:08 pm by RoGeorge »
 

Online magic

  • Super Contributor
  • ***
  • Posts: 7486
  • Country: pl
Re: Want to hear the bat flying in the front yard
« Reply #13 on: August 04, 2021, 08:19:33 pm »
4. Gain bandwidth product ;)

Old 5534 would work and provide a bit of gain (60MHz GBW) but not at 3V.
AD8397 is a viable alternative for 3V rail to rail operation but not as cheap.
There are some older National LMHxxxx parts, bipolar and low voltage, but they could be noisier - not sure what the requirements are with those mics.
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 15173
  • Country: de
Re: Want to hear the bat flying in the front yard
« Reply #14 on: August 04, 2021, 08:34:28 pm »
The ultrsound transducers SR04 are not good as a microphone, because they are very resonant. But they should be good for a US test source to than check the electret mics.  Some of the small electret mics work surprisingly well. As the university I had one (sennheiser 4.8 mm diameter) that showed response to 100 kHz (limit of the Lockin used for detection). However not all are suiteable: often there is an internal capacitor to reduce the higher frequency response to get a flatter curve. Otherwise the internal resonance makes the gain go up at the higher audio band. I would mainly check the mics < 5 or 6  mm. The larger one usually don't work as the self resonance of the membrane is to low and thus the low pass filtering needed.

The phase shift from a changing distance is quite indicative for having US and not electric coupling.

The LM393 has a chance to also work as amplifier, at least with high gain (e.g. G > 10). Definitely only use 1 channel and have bias curent / resistor at the output and little capacitve load to the output (relatively high ouput impedance).

 A discrete transistor amplifier is likely easier and more predictable and also lower noise. At higher frequency the signal from the mic may be quite small, but the noise gets also often quite low.

Chances are the LM393 could be higher noise (e.g. similar to LM358) than the microphone at higher frequencies (e.g. 10 kHz). I would expec a noise level of some 10-20 nV/sqrt(Hz) at 10 kHz for the electret mic, with mainly an 1/f  increase to lower frequency. So no need to go super low noise, but also not that much. I rememer that for the amplifier after the mic it made a difference going from an LF356 to OP27, though not very much. There is essentially a small JFET source follower inside, often a bit larger (lower noise) then the 2N4117, but not much.
 
The following users thanked this post: RoGeorge

Online Harm314

  • Newbie
  • Posts: 9
  • Country: nl
Re: Want to hear the bat flying in the front yard
« Reply #15 on: August 06, 2021, 01:07:59 pm »
I have a low-end bat detector kit from Franzis Verlag:

https://www.franzis.de/search?sSearch=fledermaus, https://www.amazon.com/Franzis-Make-your-Detector-Manual/dp/3645652760/ref=sr_1_5?dchild=1&keywords=franzis+bat+detector&qid=1628254669&sr=8-5.

I have the older (green box) version, the newer version needs even less (no?) soldering. 

For the bats that fly over my back yard (Wester Europe/Netherlands), it does the job of making the ultrasound audible, including the switch from 'search' clicks to 'attack' mode. Great fun together with my boy on a summer evening.

It's quite simple, built around a CD2003GB, with an LM3861 and an NE555.
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #16 on: August 07, 2021, 11:11:49 am »
Cobbled a 100x preamplifier with a TCA520 OpAmp/Comp, to ease the mikes measurement and selection.  It works fine at 3.3V.  Found an electret mike from a former Motorola 8700 that still works even at 200kHz.   :o

Used the Tx to Rx distance variation to be sure it's ultrasound what the oscilloscope shows, and not radio.  Had some fun playing around with ultrasounds, observing the direct wave, the reflected wave, and then the interference pattern between the direct and the reflected wave.  The setup can easily detect my own movement near the workbench, but have you ever seen a breadboard with wheels?   ;D






For the bat detector, not sure which one to build first:
- a preamplifier to square wave, then use a digital divider by 16
- a heterodyne
- maybe use a logarithmic preamplifier as amplitude compressor, for more sensitivity?

By looking at the expected spectrum, some species emit a signal as wide as 80kHz (e.g. see page 11 of 19 from https://rss.onlinelibrary.wiley.com/doi/pdf/10.1111/rssc.12217 or fig.2 in https://acoustics.org/pressroom/httpdocs/154th/aytekin.html etc.), so how will a heterodyne translate 80kHz wide bandwidth into only a few kHz of human hearing?   :-//

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 15173
  • Country: de
Re: Want to hear the bat flying in the front yard
« Reply #17 on: August 07, 2021, 12:23:09 pm »
The simple heterodyne can only convert some 20-30 kHz of BW around the local oscillator. One has both band of tone mixed up and mixed down, but no more than twice the audio band. For most used this is still Ok. If needed one could to a 2nd channel for stereo with a 2nd LO.

The divider part is tricky, as it only wirks with the strongest signals.
The dynamic range is likely OK and no real need for compression, at least not for the start.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5578
  • Country: va
Re: Want to hear the bat flying in the front yard
« Reply #18 on: August 07, 2021, 01:15:09 pm »
I would amplify the mic and feed the signal into an MCU, something like stm32 (with at least 12bit adc and single precision fpu).. And DSP the signal then.
With 2 mics attached you may even create a bat-position-visualizer then (showing the bat flying on an LCD screen)..
 :D
« Last Edit: August 07, 2021, 01:22:23 pm by imo »
Readers discretion is advised..
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2588
  • Country: gb
  • Recovering Electrical Engineer
Re: Want to hear the bat flying in the front yard
« Reply #19 on: August 07, 2021, 04:55:21 pm »
A staright forward hetrodyne down converter using a balanced mixer is a good place to start. https://www.google.co.uk/url?sa=i&url=http%3A%2F%2Fwww.magenta2000.co.uk%2Facatalog%2FBat%2520Detector%2520Mk2%2520Kit%2520Assembly_Farmer.pdf&psig=AOvVaw2tBERHW6ScMRQv1LMA9UJn&ust=1628441407046000&source=images&cd=vfe&ved=0CAgQjhxqFwoTCLjN1Y6vn_ICFQAAAAAdAAAAABAI   
You can also sample the amplified signal and pitch shift it thus: http://www.technoblogy.com/show?1L02 increase the clock to suit.
Either way you need to compensate for the horrible frequency response of your piezo.
Most bat detectors have a tuning control to select the frequncy band. Bandwith compression is not for the faint hearted.  It cannot be done in hardware as far as I am aware.
FPGA boys???
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #20 on: August 07, 2021, 08:49:46 pm »
Regarding the modulator: what's wrong with just using a simple BJT LC oscillator, with the signal going to the base to change the transconductance, thus the amplitude?
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7716
  • Country: ca
Re: Want to hear the bat flying in the front yard
« Reply #21 on: August 08, 2021, 07:16:01 am »
Popular Electronics Electronic Experimenter's Handbook 1982 pg. 76 has this simple ultrasonic detector project. It uses old TV remote control piezo ultrasonic sensors and oddball TBA231 op-amp.
 
The following users thanked this post: RoGeorge

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #22 on: August 09, 2021, 10:18:26 am »
Thanks for that Popular Electronics schematic, had one of those "Aha!" moments because of it.  :-+

That was because there is no obvious multiplier (or frequency mixer) there, so how does it shifts the spectrum from ultrasounds to audio?  C5 and C10 only adds the ultrasound signal \$f_x\$ with the local oscillator \$f_{LO}\$.  An adder does not produce new frequencies.  If we add two frequencies \$f_x\$ and \$f_{LO}\$ we do NOT get any \$f_x - f_{LO}\$ like we get from a normal mixer/multiplier.

A circuit needs some non-linearity to produce new frequencies, frequencies other than the ones that were put in.  So, how come that an adder can produce  \$f_x - f_{LO}\$?  Well, it doesn't.

Then how that that schematic even works?  It's the diode detector with D1, D2, R8 following after the C5 and C10.  ;D  The diodes detector is in fact a frequency mixer, didn't realized that before!

Those diodes also acts as a frequency mixer  8), then R8, C6, C7, R9 makes a low-pass filter that rejects higher frequencies and let to pass mostly the \$f_x - f_{LO}\$ component, which is the bats' ultrasounds shifted down to audio.  ^-^




Added a screen capture to illustrate a low pass of \$f_x + f_{LO}\$ in blue vs a low pass of \$|{f_x + f_{LO}}|\$ in yellow.

The green trace is the sum of the two frequencies and the red trace is the rectified sum.  In blue is the signal after low-pass on the sum of the \$f_x\$ and \$f_{LO}\$, while the yellow trace shows the same but for the absolute value (with diodes).  Blue signal only shows ultrasounds, while the yellow signal shows \$f_x - f_{LO}\$.
« Last Edit: August 09, 2021, 10:53:29 am by RoGeorge »
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7716
  • Country: ca
Re: Want to hear the bat flying in the front yard
« Reply #23 on: August 11, 2021, 12:12:02 am »
That is interesting, it did look like an oddball circuit. I didn't think that circuit would be practical, the first TBA231 op-amp stage voltage gain 1,001 then second stage gain 148, total about 148,000 which is crazy high. Who can pull that off on perfboard?
Bertrik's bat detector page worth a look and his NE612 version.
 

Offline CaptDon

  • Super Contributor
  • ***
  • Posts: 2189
  • Country: is
Re: Want to hear the bat flying in the front yard
« Reply #24 on: August 13, 2021, 01:57:17 am »
The old 'motorola' Piezo tweeters that were sold by Radio Shack and still available
from MCM work great. They have a resonant peak around 25khz but are very broadband
and also are basically a compression driver horn so they are directional with about 90
degrees in the vertical and horizontal plane. I used one of these mounted in front of an
aluminum concave dish as the antenna and RX/TX element for an ultrasonic radar and
was painting targets out to 100 yards with around 10vpp squarewave drive and around
100db receive gain (total voltage gain) to drive a CRT grid for an 'A Scope' type display.
B.T.W., a signal 100 yards away has a long travel time out and back!!!
Collector and repairer of vintage and not so vintage electronic gadgets and test equipment. What's the difference between a pizza and a musician? A pizza can feed a family of four!! Classically trained guitarist. Sound engineer.
 

Offline Tomorokoshi

  • Super Contributor
  • ***
  • Posts: 1212
  • Country: us
Re: Want to hear the bat flying in the front yard
« Reply #25 on: August 13, 2021, 12:18:59 pm »
Recorded from an HP 4918A Ultrasonic Translator.
 
The following users thanked this post: edavid, RoGeorge

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #26 on: August 13, 2021, 06:12:38 pm »
Nice!   :)

Thanks for mentioning the instrument.  By googling it I've learned that ultrasound are used industrially to detect gas leaks, debug HVAC, corona discharge, etc.  For example here it is used with a conduction wand to debug a Freon leak https://youtu.be/4oMYMYI17cM

That's a nice to have around tool, much more useful than hearing the bats.  First application that came to mind would be to detect which coils are singing in SMPS.   8)

Just curious how they made the HP Ultrasonic Translator, the service manual for another model HP 4917A Ultrasonic Translator Detector is available online, https://www.kennethkuhn.com/hpmuseum/scans/hp4917a_manual.pdf and has the block diagram at page 9 of 26, and the schematic at schematic at page 19 of 29.  There is a \$\pi\$ LC filter right after the probe to bandpass the 36-44kHz range, then the signal is mixed with a fixed LO of 40kHz.  The only setting is the audio volume knob.   :-+



LATER EDIT:

Just for the docs, applications for HP Ultrasonic Translators featured in HP Journal - May 1967:
https://www.hpl.hp.com/hpjournal/pdfs/IssuePDFs/1967-05.pdf
« Last Edit: August 13, 2021, 06:54:07 pm by RoGeorge »
 
The following users thanked this post: Tomorokoshi

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #27 on: August 19, 2021, 08:25:18 pm »
I was playing with a Wien bridge oscillator recently, remembered this thread and thought it could be easily used as a modulator, by coupling a signal to the gate of the limiting J-FET. It could also be built with an op-amp. R1, R2 C1 & C2 form a filter which sets the frequency, which can be varied using a dual ganged potentiometer and fixed resistor. It will probably need some tweaks to be a practical circuit.
« Last Edit: June 21, 2024, 07:08:28 pm by Zero999 »
 
The following users thanked this post: RoGeorge

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #28 on: August 19, 2021, 10:28:12 pm »
That's very ingenious!   :-+
Might be tricky to keep the Wien oscillating in practice, but definitely worth a try.

Speaking of unconventional ways to make a heterodyne, another one I was thinking the other days was to use the local oscillator output as a power source for the electret mic.  That will turn the electret mic into a multiplying mixer.  ;D




Though, there are some inconvenients with any heterodyne when using for listening to bats:
- first is that the bats emit short pulses, so when hearing at that in real time it will sound more like burst of clicks, not much can be distinguish regarding the "voice/singing" of the bats
- second is that a heterodyne might reverse the spectrum when the LO is higher, like shown in the two examples.  First image is with the waveforms and the second with the spectrum corresponding to those waveforms.


Notice how in the last spectrum plotted appears reversed in audio (magenta spectrum near the origin of the axes - magenta is corresponding to the green signal mixed with the blue oscillator, where the blue LO is higher in frequency than the bats signal).

That will make, for example, an increasing pitch chirp to hear as decreasing in pitch.   :o

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #29 on: August 22, 2021, 11:54:27 am »
Found this on the street   :o



and noticed it still has a small piece of PCB with the answering button on it, so it was from the bottom half of a phone, where a mic is expected to be, and guess what?  It does has a mic on that small piece of PCB leftover:



and it happened to be a MEMS mic, the analog kind of MEMS mic  :D F4-(S)MOE-N090R38-3P marked "ME V1.0".

Tested it with the ultrasounds coming from a piezo disc, and this MEMS mic seems to be working just find up to at least 135kHz if not more, outputting tens of mV (without any amplifier).   :-+



The upper level of blue marks the mic out signal for a frequency sweep between 20kHz and 150kHz, while the lower level blue marks the response for the rest of the sweep, between 150kHz and 200kHz.
« Last Edit: August 22, 2021, 11:59:55 am by RoGeorge »
 
The following users thanked this post: Zero999

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #30 on: August 23, 2021, 08:40:22 pm »
The software is not yet ready, but couldn't resist the temptation, so last night took the handheld oscilloscope and the MEMS mic powered by two AAA batteries, and went outside curious if it can capture anything:





It took a while to find a good trigger level, and at first I thought the captures are coming from the rare passing by cars in the night.  Then I realized that the trigger captures are not from the cars noises, but the triggering happens more often in the presence of the car noises because the bat raises the Tx power when it is more noise outside!  :D

I don't think the captured signals were from the cars, because of two things:
- the signals look like a burst of only a few milliseconds long, thought the passing by cars were taking many seconds of sustained level of noise before fading away
- a few ultrasonic bursts were captured in the silence of the night background sound, with no strong noises to be hear

Offline Tomorokoshi

  • Super Contributor
  • ***
  • Posts: 1212
  • Country: us
Re: Want to hear the bat flying in the front yard
« Reply #31 on: August 24, 2021, 12:19:58 am »
For what it's worth, I couldn't hear crickets at all over the background noise with the ultrasonic translator. So apparently there isn't much energy from them between 35 kHz and 45 kHz.
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #32 on: August 24, 2021, 12:57:53 am »
That was a surprise for me, too.  Even with the crickets and all other background noises of the night, the trace on the oscilloscope was staying mostly flat, except for the bat chirps, which chirps were comparable in amplitude with loud cars.  Bats are probably one of the loudest creatures, if not the most loud out there in the ultrasonic range.

I bet if it were for humans to hear ultrasounds, bats would probably sound very, very loud, like a dog barking only a few feet away, or rather like screaming seagulls above a net full of fish.

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #33 on: May 18, 2024, 08:36:06 pm »
Good find regarding the microphone, which is the most difficult part of a bat detector.

I recently attesteded a bat walk meet up with my 11 year old nephew and he loved it. We used heterodyne detectors, which worked from 17kHz ro 140kHz and I remembered this thread.

I'm now thinking of making or buying one.

I had another idea. Rather than heterodyne, use a sample and hold circuit, clocked with an adjustable squarewave oscillator. This has the advantage of not requiring a sine wave oscillator. It just requires a simple low pass filter to give a good output. The only thing is the oscillator needs to have a low duty cycle to work well, but even the TL072 should be able to cope with that up to 140kHz.

I've had a play with LTSpcie.
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #34 on: May 18, 2024, 09:12:09 pm »
Looks interesting.  :-+

Ready made bat receivers can be quite expensive (for what they have inside).
Better build your own, so to implement the sampling idea in practice.

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #35 on: May 18, 2024, 09:48:52 pm »
Sorry, I forgot to ask: did you ever complete your project?

I've had a look for the microphone you used, but couldn't find it for sale anywhere.
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #36 on: May 19, 2024, 05:20:00 am »
I've switched to digital, because it happened that I was already heaving a DSP devboard from TI ( https://www.ti.com/tool/TMDX5535EZDSP ), with a CODEC that can do 192kHz sampling, but it turned out the 192kHz was not really possible for frequencies above the audio.  There were some internal filters I couldn't bypass, got lost in programming and configuring the DSP+CODEC, and eventually never completed my bat receiver.  :-[


For the microphone, I think most of the electret microphones should be good enough.  A MEMS microphone would be even better, though the bats ultrasounds are very loud when compared with any other sounds of the night.  Might need a preamplifier if the bats are not very close.

Look for any abandoned mobile phones, or search for MEMS microphone if you can not find any discarded mobile phone to scrap it's microphone.  The very new ones might have many microphones, but are often digital mics, and very, very small, really hard to reuse.  IIRC Adafruit was heaving some MEMS mics on a breakout board, or if you have one of those "17 sensors Arduino kit", there are one or two sensors with a small microphone.

If you don't have any ultrasound source to test which microphone works the best, shake a ring with (door) keys nearby, their metallic ringing sound will produce a lot of ultrasounds.

Beware with the electret microphones, they are very, very sensitive to heat.  Heat depolarizes the electret material inside, and makes them lose from their sensitivity.  That is why many mobile phones will use spring contacts to connect to their mic, and if not, usually the electret mic has some wires soldered from the factory.  Avoid soldering on electret microphones if possible.

The waveforms above were captured without any filter, with a handheld oscilloscope connected directly to the microphone.  The recording was made from a balcony, at about the same height as the bat was flying, so the distance was somewhere between a few meters and 20-50 meters maybe.  In the picture are loudest ones, when the bat was flying only a few meters (maybe as close as 3meters/10feet or so).
« Last Edit: May 19, 2024, 05:25:24 am by RoGeorge »
 
The following users thanked this post: Zero999

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #37 on: May 19, 2024, 07:59:20 pm »
It's a shame you didn't complete it. It's a bit silly having such a high sample rate, with all that filtering. It makes it pretty pointless. You could have added an external sample and hold circuit.

Yes, an electret microphone should work, but I've noticed some models have a built-in capacitor, which is designed to filter out RF GSM signals. It's typically 1nF, so would form a 72kHz low pass filter with the 2k2 bias resistor. I could use a lower value bias resistor, say 1k for a cut-off of 159kHz, along with a lower bias voltage, so the bias current remains within the permitted level, but I don't know how well it'll work. I might buy a few of each part and then open them up to check there isn't a capacitor.

I found this kit which uses sampling, but with an analogue switch. I would need to build a case and add a speaker amplifier, since his mum wouldn't want him wearing headphones, in case he sets the volume too loud.
https://whadda.uk/manuals/velleman/illustrated_assembly_manual_k8118.pdf
EDIT: Schematic added.

I'm not set on the sub-sample/aliasing/strobe idea. It's just I thought it might be easier to understand. I could go with heterodyne, perhaps with the incandescent lamp for the AGC, but with a J-FET in series to provide the amplitude modulation.
« Last Edit: May 20, 2024, 09:43:28 pm by Zero999 »
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #38 on: May 20, 2024, 07:54:01 am »
Well, most of my projects remain unfinished, and I have no excuse for that.  Once there are some partial results, and only disciplined work remain for a project to be finished, something else pops into attention.  Learning new things or exploring new topics is more appealing then working to finish something.  Sometimes I return to older projects and finish them, but not for closure.  Usually I return to an old project when I need that device to do something with it.

Unfinished projects leave some sort of guilt behind them, so it is better to finish them if you have the discipline.

I've opened yesterday your simulation, and noticed you used ~150kHz.  Isn't that too high?  I remember bats were audible somewhere around 50kHz, maybe up to 80kHz or so.  150kHz osc - 50kHz bat = 100kHz at the output, which will need a second frequency shift to become audible.  I've read they might emit higher than 100kHz, though that doesn't propagate well enough through air, but I didn't try in practice how much of 100-150kHz can be received from a distance, outside.

Another inconvenience with frequency shifting, in general, is that bats might use a wider band than the audio width of human hearing, so not all the spectrum produced by the bat can be shifted into audio (that's why I've tried to move to digital, with the intention to use DSP for compressing a wider band of 50-100kHz into only 5 or 10kHz of audio bandwidth).  Though, was a little too pedantic from my side when I wanted to implement spectrum compression.  It is very interesting to hear the bats even when only a fraction of their spectrum can be made audible at a time.
« Last Edit: May 20, 2024, 08:02:28 am by RoGeorge »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #39 on: May 20, 2024, 08:56:38 am »
Why 150kHz? I noticed the bat detectors provided worked up to 140kHz, Wikipedia says >100kHz and wanted to account for the highst frequency. The idea is to make it tunable, with R4 being a 100k potentiometer with 10k in series. It's not the final design.

Is the wider spectrum a problem? The idea is just to detect bats. Adjusting the tuning would help.

Digitally recording and playing back at a much lower speed would give a more accurate representation, but it doesn't work in real time.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #40 on: May 27, 2024, 11:34:54 am »
I hope you don't mind if I continue to post my designs and questions in this thread, since you appear to have abandoned this project.

I've not stopped work on it.

I tested a few piezoelectric transducers designed for audio/alarm applications and noticed how they have various sharp peaks and troughs between 20kHz and 150kHz. I used two units for each test, one as a transmitter and the other as a receiver. I haven't recorded any detailed measurements, simply because I don't have a microphone with any response data over said frequency range. The intention is to use a transducer to test various electret and MEMS microphones to find a suitable candidate.

I've also had a failed attempt a designing a Wien bridge oscillator with AM, for the heterodyne circuit. The oscillator works, but the modulation index sharply declines, as the input frequency increases.

Here's the schematic.

I built it on a solderless breadboard. For simplicity I used the TL071, because it's single channel, so there's no unused op-amp to worry about.

R4 is a small incandescent lamp, (RS stock code 587-686) I found in a box of old bulbs. I chose this over the J-FET AGC for simplicity's sake. It's run off a +/-6V dual power supply, to avoid the additional complexity of single supply design. It is connected in series with the J113 to 0V. I measured the channel resistance of the F-FET: 54R. This is purely to test the concept, rather than a final design.

The oscillator works perfectly, giving a nice 51.5kHz (very close to the 48.2kHz calculated) sine wave of about 1.2Vpp.


Unfortunately, the amplitude modulation doesn't work properly. 1Vpp (500mVp) of different frequencies were applied to J1's gate. This was low enough to avoid the gate conducting significant current, when forward biased, causing the transistor to work in the enhancement region, yes depletion mode J-FETs can do that.

At very low frequencies, it was enough to saturate the circuit, resulting in a distorted modulation envelope.
128Hz input


This got much better as the input frequency was increased, but note the 45° phase shift and the modulation index decreases drastically, as the frequency is increased.
1.3kHz

5kHz


I tested with 56kHz in and there's hardly any modulation, rendering it useless for the intended application.


The question is: why the steep roll-off? I chose low impedances to avoid the parasitic capacitances of the breadboard being a problem. The output impedance of the signal generator is 50R, connected to 1m of co-axial cable, but I don't see how that's a problem.
« Last Edit: June 21, 2024, 07:08:44 pm by Zero999 »
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #41 on: May 27, 2024, 01:28:03 pm »
I've not stopped work on it.
...
The question is: why the steep roll-off?

Glad to hear you didn't drop the project.  :-+

About the Wien bridge, IIRC it only oscillates when the amplification is precisely 3.  Anything slightly bigger than 3, and the amplitude will go to infinity, so it will generate distorted square waves.  Anything lower than 3 will extinguish the oscillations.  The desired number 3 comes from the attenuation of the RC resonant network.  The negative reaction has to match precisely the positive reaction.  The bulb is supposed to keep the amplification precisely 3.

My guess is that influencing the amplification (by the FET that interferes with the bulb resistance) means messing with the oscillation condition (and extinguish or goes to infinite amplitude) rather than just modulating the amplitude.

For amplitude modulation, I would let the Wien bridge and the light bulb do their thing at keeping the gain precisely 3 and outputting a constant amplitude, then add another circuit as an AM modulator after the Wien bridge.
« Last Edit: May 27, 2024, 05:44:59 pm by RoGeorge »
 
The following users thanked this post: Zero999

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #42 on: May 27, 2024, 05:29:53 pm »
I've not stopped work on it.https://www.eevblog.com/forum/Smileys/default/phew.gif :palm:
...
The question is: why the steep roll-off?

Glad to hear you didn't drop the project.  :-+
I'm glad you don't mind me using the thread you created.

Quote
About the Wien bridge, IIRC it only oscillates when the amplification is precisely 3.  Anything slightly bigger than 3 will, and the amplitude will go to infinity, so it will generate distorted square waves.  Anything lower than 3 will extinguish the oscillations.  The desired number 3 comes from the attenuation of the RC resonant network.  The negative reaction has to mach precisely the positive reaction.  The bulb is supposed to keep the amplification precisely 3.

My guess is that influencing the amplification (by the FET that interferes with the bulb resistance) means messing with the oscillation condition (and extinguish or goes to infinite amplitude) rather than just modulating the amplitude.
Yes that's true, but it doesn't happen immediately. It takes time to the oscillation do build when AV > 3 and decay when AV < 3. This is why my circuit doesn't work and is a bad idea. :palm:  At low frequencies, the Wien bridge oscillator has time for the oscillations to build and die away. Give it too much time (very low frequencies) and it'll die away completely and at build up to the point of causing distortion, over the cause of a cycle of the input signal. At higher frequencies, simply isn't time for the oscillations to build and decay, during the cycle. It's inherently limited in bandwidth. The only fix would be to put the input through a high-pass filter circuit with the complementary response, which would complicate things and there are simpler alternatives.

The circuit I posted a few years ago will have the same issue.

Thank you for helping me realising this is a bad design. It didn't click, until I responded to your post. I'm a bit annoyed it took me so long to realise what should have been obvious.  :horse:

Quote
For amplitude modulation, I would let the Wien bridge and the light bulb do their thing at keeping the gain precisely 3 and outputting a constant amplitude, then add another circuit as an AM modulator after the Wien bridge.
I agree.

I'm moving towards the stroboscopic, sample and hold idea.  I might use an analogue switch such as the 74HC1G66 rather than a FET. The only downside is it's surface mount, which doesn't bother me, but I would like to go through hole, to make it so my 12 old nephew can work on it, although I plan on doing it myself, so maybe not.
« Last Edit: July 13, 2024, 12:08:15 pm by Zero999 »
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #43 on: June 28, 2024, 08:34:56 am »
Last night I've looked again from the balcony and didn't spot any bat in the front yard.  :-//

In cases like these, when it is not very clear if there are any bats around, a frequency divider receiver would be preferable to a heterodine receiver, because a frequency divider will translate the entire 20kHz-200kHz band into audible sound.  For example, (20 ... 200)kHz divided by 32 will produce audible (0.625 ... 6.25)kHz, though others are using division by 16:  https://www.instructables.com/Bat-Detector/

By contrast, a heterodine will need to be tuned on just the right frequency.  This can be a daunting task if the presence of the bats is unclear.



Luckily, I have a MMC4020 procured in the 80's from the black market.  It's the equivalent of CD4020 (14 bits binary counter/divider), but produced at MicroElectronica during the communist Romania.

Never tested that MMC4020, but if it doesn't work I'll just use an MCU as frequency divider (eventually with the dividing ratio controlled by a potentiometer).  An MCU would also be able to count how many pulses were received in total (when left to receive over the entire night), so it can tell if there were any bats at all in the area.

The disadvantage of a frequency divider receiver is that it usually discards the amplitude variations of the incoming signal.  The audio amplifier is fed from the digital output of the binary counter.

Thinking as we speak, might be interesting to modulate the audio amplitude with the amplitude envelope of the ultrasounds (the envelope taken before turning the ultrasounds into square signal).  I wonder if this will make a quality difference in audio, compared to constant amplitude audio:  https://youtu.be/C1KVKyYYUbI  ???

Since there are online records with the raw captured ultrasounds, would be easier to test the idea in software first, to decide if an amplitude modulation of the audio out would help or not, but I don't want to turn this again into a software project.
« Last Edit: June 28, 2024, 08:49:16 am by RoGeorge »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #44 on: June 28, 2024, 10:06:50 am »
I've not forgotten about this.

The undersampling/stroboscopic idea, might be better because it would pick up harmonics. If the oscillator is set to 30kHz, then it should also detect 60kHz +-15kHz or whatever the response of your hearing, or the speaker, as well as 30kHz +-15kHz.

I've had some success with finding a microphone sensitive to ultra sound. I tested several electret microphones in my junk box. I found a couple with with some response up to 150kHz, which would be ideal. Unsurprisingly they're the smallest ones with a diameter of just 6mm. There was a small, SMT capactor on the back, for RF supression, which I removed because I thought it would reduce the frequency response, but it turned out to be 470pF, which probably wouldn't have mattered. No doubt a smaller microphone, say 4mm would be even better.
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #45 on: June 28, 2024, 01:13:52 pm »
Mixing with a frequency comb could do the trick for easy detection, I didn't think of that.  If you sample, yes, it will pick harmonics, too.  Or mix with a square wave, whichever comes easier.

Glad to hear you found a high frequency microphone.  In this case, maybe just power the electret microphone from an on/off 30kHz square wave.  Then amplify normally and filter all above 10kHz or so.  In theory, the microphone itself should do the mixing  :D  (should work about the same as sampling, but I didn't try).

Today I've bought another satellite finder from LIDL (6 euro), for its enclosure with a potentiometer (30k\$\Omega\$ linear, B30K).



If I remove the galvanometer indicator, that will free enough room to add inside a small Li-Ion leftover from old mobiles.  The box is very sturdy, has a flipping tilt-support/hanging wire, has a ceramic disc buzzer/speaker, too, a 324 quad opamp (one is unused by the satellite finder) and enough transistors to turn it into an ultrasonic probe.  Already reverse-engineered the schematic from the previous buy:  https://www.eevblog.com/forum/rf-microwave/schematic-for-parksidelidl-sattelite-finder/
« Last Edit: June 28, 2024, 04:10:51 pm by RoGeorge »
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6313
  • Country: 00
Re: Want to hear the bat flying in the front yard
« Reply #46 on: June 28, 2024, 04:46:05 pm »
>> Not sure yet how to post process the signal.

I would start with recording a few samples and then iterating on it. This day Python is a common tool for signal processing with packages such as scipy and numpy.  Once you validate the idea, you can have a more compact/embedded solution if needed.

Having multiple microphones may help you reducing noise by creating a directed beam (again, in the post processing).

You could also train a neural netwrk (e.g. using PyTorch) but most likely you will not have enough samples to do so.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #47 on: June 28, 2024, 06:33:24 pm »
I thought the idea was just to detect bats for now. Once that goal has been met, then we can think about expanding it.

Connecting the microphone to a square wave oscillator will probably work, but note the bias voltage to the input of the amplifier will also shift at the ultrasonic frequency and will need filtering out, otherwise it'll result in saturation.

Acoustic feedback is another potential problem if the microphone detects a significant amount of sound from the speaker. This will happen if there isn't enough high pass filtering from the microphone or low pass filtering to the speaker.
 

Offline hugo

  • Regular Contributor
  • *
  • Posts: 172
  • Country: ca
Re: Want to hear the bat flying in the front yard
« Reply #48 on: June 29, 2024, 04:52:08 pm »
Meet PicoBat: a PIC-based ultrasonic detector by Bruno Gavand with only 3 components:  https://www.micro-examples.com/articles/index.php?title=PicoBat
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #49 on: June 29, 2024, 05:12:49 pm »
Quote
The idea of this circuit is to hack the PIC oscillator circuit, by replacing the crystal by a piezo sensor : the frequency of the oscillator then depends on ultrasounds.
Quote from the above posted link:  https://www.micro-examples.com/articles/index.php?title=PicoBat

Nice hack!  :-+

However, the test only shows the device working with strongly shaken keys at a couple of inches away from the sensor, or with other very laud ultrasonic range finders.  It is not clear if it can detect bat produced ultrasounds, they might not be loud enough from a distance.

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2588
  • Country: gb
  • Recovering Electrical Engineer
« Last Edit: June 30, 2024, 02:28:13 pm by Terry Bites »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #51 on: July 06, 2024, 07:14:49 pm »
Most cheap ultrasonic transducers are tuned for a narrow resonant frequency, with 40kHz being the most common one. I've not tested one at other frequencies, but it'll be similar to one of those piezo discs. A small electrect microphone will be much better.

Using a frequency counter is a bad idea, because it rejects all the amplitude information. It will just lock on to one sound, making it incapable of detecting more than one bat. The only advantage is it scales down the entire spectrum.

I looked at the kit schematic again. Attached is just one channel, with the component values made clearer, as the picture in the PDF was low resolution and very fuzzy.
2303427-0

The first two op-amps amplify the signal by a factor of 121, with a lower cut-off of 16kHz. The third op-amp then inverts the signal. The analogue swithers are alternately switched on by the oscillator, selecting between the inverted and non-inverted signal, at the oscillator frequency. This is then low pass filtered by R5 and C11, with a cut-off of 7kHz.

I think I might use a similar circuit, but it can be greatly simplified. Rather than using an op-amp to invert the signal, just have one op-amp, which can be programmed to inverting or non-inverting, with an analogue switch. This doesn't cut down on the number of op-amps but it means the oscillator doesn't need an inverting output and only one analogue switch is required.

I simulated it and the results are decent. R4, R5 and C1 bias the signal to half the supply voltage. When S1 is on, the circuit is inverting and when off it's non-inverting.

I'll swap the final op-amp for an LM386 to drive a small speaker.

I might also use a common emitter amplifier for the first microphone amplifier stage, because it should have lower noise than the TL072.


EDIT:
I've simulated the microphone amplifier. The response probably counteracts the reduction in sensitivity vs increasing frequency of the electret microphone quite well.

I'm moving towards using a TL074, with two sections for the amplifier, one for the inverting/non-inverting amplifier part for the heterodyne circuit and one as Schmitt trigger oscillator.


EDIT:
For completeness, here's the BJT amplifier from the website linked below, which uses the obsolete NE612 as a demodulator.
http://bertrik.sikken.nl/bat/ne612het.htm

The microphone is noddled as a signal source with an impedance of 4k7.

It has a sharper peak, than the op-amp circui9t, but lower noise. I might use two stages, a BJT and op-amp for more gain.
« Last Edit: July 07, 2024, 06:33:29 pm by Zero999 »
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #52 on: July 24, 2024, 08:05:05 am »
This summer couldn't spot any bats, until last night around ~3-4AM.  By coincidence, last weekend I did a crude ultrasound probe for detecting singing coils or other ultrasound sources.  The breadboard was still on the workbench and wired, but from indoors it didn't catch any bat ultrasounds.



The schematic was made to keep all as minimalistic as possible.  No amplifier and no mixer.  The MEMS mike (which has an internal preamp) is DC coupled to an ATtiny13.  The MCU is acting as an analog comparator and frequency divider.  The speaker is a piezo disc connected directly to the MCU, so no audio amplifier either.  No volume, sensitivity or other controls.  Only 6 components and a few lines of code in a .S file (this draft code happens to be written in assembly, using Eclipse, AVR-GCC and debugWire, with a generic CH340G USB to serial as a debugger/programmer):

Code: [Select]
#define __SFR_OFFSET 0x00
#include <avr/io.h>

.global main
main:
cli // disable interrupts globally

ldi r18, (1 << PB4) + (1 << PB3) + (1 << PB2)
out DDRB, r18 // PB4, PB3, PB2 as DO

sbr r18, (1 << CLKPCE) // set the CLKPCE bit before writing the value
out CLKPR, r18
ldi r18, 0
out CLKPR, r18 // write CLKPS3..0 all 0 for CLK prescaller div x1

//  disable the WDT

// enable Analog Comparator (AC), interrupts on raising edge
sbr r18, (1 << ACIE) + (1 << ACIS1) + (1 << ACIS0)

// enable Analog Comparator (AC), only raising edge, w/o interrupts
// sbr r18, (0 << ACIE) | (1 << ACIS1) | (1 << ACIS0)
out ACSR, r18

ldi r18, (1 << SE)
out MCUCR, r18 // enable sleep, sleep mode Idle

#define MAXCOUNT 10
#define HALF MAXCOUNT/2

// use r18 as a variable for counting the AC pulses/interrupts
#define COUNTER r18

// use r19 as a constant that turns LED/speaker on
#define SPK_ON r19
ldi SPK_ON, (1 << PB4) + (1 << PB3) + (0 << PB2)

// use r20 as a constant that turns LED/speaker off
#define SPK_OFF r20
ldi SPK_OFF, (0 << PB4) + (0 << PB3) + (1 << PB2)

// enable interrupts globally
sei
rjmp reset_counter

wait_AC_event:
sleep // sleep until an AC interrupt will wake the CPU

// sbi ACSR, ACI // clear the interrupt bit (because AC int are disabled)
// sbi ACSR, ACO // clear the interrupt bit (because AC int are disabled)

inc COUNTER // count the raising edges detected by the AC

// set LED/speaker bit(s) PB2, PB3, PB4 accordingly

//if COUNTER >= HALF, jmp to check_COUNTER_ovf
cpi COUNTER, HALF
brpl check_COUNTER_ovf
//else
rjmp wait_AC_event

check_COUNTER_ovf:
out PORTB, SPK_OFF
//if counter < MAXCOUNT, jmp to wait_AC_event
cpi COUNTER, MAXCOUNT
brmi wait_AC_event
//else
reset_counter:
ldi COUNTER, 0 // else reset the counting
out PORTB, SPK_ON

rjmp wait_AC_event // loop forever



//dealing with interrupts
.global ANA_COMP_vect
ANA_COMP_vect:
sbi ACSR, ACI // clear the interrupt bit (because AC int are disabled)
// sbi ACSR, ACO // clear the interrupt bit (because AC int are disabled)

reti

.global WDT_vect
WDT_vect:
// WDT shouldn't occur, but if it does, loop here forever
cli
forever_trapped_1:
rjmp forever_trapped_1
reti

// according to [url]https://www.nongnu.org/avr-libc/user-manual/assembler.html,[/url]
// these names should have work as a catch-it-all, but they didn't
//
//.global BADISR_vect
//BADISR_vect:
//.global __vector_default
//__vector_default:
//
// used this workaround instead:
.global INT0_vect
.global PCINT0_vect
.global TIM0_OVF_vect
.global EE_RDY_vect
.global ANA_COMP_vect
.global TIM0_COMPA_vect
.global TIM0_COMPB_vect
.global WDT_vect
.global ADC_vect

INT0_vect:
PCINT0_vect:
TIM0_OVF_vect:
EE_RDY_vect:
//ANA_COMP_vect:
TIM0_COMPA_vect:
TIM0_COMPB_vect:
//WDT_vect:
ADC_vect:

// other interrupts shouldn't occur, but if they do, loop here forever
cli
forever_trapped_2:
rjmp forever_trapped_2

.end

Will have to add a battery, and/or move the circuit on a permanent breadboard to make it portable.  Maybe the bat will visit again.  :)
« Last Edit: July 24, 2024, 08:58:15 am by RoGeorge »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20388
  • Country: gb
  • 0999
Re: Want to hear the bat flying in the front yard
« Reply #53 on: July 26, 2024, 08:11:50 pm »
I would be very surprised if that circuit worked.

Not only is there no pre-amplifier, other than what's built-in to the MEMS mic, but it also lacks a high-pass filter to remove audible sound.

Try this.


By the way, mic is the correct abbreviation for microphone, not mike.
 

Offline RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 7022
  • Country: ro
Re: Want to hear the bat flying in the front yard
« Reply #54 on: July 27, 2024, 05:58:49 am »
Thanks for the schematic.  Main problem was that the next night was stormy and it rained violently, and the bat didn't visit.  :)

Then the weekend came.  During weekend, there is a lot of noise from a pub across the street, and from more cars.  I've noticed from the previous recordings that the bat is "barking" louder when it's noisy outside (for example when a car is passing).  So I guess when the night is noisy, the bat is using other quieter hunting areas.  That would explain why the bat appearance has shifted to the late AM hours, because the pub sometimes has loud music until midnight, sometimes even later.  I suspect bats don't like noisy places.



About the detector, that one was for made for hearing singing coils, or to detect other (indoors) ultrasound sources.  Should be good enough for the bat, too.  The recorded level a couple of summers ago (from a bat, using the same mic) was made using 20mV/div.  The signal was about 20-50mVpp:


I've measured the sensitivity of the ATtiny13 comparator with a signal generator.  It flips reliably starting from about 5-6mVpp.  The expected 20-50mVpp from the bat should be plenty.

About the high pass filter, there is one.  The 10k/47nF low pass RC at the negative input makes the comparator more sensitive to high frequencies.  When the signal is swinging slowly, the RC filter on the negative input has enough time to follow the signal about as well as the positive input of the comparator, so not much flipping.  At high frequencies, the RC cell works as a voltage averager, and keeps the negative input of the comparator at a constant voltage, while the positive input is swinging fast, making the comparator flip at each period.  Overall, the circuit acts as a zero-crossing detector, but for high frequencies only.

In theory, the capacitor should have been much smaller, f=1/(2*pi*R*C) will indicate about 1nF for 10k\$\Omega\$ and 16kHz, but in practice that was making the comparator too insensitive even for high pitch frequencies, so I've used a 47n that happened to be at hand.  That was picking some other audible sounds, indeed, but it was good enough for indoors testing.  For the final version I'll probably use 2 or 3 RC cells calculated for 10kHz or so (for the indoors ultrasounds probe, not for bats).  A single RC cell is not selective enough to separate audio from ultrasounds.



Another problem with the indoors probe was the ceramic disc.  The sound edges are too sharp, and that interfere with the ultrasounds.  A miniature laptop-speaker (to avoid wearing headphones) with some low pass filter should work much better than a piezo disc.  Attiny can supply about 50mA through a DO.  In practice, I've measured the resistance of a DO pin to be about 50-80ohms, depending on the Vcc.  The output resistance measures about the same for either high or low level of the DO.  Should be easy to soften the voltage edges of the DOs by adding a capacitor.
« Last Edit: July 27, 2024, 06:15:03 am by RoGeorge »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf