communication between computer using sound waves
gaurav89
Posts: 4
I am trying to wrapping information in sound waves and then playing sound then recording and unwrapping information using fft.
for this i am using 3 frequencies 5000hz, 6000hz, 7000hz and sampling frequency 16000hz.
5000hz frequency for value '0', 6000hz for value '1' and 7000hz for seperating two values and playing each frequency for 100ms.
example for sending '110' the sound wave will be having frequency in order
(6000hz for 100ms) then (7000hz for 100ms) (6000hz for 100ms) then (7000hz for 100ms) then (5000hz for 100ms)
for unwrapping information i am using fft.
for the duration of 100ms of each frequency it is giving correct result but
for 10ms duration of each frequency it is giving errorneous result.
it is giving errorneous result for recorded sound wave and also for original signal.
what can be the reason behind this. i am using matlab.
thanks
gaurav
for this i am using 3 frequencies 5000hz, 6000hz, 7000hz and sampling frequency 16000hz.
5000hz frequency for value '0', 6000hz for value '1' and 7000hz for seperating two values and playing each frequency for 100ms.
example for sending '110' the sound wave will be having frequency in order
(6000hz for 100ms) then (7000hz for 100ms) (6000hz for 100ms) then (7000hz for 100ms) then (5000hz for 100ms)
for unwrapping information i am using fft.
for the duration of 100ms of each frequency it is giving correct result but
for 10ms duration of each frequency it is giving errorneous result.
it is giving errorneous result for recorded sound wave and also for original signal.
what can be the reason behind this. i am using matlab.
thanks
gaurav
Comments
a different approach such as a PLL, or some tuned filters.
How big is your FFT? What is your sample rate? Are you actually transmitting and receiving sound, if so what's the hardware set up. If not is coming from a file or what?
Having some code to look at might help but as it is MATLAB this is not the right forum for that discussion. And so on and so on.
Is this a homework exercise?
Because using an FFT to do this is not the way to do it.
A simple way to do this, given that you have an signal with the tones in it is:
1) Have the receiver code generate an internal sine and cosine wave form at one of those tones frequencies and the same sample rate.
2) Multiply each incoming signal value by the current value of the sine function being generated. Do the same for the cosine function.
3) Keep a running total of the results of those multiplications.
4) Calculate a magnitude from the running totals by dividing each one by the number of samples received so far, squaring each one, adding them together and taking the square root.
You will find that if the tone is present in the signal that magnitude will grow to a positive value representing the amplitude of the signal.
If the tone is not present, or some other tone is in the signal the magnitude will go to be zero. So you can detect if the tone is present or not.
Do the same steps for the other two tones and you have your decoder.
This is effectively what the FFT does, except it does it for all frequencies in the signal not just the tones you are looking for. Hence is a very inefficient way to do it. Overkill.
You will find your running totals will start to run toward infinity and your number system overflows. When you get that far it's time to discuss that issue.
One could use ultrasonic devices intended for ultrasonic rangefinders. You need a carrier frequency and a lower data rate. So if your carrier was something like 35,000Khz, you might just plug along with 19,200baud in an asynchronous format and the whole would be rather easy to build as your serial would be done for you.
Still, it isn't very dazzling spend when IR data will go much faster, and BlueTooth can sizzle 3Gbits.
Besides, your dog might become quite offended and leave for quiter surroundings, though I hear that you won't have mice, gophers, or cockroaches.
Hi gaurav
Cool project. Please be patient with heater, he is a local expert on fft, but forgets that some of us (in fact most of the planet) is not. Otherwise he is very nice and helpful.
If it works after 100ms, but does not work after only 10 ms, doesn't that say that the minimum sample time is greater than 10ms?
After the above, if you are having a problem with the original sound, could it have something to do with the physical placement of the transducers? The waves reflected off the table and walls?
From the information given I guess minimum sample time and room geometry are candidates for investigation.
http://en.wikipedia.org/wiki/Kansas_City_standard
Acorm computers managed to get this down to
Acorn computers managed to get this down to 2 cycles of 2400 for a 1 and 1 cycle of 1200 for a zero and a data rate of 1200 baud.
Besides that's how good old modems work.
Not sure why he needs three tones though the separator is redundant.
This is the same but working through air, which will bring the attendant problems of noise etc.
I always wanted to do computer to computer comms with Morse code just for the heck of it:)
Just the school maths result that if you multiply two sine waves of frequencies F1 and F2 together and average the result over an infinite amount of time you will get zero, except when F1 = F2 at which point you will get 1.
So if F1 is your reference tone and F2 is your incoming signal you can use the above to tell if the incoming tone is present at the reference frequency or not.