I wanted to ask what exactly is meant for phase recovery of signal (at least intuitively). I have a working example of an acoustic fsk modulation and demodulation software but i don't know how to apply these techniques to improve the detection of the signal. The center frequency is 30Khz and demodulation is done in passband.
In the following i will briefly explain how it works:
1- Send a chirp, used from the receiver to find the beginning of the signal
2- Wait for a fixed amount of time, known also to the receiver
3- Send the modulated signal
4- Send a final chirp
The receiver after i get the correlation v with the chirp, i buffer data, isolate the signal until the end of the second chirp.
Now at the processing part my doubts are the following:
If the two nodes run the same clock i would know perfectly where the signal starts from the end of the first chirp, after the fixed period of pause. In this case the signal i try to demodulate would have no phase shifting, correct?!
If my clocks run differently, i will reconstruct a different signal, right? If yes, why is shifted in phase? Or what does it mean shifted in phase in such case. Can you point me out how to adjust, if possible, this offset or to know where to sample the signal? Is this effect something like a Doppler?
Please consider that my demodulation is in passband and i don't know if there exists any methods which would not require baseband transformation.
Thanks in advance
You seem to have experimental setup where Tx and Rx are clocked by same clock.
Then you can -I assume- ignore all remote comms issues as your case becomes a case of small single digital system.
Thanks for the reply. Onestly i dont correctly understand what do u mean by reomote comms. Tx and Rx can run in different platforms, e.g., pc and embedded devices. Indeed, what i experience is that for long messagges and high data rate i lose precision when i sample the correlation peaks of the two tones. Seems that are not equally spaced to the one sent.
For wireless comms only data is sent. for wired systems data only or data and its clock are sent.
If clock is not sent, it has to be recovered. If it is sent you need to check if there is delay difference or drift.
your setup seems wired connection with data and clock sent from tx to rx. Data at Rx will always arrive with some latency due to registers, buffers, etc. This latency will vary with length of connectors, temperature, clock jitter..etc.
In short you need to tell us more about your problem and setup
I do agree that a more complete description of the setup would be very helpful.
But note that atorres stated in his initial posting that this was an _acoustic_ channel operating at 30kHz. This suggests strongly to me that he is trying to use a pair of ultrasonic transducers (see for example Murata MA40S4R although that one operates at 40kHz) with possibly significant physical separation between transmitter and receiver, and no wired connection between them. Since at sea level in dry air, sound travels at approximately 343 meters/second, there will be a possibly quite significant time delay between when a signal is sent and received. Such a channel will also have to deal with the possibility of echos (if for example deployed in a room). A 1 meter separation between transmitter and receiver results in a roughly 3 millisecond path delay.
So there's lots of opportunity for variation in the delay (and thus phase) between what is sent and what is received.
(On a "spec" basis, I once built a 40kHz-carrier acoustic channel using simple FSK running at about 300 baud, half-duplex "RS-232-like". Room echos were a huge problem especially if someone was walking about in the room. The project achieved a 5 meter range, which was the upper bound on what the client wanted, he'd have settled for 1 meter. So, yes I have "been around the block" a time or two.)
Yes you are right, more precisely underwater comms in which speed of sound is greater.But yet mulitpath is still present and a big issue. We used to put some pause period between a symbol and another to address this effect to, or use a hopping pattern in frequency. However, i am not a signal processing guy, but i do not understand what is meant by phase changing when the propagation time is high. The phase changes is due to the tx and rx not perfect clocks or someother properties?
Sorry if i made a confusion,
thanks again. In practice my system is wireless, communication between two laptops using acoustic waves. What i do at the transmitter is to generate a signal, latter on converted in wav file or transmitted using alsa, which contains a chirp from a frequency f1 up to f2 for 10ms, after the chirp there is no signal, for lets say other 10 ms and latter on i transmit the data where a tone lasts 512/48000 s. Based if its 1/0 i transmit two sin waves for the above period of time. After this i retransmit the chirp as the end of the packet.
At the receiver side, i have two buffers, each of them with size as many samples required for the chirp signal of 10ms. Using them in a rotation way i cross-correlate the incoming signal to find the peak. As soon as i find the peak which corresponds to end of the chirp, i buffer all the samples to isolate the incoming signal for latter processing, until i find the end of the second transmitted chirp in the end of the packet.
In such way lets say i have a signal which has a period known with no data to demodulate, the fixed period between the end of the chirp and starting of the modulated data(sines), and the data modulated in the two frequencies.
Knowing the exact time, in terms of samples, between the end of the chirp and the start of the signal, i just remove them from the buffer and in theory i should have a signal in which i need to check the energy in each frequency jumping inside a signal with an window of size 512 samples ( known configured bit/rate = symbol/rate, working at 48000). In this case i try to demodulate correctly but it might happen than my receiver sampling frequency, although is set to 48000 might not work correctly at that frequency. So my start of the signal is different, and moving with the fixed windows (of size of 1 bit in ms) i might get erroneous position on the signal.
Lets assume that i know also the number of bits codificated in the signal, is there any way to understand correctly where the signal starts and how many samples are now required to correctly represent a bit, in which i check for the energy.
Hope this provides a clearer vision,
you have two areas to check.
(1)is the sampling rate matching between Tx at the module you generate your signals and Rx at the point you sample it back.
(2) is there any frequency shift (by design) as you pass from tx to rx.
if these two are same between Tx and Rx then check if clocks are tied up(not drifting). Tx and Rx clocks may drift due to tolerance, temperature...etc even if their nominal values are same
For the first point i have to make sure that the both of the system perform the requested sampling rate.This can cause me a frequency shift. I dont understand the second point and why the third consideration is different from the first point.
Thanks for your patience.
I am referring to general digital principles. So if you are using tools and their own setup then you are best to hear from people who are familiar with your setup.
1) sampling rate is distinct from system clock but may equal it and be same if data is sampled every clock.
2) frequency shift becomes an issue if you are looking to compare two signals against each other such as correlation. Both signals have to be on same centre. You can frequency re-shift in your analysis.
Thanks Kaz. Can you please provide an example where a shifting in phase occurs even if the sampling clocks are stable. I was thinking for an example like this: Suppose I tx a sine wave
at 1 Hz, stable sampling rate 2Hz. The receiver its 6 m away from the
the Tx, speed of 2m/s. The beginning of the transmitted message would
require 3 s to the rx. Now the sampling clock of the receiver might not
detect the exact beginning of the message but at maximum will sample 0.5
seconds latter resulting in a sine that starts of an phase offset of 90
degree. Makes sense? If yes, if i increase my sampling rate at rx i
would have sampled almost a signal in phase, except for the first tick
might loose which would a be small offset in phase. So i can have a shift phase if the beginning of the message starts between two tick clock. Am i correct?
I think We are going sideways.
Fixed time delay of a signal leads to delay of any frequencies in a linear way and so is not a problem for "mixed frequency" signals as all frequencies appear in same relative phase.
If it was a problem then all our radios,tvs...ears, etc would have to be redsigned.
Your issue seems around single waveform application. naturally you will have fixed delay of channel. Additionally you are talking about a sampling rate of 2Hz and frequency of 1 Hz then such sampling is too coarse and will add to delay and in a variable way depending on where it hits the analogue waveform. In fact you may also get variable amplitudes of zero to +/-1 as it hits anywhere between the mid points or peaks.
So you need to clarify what actually you think you need help to understand or what is that you think is wrong as I am a bit lost...
Kaz, thanks again for ur reply and patience. For a non dsp guy some concepts are hard to follow, unfortunately. Below i describe my system so far so maybe provides a clear explanation and if possible u can provide some hints how to improve. I am using sound cards, through alsa, to transmit acoustic waves using an underwater transducer centered at 30 Khz. For the moment i use a sampling rate at 92Khz and a tone is composed by 512 samples, which leads aprox 187 bits/s using two tones at 31 and 29 Khz. Initially i generate a chirp, write to a buffer, of 10ms, 2024 symbols of pause and the latter on the data. All this buffer is passed to alsa which takes care to build the signal and output it.
At the receiver side i fill a buffer with size twice as the one of chirp, and i do a cross-correlation to find the peak. If not the second half of the buffer becomes the first, and i fill it with new data. So doing this circular, i am able to process all the data and to find the peak. As soon as i find the peak i bufferize all the data coming from alsa, till i found the second chirp, the end of the signal. Now i have a buffer which contains my signal-data, knowing the period of pause 2024 i just remove this samples and start to demodulate the remaining buffer. What i experience is that removing 2024 i may not get the exact beginning of signal(maybe due to a wrong correlation with chirp?!). It happens to start to demodulate before or after right signal begins. Then if i decrease the symbols per bit, i lose precision as the number of bits increase, because it seems that the size of different tones, in term of samples, is different of the one transmitted.
This is done in passband and i dont know which technique to use to improve efficiency.
That is clear enough...to me now, thanks
Your system is not familiar to me but I can suggest:
1) check that you are indeed sending chirp then signal regularly as described, directly at Tx.
2) check sampling rate is same at Tx and Rx otherwise you need to convert the rates to become same
3) check your correlation is correct. Can't you display your signals directly.
Thanks to u Kaz, for your effort.
1- Yes, i think, because all the data are buffered and latter transmitted. So i suppose all the data are correctly transmitted.
2. What do you mean to convert sampling rates, to align them, somehow. I think this might be the point, both are set to the same sampling rate but who knows if there offsets or no. This causes phase and freq offset? Do i need a PLL at this point?
3. What do u mean by display signal directly?