Maker Pro
Maker Pro

Building a Frequency/Sound Generator

Hi

I'm trying to build a system that can generate and record sounds within the range of about 0 - 50 or 55kHz.

The aim is to be able to produce sounds that e.g. rats can hear.. and possibly even mimic or play back recordings of rat sounds using the system. Would be interesting to record a rats response too .etc. Hence why we need both a way to generate sounds and record sounds. Also apart from this it would be interesting to build a frequency generator from an electronics/hobbyist perspective! :)

With regard to producing the sound is it as simple as hooking up a transducer/speaker to e.g. an arduino or a microcontroller of some sort and generating the frequencies using the microncontroller's pwm/timer outputs on a pin? This will produce square waves though as opposed to sine waves but still of the correct frequency right? Or do I need to use Fourier series and think of all the sine waves and harmonic frequencies that are also being produced..? Not sure if that makes sense or if I understood fourier series properly so feel free to correct me where I'm wrong.. May need an amplifier here too?

Does anyone know how the loudness of e.g. transducers change with regards to the different frequencies being produced? E.g. I've looked at normal speakers and whether e.g. hooking up a function generator to a speaker would work for what I'm trying to do but from my understanding normal speakers aren't designed to produce ultrasound? And the loudness decreases I think sharply above e.g. 20 or 22kHz since humans can't hear above these frequencies?

In terms of being able to record sounds.. Can this be done by using a transducer once again but this time it converts the sounds to electrical signals and I can just read this using e.g. an Arduino ADC pin and if I wanted to be able to e.g. hear any recorded ultrasonic sounds could the frequencies just be scaled down to the audible range by e.g. dividing by 8 or 16 or by subtracting e.g. 20 kHz if we're interested in frequencies in the 20 - 40 khZ range?

I don't know much about this topic and not sure where to begin with regards to circuit designs. Not sure if the system will be as simple as I mentioned or whether e.g. it will be more complicated and will require e.g. amplifiers, microphones, speakers.etc. Tried some books in the library but none had any practical information and circuit designs.. :/

Sorry if my post is a bit long! Any circuit designs or useful links would be much appreciated. :)

Thanks for your help :)
 
I found this unit and I wonder if you could modify it. It is only rated at 40Khz but might work.
http://www.ebay.co.uk/itm/like/1812...ff3=1&ff11=ICEP3.0.0&ff12=67&ff13=80&ff14=102
What your planning is total achievable but you might need to built a bit of circuitry to amplify the sound coming back and also an amplifier for the output. You can also buy these transducer separately if you can't find a kit that will do the job.

Another option would be to use what's called a BFO (beat frequency oscillator). this will down scale the frequency to say 1000Hz for you to hear. One thing they use this for is Morse code.
Thanks
Adam
 

Harald Kapp

Moderator
Moderator
Adam, the module you linked to seems to operate on a fixed frequency. There is only a trigger input and an on-board resonator. I doubt that this unit can be modified easily for different (or even varying) frequencies.

To the op:
A single transmitter (e.g. "T" from this pair) could be used. You need a driver circuit to control the transmitter from the arduino. I think the arduino can directly generate the required output signal (frequency) on a port pin or a timer output pin where the timer is programmed to the desired frequency.
Note that a piezo will not be able to reproduce sound noticeably below a few kz. Therefore yur requirement 0Hz... 55kHz cannot be met. More likely 10kHz...55kHz if you accept different sound volumes for different frequencies (the piezo will be loudest at its resonant frequency).
As for the waveform I think in this application you don't have to care for a pure sinewave. Generating this from a digital signal is possible, but requires some effort. The square wave otput by a microcontroller is probably o.k. if you can accept the resulting overtones.

On the receiving end you will have to amplify the signal from the piezo as it will not have enough amplitude to be used with the arduino's inputs directly. You can use e.g. the receiver part of this circuit (left side up to and including T2). Try this circuit with 5V instead of 9V. If it doesn't work, you will have to tweak some resistor values, or use 9V and divide the output signal to a save 5V level for the arduino.

To make the received signal audible, a BFO as mentioned by Adam can be used. In my view, however, a BFO has a serious drawback. A BFO subtracts a fixed frequency from the input signal. Assuming an input signal range of 20kHz...50kHz, the resulting output frequency could be at best 0Hz...30kHz (subtracting 20kHz). Man's ear can resolve 20kHz at best, typically 15kHz only. So about half of the interesting frequency range is still no audible.
If you use a frequency divider instead, the range will be compressed. Assume a divder by 4, then the input range 20kHz...50kHz scales to 5kHz...12.5kz - perfectly audible.
You can perform the divide by 4 action in hardware (CD404 chip or 74HC74, see tutorial here). You may also be able to perform the division in the arduino's hardware using a timer set up as divde-by-4 timer or even in software (which will probably generate a high CPU load).


Here is a schematic for Tx and RX using piezos.

An interesting alternative for the receiving end is shown here.
 

KrisBlueNZ

Sadly passed away in 2015
I'm no expert but here's a brain dump that may be helpful.

I agree with Harald that frequency shifting isn't going to be of much use.

If you want to record and reproduce a frequency of n Hz, you need to sample at at least 2n samples per second, according to the Nyquist theory. This is an ABSOLUTE minimum sampling rate. If you want to record and reproduce a 55 kHz signal you should sample at AT LEAST 110 kHz, preferably quite a bit higher.

Some professional and semi-professional sound recording equipment can sample at 192 kHz but I expect the analogue input and output stages will have a cutoff frequency well below 55 kHz. So you would have to modify the circuit. Probably not worthwhile.

Check the maximum sample rate of the ADC in the AVR device you plan to use. It may not be able to sample that fast. An external ADC may be needed. Some ADCs can be configured for faster sampling if you reduce the number of bits of resolution.

To recreate the signal you should use a DAC. Using a timer output is probably not practical. You could use PWM with smoothing, but the frequencies involved are pretty high and you probably wouldn't get more than 3~4 bits of resolution. A DAC is a much better option. Some AVRs have them built in.

As for transducers, I have no experience here. No normal microphone or loudspeaker will record or reproduce frequencies up to 55 kHz. You'll need a special device. Anything that's specified up to such a high frequency should include a frequency response graph in the documentation. You can use that to see how flat the response will be over that frequency range.

Good luck!
 
Here is a schematic for Tx and RX using piezos.

Interesting schematic. Can you please explain the RX circuit a little. What's the purpose of the 100K pull up? Are these piezos of mini speakers? With no sound on the input is the transistor on all the time from the pull up. Do you need a pull down on the base to make sure it's off. Am I correct in assuming the zener is so you can drive a devices input that is powered from 5Volts.
Thanks
Adam
 
Last edited by a moderator:
Top