Shop OBEX P1 Docs P2 Docs Learn Events
The Bat detector from Nuts and Volts — Parallax Forums

The Bat detector from Nuts and Volts

LoopyBytelooseLoopyByteloose Posts: 12,537
edited 2012-08-31 11:31 in General Discussion
The latest Nuts and Volts arrived here in Taiwan and has a very interesting op amp project, an ultrasonic sensing and listening device.

The high points of the project are that one LM324 with 4 op amps does the whole build and for an ultrasonic microphone, one just use a piezoelectric speaker.

Since the LM324 is low power, one could power it from 3 volts DC, but that is really the lower limit of op amps. I suspect 4.5 volts would be more stable. The LM324 offers op amps with up to 100db gain.

You can even have it detect other ultrasonic sounds. Apparently leaves rustle at ultrasonic frequencies. And it inspires me to see what is going on with ultrasonic distance sensors. One might even make enchanced range sensors with microcontroller, the enhanced amplification, and specific op amp filtering.

Of course it helps that we have bats flying everywhere in Taiwan around dusk as they feast on mosquitoes..
«1

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2011-05-28 10:50
    Jingling keys are another excellent source for ultrasonic sounds. Haven't looked at the article you mention, but I once built a simple 'down converter', that just divided the received signal by about 5... Just mix a local oscillator running a few kHz lower (or higher) than the ultrasonic signal you want to listen to and you can easily hear the beat frequency... for 40kHz, a 35kHz local oscillator works nice. You hear it as a 5kHz signal when a 40kHz signal is present.
  • Prophead100Prophead100 Posts: 192
    edited 2011-05-28 13:59
    Most of the bat species here in California (e.g. next to Parallax) run in the 20 to 75 kHz range and are fairly unique in their feeding call patterns. Some European species can go up to 150kHz. Insects, car brakes, and metal on metal put out a lot of noise at the lower end of the ultrasonic so commericial detectors often filter for that. The bats use FM sweeps to distinguish size, shape and texture and include decoding approaches such as wavelets when looking for food. The bats use AM for speed and direction of prey. If you like signal processing this is a very interesting set of species. The other thing to note is that they tend to have harmonics and power curves in their calls so they are calling in more than one frequency at a time. The creek behind Parallax would be an ideal corridor to test any systems. You should be able to get little brown (Myotis california), Big Brown (Eptesicus fuscus) and Mexican free-tail (Tadarida brasilensis) sounds. There are several others as well. You can see what their spectra would look like at http://www.msb.unm.edu/mammals/batcall/html/speciesaccounts.html . As a thought, one project that the propeller could do that other chips could not is reproduce the sounds including the harmonics. Running multiple cogs and reproducing the signal processing that bats use could create a PING like no other...
    Jingling keys are another excellent source for ultrasonic sounds. Haven't looked at the article you mention, but I once built a simple 'down converter', that just divided the received signal by about 5... Just mix a local oscillator running a few kHz lower (or higher) than the ultrasonic signal you want to listen to and you can easily hear the beat frequency... for 40kHz, a 35kHz local oscillator works nice. You hear it as a 5kHz signal when a 40kHz signal is present.
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2011-05-28 19:54
    My grandparents had this really old B+W TV set
    in the den that made a horrible high pitched tone
    whenever it was on. I bet this bat detector would
    have detected it.

    They thought I was goofy until I had them turn the set
    off and on and I stood outside the room. I could tell
    them when the TV was on or off by the tone. They
    could not hear it.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-28 20:04
    My grandparents had a TV that used an ultrasonic remote control, the Zenith Space Commander. By jiggling a set of keys, one could easily -- and randomly -- switch channels or turn the TV off and on!

    -Phil
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-05-30 01:07
    I am also thinking I might be able to locate a conventional audio tweeter that goes high enough to generate a signal with enough power for transmission of ultrasonics over some distance.

    The situation is that op amps can easily handle the bandwidth, so can power transistors. But one has to find the right devices to listen and to output ultrasonic sounds. Buying purpose built devices can be very expensive; but it appears there are ways to work around the problem.
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2011-05-30 01:59
    I read somewhere once that a capacitor could somehow be used
    to generate sound...like a speaker. I think they were talking about
    ordinary ceramic caps. Has anyone ever heard of such a thing?

    I'm clueless as to how it could work. The only sound I ever got out
    of a cap was a bang when I hooked up a tantalum backwards :-)
  • LeonLeon Posts: 7,620
    edited 2011-05-30 02:58
    I've heard of ceramic capacitors emitting a high-frequency tone, one of the materials they are made from has piezo properties. They can also generate electrical noise if they are tapped.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-05-30 10:47
    I'm always interested in new bat detector designs. This morning I'm putting together monitoring systems that will be deployed for long term bat monitoring at Fort Irwin in So. California desert. The bat detector itself is a frequency division, zero crossing type (SD2) made by Titley Scientific in Australia. I'm supplying weatherproofing for the microphone (based on the SensComp/Polaroid capsule) and for the electronics. A Basic Stamp (OWL2pe data logger) controls the timing based on local sunset and sunrise times, and also logs environmental variables: temperature, humidity and wind.

    In looking at the Nuts and Volts circuit I was intrigued by the selection of microphone, using a piezo sounder element "in reverse" as a microphone. Clever idea! But it does leave a lot to luck on the part of the circuit builder, a dogged effort to characterize different sounders to find one that works. I wonder what the frequency response is really attainable in these things? The usual ultrasonic sounders are usually quite narrowly resonant, around 40 kHz or 25 kHz or some other particular frequency. A mems sensor from Knowles, the SPM0404UD5 (Digikey) is somewhat wider band with a peak from 20 to 60 kHz. Even the SensComp capsules have quite a bit of up and down in their wideband frequency response curve, also peaking around 50 kHz.

    One thing that bothers me about the N&V circuit design is the LM354 op-amp: It's feedback is set up in the first stage for a gain of greater than 2000. (1MΩ / 470Ω) The LM358 has a gain*bandwidth product of 1 MHz, so a gain of 2000 should only be possible at up to 500 Hz, and the gain at 30kHz would roll back to about *33. The second stage is set up for a gain of around 60. Even with those rolloffs and the uncharacterized response of the sounder operating in reverse, the gain evidently turned out to be sufficient to listen in on bat calls.

    The Nuts and Volts circuit is based on the heterodyne principle. In answer to Loopy, I believe the Prop could supply the local oscillator and the mixer via the counter modules, or it could do frequency division. I don't think the Prop is fast enough to do full spectrum recording. But it coud certainly combine a great user interface into the same chip. The analog front end is still necessary, and as in all audio, the microphone is the biggest challenge of all.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-05-30 20:43
    @Tracy Allen. Thanks for your input.

    Yes that first stage - called the 'preamp' - has a rather absurdly high gain - it might be wiser to use several stages to get to a gain of 2000. But the op amp specified seems to be about right. So there seems to be some trial and error in building this, especially getting the pre-amp stage to produce useful audio. I've already mentioned that supplying 3V power is chancy, 4.5V would be better. I'm willing to work with it and modify the engineering as needed.

    I also noticed that the inputs are biased with 1 meg resistors due to this being a single supply device. I wonder if that these resistors might generate noise in the device as most low noise op amp circuits in audio mic and phono preamps avoid going that high specifically to avoid noise from the resistors.

    Reversing a piezo electric speaker obviously isn't ideal, but really allows one to be exploring on a very low budget.

    @Others
    Yes indeed, some ceramic capacitors have 'microphonic' phenomena associated with them. The fact is that as one goes up in frequency, one has to be more selective of what components they use. The average audiophile is lunatic in unnecessarily trying to select perfect components; but as one enters the range of radio frequency being selective really matters and one needs to observe what is going on with a good oscilloscope.

    Tantalum is claimed to have piezo properties creating high frequencies according to "The Art of Electronics" by Horowitz, et al.

    Ideally, having an oscilloscope and a frequency counter available would help get results a lot faster.
  • LeonLeon Posts: 7,620
    edited 2011-05-30 23:27
    I'd be inclined to use a dsPIC for a bat detector. The whole thing could be done with one chip, plus an op amp, using DSP.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-05-31 00:23
    Using a dsPIC or a Propeller is certain not a bad idea. Of course I lean toward a Propeller. Having a built-in frequency counter would improve the usefulness of the device. At some point, one arrives at the need to do more than just hear the bats, so having a digital side to the device becomes necessary with some sort of display - at least and LCD.

    I guess my main point is that this detector becomes a starting point for a nice blend of analog and digital design. Many of the principles and the acquired knowldege would transfer from processing audio signals to processing RF.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2011-06-01 14:00
    After looking at the article, I agree with the sensor element used being a hit or miss .... BUT, what if YOU were the sensor?... since your just wanting to listen to the bats anyway all you need to do is create the ultrasonic frequency within your own ear shot (low volume of course) as the sound of the bats combine with the sound that you are producing, the BFO (Beat Frequency Oscillations) become audible within your range of hearing all without using a microphone (well, your ear of course). You want to make sure that you keep the volume low, even though you can't hear it. If not for your sake, for the bats that might be detoured from the strange sound. Nobody likes a loud bat. :-)


    To test the basic theory of operation here, drive two 40Khz transmitters side by side... one at 39kHz, and the other at 41kHz.... you should audibly hear 2kHz
  • LeonLeon Posts: 7,620
    edited 2011-06-01 14:11
    Many years ago I was playing with a 40 kHz transmitter and receiver, using a 4046 PLL to detect the received signal. As soon as I switched it on my cat became very interested in it.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-06-09 07:26
    After quite a bit of research and thought about the schematic for the Bat Detector, I think I am ready to try building this. From what I can make out that, the design is likely to work, but more by good luck than by good electrical engineering.

    The schematic demonstrates a very poor understanding of op amp design and several modifications might be helpful.

    1. That 2000x gain preamp is rather absurd and beyond the ability of the opamp for the ultrasonic range.

    At best within the frequency range required, you are going to get 10-30x gain with this rather sloppy design scheme. Those of us that understand how op amp feedback really works (those who have learned how feedback enhances bandwidth by sacrificing greater gain available by the op amp) would just set the first amp at somewhere between 10-30x gain and adjust the second one to be an excellent high pass filter while providing minimal additional gain. If 20-30x is not enough, another stage might be inserted to boost the voltage further without compromising the top frequency.

    60db is the normally accepted practical limit for one stage of most audio op amps and is common with magnetic phono pickups and microphone preamps. It may be even too high for ultrasonics, but 60db is roughly 1000x, not 2000x.

    As it works out 30x voltage gain is roughly 30db, by coincidence. But the LM324 may be working at only 20x if you read and understand the PDF and provided Bode Chart.

    Additionally, if you need an extreme high impedance input due to the nature of the pickup, you can use an op amp stage at the front end in a special high impedance buffer.

    I have an article from Ellliot Sound Products at http://sound.westhost.com called 'Audio Designs With Op-amps - Part ONE" and he explains a particular nice high impedance amplifier configuration that cleaning handle any problems.

    2. Piezoelectric buzzers and speakers may actually be much wider bandwidth as sensors tha specified in documents. This may seem a bit odd, but needs someone with a good scope to investigate.

    The reason I suspect so is that there are a number of guitar players that are successfully hacking piezoelectric buzzers for use as acoustic guitar pickups. So I am thinking that they have a rather narrow resonant frequency when driven by a stable voltage, but the reception bandwidth is wider. In most cases, the ultrasonic device is intended to transmit a ping and receive the same frequency - so the documentation doesn't discuss wider bandwidth.

    3. Using 1 meg ohm resistors to set the mid-point of the audio signal is rather absurd. Sure, this may be low power. But 1 meg may add unnecessary resistor Brownian noise into the op amp. Most op amps seem to stop at 100K ohm for such purposes. So, I would waste some battery life in exchange for a better noise-to-signal ratio.

    4. The output 'buffer' is shown with a feedback loop. That may work, but standard practice is to add a 'unity gain' feedback loop in order to maintain stability.

    The only real drawback with these improvements are that you may consume a bit more power and you have have to use 5 or 6 op amps rather than the one DIP package of 4.

    ~~~~~~~~~~~~~~~~~~~~~~~

    Having gotten all that sorted out, using an op amp for an adjustable ultrasonic oscillator offers other projects, such as the means to chase away moles in your lawn or unwanted animals in your garden.

    I have no lawn or garden, but I do have a dog that insists on wanting to sleep in the building's hallway rather than in my room. So I am considering putting an ultrasonic generator in the hallway to make him prefer the quite of my room. It is worth a try and the op amp can be easily powered up to drive an 8 ohm tweeter. If you want a pulse, a 555 timer can drive the oscillator on and off. Rumors are you can even chase away loitering teenagers.

    That's all for now.
  • LeonLeon Posts: 7,620
    edited 2011-06-09 07:48
    Here is a more sophisticated bat detector using an mbed:

    http://www.circuitcellar.com/nxpmbeddesignchallenge/winners/DE3851.htm
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-06-09 09:26
    Four comments.

    Very nice bat detector, yet it is digital - once again.

    1. The scheme that I mentioned in Nuts and Volts is an analog heterodyne. This used to be the basis of AM radio receivers, but it has reasonable validity as a digital front end.

    2. The beauty of the device is that you can listen and hear what the bats are doing in real time.

    3. The project demonstrates a whole range of possibilities in hacking piezoelectric devices as sensors.

    4. The project is an interesting study of the use of op amps beyond regular audio range.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-06-09 10:54
    Here are a couple of bat detectors from Tony Messina. The first is a scanning heterodyne detector that uses a PIC to supply the beat frequency and to manage the display. Nicely documented and well engineeered. This could be a great template for a Propeller version. It is probably similar to the "mbed" detector.
    http://home.earthlink.net/~bat-detector/Scanner/

    Second is Tony's simple frequency division detector.
    http://home.netcom.com/~t-rex/BatDetector.html
    I built something like that years ago, using a CMOS CD4000 inverter operated in linear mode as the preamplifier.

    The microphone! The trouble with 40kHz (or 25 or 32kHz) transducers as microphones is that they have a narrow bandwidth and a sharp resonant peak. It is possible to widen their bandwidth out to about 10kHz by detuning them an inductor and resistor. My guess about the piezo sounder as a microphone would be that it is best at relatively low frequencies, but it is true that there are a lot of bats that vocalize in the 8 to 20 kHz range. Detuning might help those too. Knowles recently introduced a nice mems microphone (SPM0404UD5 available from Digikey) that has a relatively wide bandwidth peaked at 50 kHz.

    Another link from Tony with a caveat to bat enthusiasts about ultrasonic emissions from electronic circuits, which would include crystals and ceramic capacitors.
    http://home.earthlink.net/~nevadabat/XtalProb.html
  • LeonLeon Posts: 7,620
    edited 2011-06-09 11:00
    That PIC-based unit is completely different from the mbed design. The latter uses DSP techniques to perform a 1024 point FFT and inverse FFT. A dsPIC could do the same sort of thing.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-06-09 22:15
    Leon, I missed the link under the picture to the detailed description of the mbed. That is quite nice looking. I'm unfamiliar with the lpc1768 processor, but when I see the manual for a chip like that I am already in shock at the complexity. It is good they have things like the mbed and its code libraries to make things a little easier. It looks like the lpc1768 does not have native MAC or dsp capabilities, so it was quite an accomplishment for him to have the bat detector display a1024 point FFT.

    One state-of-the-art vocalization detector is the SongMeter from Wildlife Acoustics. It uses a Texas Instruments true DSP/processor, the TMS320VC5509A, and samples at up to 44kHz in stereo for birds, or up to 192 kHz in stereo for bats. It does not do much in the way of user interface. It records full spectrum audio onto SD cards (4 slots up to 32 Gig each). The point is to allow later analysis of the data with powerful PC programs that can identify specific calls and give estimates of total activity in programs of unattended remote monitoring.
  • LeonLeon Posts: 7,620
    edited 2011-06-10 02:27
    Like many ARM devices, the LPC1768 has a MAC instruction and has some DSP capability. It doesn't have X and Y memories like a proper DSP, though. A DSP library is available: a 1024 point FFT takes 1.014 ms at 120 MHz.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-06-10 06:49
    http://diyaudioprojects.com/Drivers/40-1310/40-1310.htm

    It seems to me that the above 'super-tweeter' would be good for an ultrasonic pickup. One might be able to squeeze more bandwidth out of it than the piezoelectric devices we have been talking about. A pre-amp with adjustable gain might help as well.

    But I also see that at least one Bat detector just uses and electret mike and seems to work well. All this seeking alternative may be rather unnecessary
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-06-10 09:48
    Interesting idea about the tweeter. Bat detector enthusiasts have evaluated a select few stock electret mics from Knowles, and came up with specific recommendations of specific part numbers. Not all had extended response above the normal audio range. I'll see if I can locate that research.

    It is hard to make a good source of ultrasonic sound. I've always wanted to make a plasma speaker. Those work by modulating a high voltage plasma in air, and the variations in heating make the waves. The "cone" has zero mass, so that it has a practically flat high-frequency response.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-06-11 01:30
    I did search for ultrasonic range sensors and mikes. At $1000 Euros, these really create a wall for the hobbyist. So all my chat about op amps and other sensor hacks is really intended for the amature without deep pockets. You can get devices that are flat from 5K Hz to 200K Hz, but at a huge cost.
  • localrogerlocalroger Posts: 3,452
    edited 2011-06-11 07:39
    Like Holly, when I was a kid I could hear some TV sets. That sound is looseness in the flyback transformer, creating a 15 KHz tone. Most adults can't hear it.

    Songbirds are capable of generating ultrasonic harmonics. My grandparents had one of the original remote control TV's where the remote worked by striking ultrasonic bells with spring-loaded hammers. One year they woke up nearly every day to find the TV on. It turned out that a mockingbird had learned to turn it on.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2011-06-11 14:12
    Some people could indeed hear the 15,734 Hz flyback buzz, but what a lot of people heard was really a coronal discharge coming from the anode of the CRT. It could be most any frequency, but was seldom above 8 or 10 kHz. If you knew what to listen for it was easy to tell it apart from anything else, as the sound was more broadly spectrum.

    My parents couldn't hear the ping from that damnable Zenith remote, but I could. They finally replaced the set when the channel rotor motor burned out. By that time I had my own set, a color TV with one color (green).

    -- Gordon
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-06-11 15:45
    Ultrasonic bells? To go with dog whistles. I wonder if the mockingbird did that inadvertently, or was it to catch a favorite show, perhaps mockingly?

    Beau mentioned that jangling keys generate a lot of ultrasound, as does rubbing dry fingers together, or vocal sss sounds. Bat researchers try to talk in normal voices, not hussshhhed, for that reason.

    The electret most often recommended for bat detectors appears to be the Knowles EK23132. Or the BT21759. The response is very flat up to 10kHz, but not well characterized above that, although they do work relatively well. Knowles proudly claims that the EK23132 was used on Mars Rover. These are not cheap--US$20 ea (Digikey, Mouser, Farnell/Newark). The Knowles ultrasonic mic, SPM0404 is characterized from 1kHz to 100 kHz, and it only costs US$4.

    Here is an interesting DIY bat detector sites with lots of links to different circuits...
    http://bertrik.sikken.nl/bat/index.html
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-06-12 01:56
    @Tracy Allen
    Excellent web site. It seems to confirm that the microphone or sensor is the most critical issue.

    Thanks for the $4 electret to 100K hz. I am now looking at trying to get the added bandwidth with possibly a OP3134 dual op amp for a front end as it will handled more bandwidth with more gain in the ultrasonic range. The only drawback is that a single voltage supply should be about 10V minimum instead of 3V.

    Yes, when I was young I could hear both the Zenith remote control ping and a steady high pitch whine from the TV. But I doubt that I ever could hear as high as 100K Hz.

    It seems that having two methods of making the ultrasound audio would be best. The heterodyne seems to be limited to around a particular range determined by the beat oscillator. Having a frequency divider, might offer a more broadband listening experience.
  • tshtsh Posts: 1
    edited 2011-09-17 04:59
    I'm not really up to speed on bat calls, but i am quite surprised that everyone to date seems to be viewing this as an analogue problem, and not making as much use of DSPs as is common in the communication industry.
    The obvious mechanism to me would be an array of PLLs looking for signals over a range of frequencies (or maybe a single frequency if you know the species already). Once a signal is detected, this can then track the sweep,monitor the harmonics and also monitor any other relevant freqiencies (such as the starting frequency for a new sweep)

    Clearly the output needs to be presented in a parametrised way to a logging unit rather than a full spectrum, but this approach ought to be more sensitive than the downconversion approach, and more real-time than FFTs.

    As an example, I worked on a radio system which scanned a 200kHz spectrum for about 20 simultaneous PSK transmissions at arbitrary frequencies. 12 years ago, this took 4 high end AD6620 DSPs - hopefully the tech is a bit more affordable now.

    DSP work is a bit beyone me, otherwise i might be tempted to pursue this a bit more.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-09-18 05:27
    Happy to see your comments. Originally I was excited by seeing a scheme that used the super-heterodyne approach, which I could understand. But in the back of my mind, I also was curious what has superseded it.

    For many of us, digital approaches have left us behind - not knowing how to catch up.

    There are indeed many ways to create a bat detector and yours might be the most desirable, but all of them have contributed something to learning how things are done with modern electronics.

    Thanks. I'll try to explore your suggestions.
  • LeonLeon Posts: 7,620
    edited 2011-09-18 05:52
    With a suitable sensor a small dsPIC such as the 18-pin 40 MIPS dsPIC33FJ12GP201 could be used to down-convert the signals so that they are audible. It could also perform an FFT and display the results. Here is a little PCB I've designed and made at home that could be used:

    http://www.leonheller.com/Designs/dsPIC33FJ12GP201/proto(Page1).pdf

    http://www.leonheller.com/Designs/dsPIC33FJ12GP201/dsPIC33FJ12_pcb.gif
Sign In or Register to comment.