DSPRelated.com
Forums

Synchronous AM demodulator

Started by spooky April 12, 2005
robert@suesound.co.za wrote:
> Hi pmd, > > If you delay the signal by 90 deg and then take the square root of the > sum of the squared original and the squared delayed signal you should > get the amplitude. > > The delay could be fixed because because you are using an IF frequency > that is fixed. > > JAT > > Regards > Robert
1. That is a good approximation to the extent that the signal is very narrow band. Delaying the carrier by 90 degrees then delays the sidebands by approximately 90 degrees. 2. That isn't synchronous demodulation, which is what the OP asked for. (Why?) Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
>spooky wrote: >> Thank you for your reply but I still don't really get it. >> >> If I multiply the signal by a square wave that is in phase with the >> carrier I get the absolute value of the sample - so I don't really
need
>> to generate a square wave, I can simply get the absolute value of the >> sample or am I wrong? Or should I multiply it by a square wave that is >> shifted by PI/2 to null the DC part? >> >> Generating a square wave should not be that difficult. In the 0 - 2PI >> interval if the phase is below PI the sample value is 1, else the
sample
>> value is -1. All you need to do is correctly update the phase according
to
>> the desired frequency of the square wave. That's just my idea I might
be
>> wrong. >> >> Thanks for all your help in advance. > >If you derive the square wave from the actual signal, then yes: absolute
>value is the same thing in most cases. Maybe you should think about -- >and we should discuss -- why synchronous detection is wanted. > >Jerry >-- >Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� >
I want synchronous AM because of its better performance even if the carrier is in deep fade. I was thinking of it and made some experiments: If I derive the square wave from the original carrier I really get the absolute value. But this is not synchronous demodulation just an envelope detector and its performance is really poor if the carrier is in fade. The idea of synchronous AM demodulation as I understand it is to replace the original carrier by a synthetized one. When I did it with a square wave as you recommended I got far better results. Now I need to achieve phase synchronization. I will google for Costas loop as you recommended in one of your other posts in this thread. Thank you again you helped me a lot! This message was sent using the Comp.DSP web interface on www.DSPRelated.com
spooky wrote:

   ...

> I want synchronous AM because of its better performance even if the > carrier > is in deep fade.
Exalted carrier does that rather well. A variation on that uses a PLL to match the carrier phase and adds it coherently to the signal, riding out the fade. I think of these schemes as pseudo-synchronous detection because the demodulating signal is not independent of the information signal. I can't say that anyone shares my view.
> I was thinking of it and made some experiments: > > If I derive the square wave from the original carrier I really get the > absolute value. But this is not synchronous demodulation just an envelope > detector and its performance is really poor if the carrier is in fade.
A very narrow filter centered on the carrier and enough gain can help a lot. With an extra 30 dB of gain at the carrier frequency before extracting the sign bit, you can ride out 30 dB of carrier fading before demodulation fails. With that much carrier fade, the sidebands will hardly be useful. The method has a major shortcoming. An FIR filter will be too long to be practical, and an analog or IIR filter will shift the phase if slightly detuned. This is not a problem with one sideband, but causes audio distortion when both sidebands are present. (A 90 degree shift converts the signal to NBFM!) One scheme, probably older than I and certainly older than transistors, is demodulating the sidebands separately and choosing the one that's better at the moment.
> The idea of synchronous AM demodulation as I understand it is to replace > the > original carrier by a synthetized one. When I did it with a square wave > as > you recommended I got far better results. Now I need to achieve phase > synchronization. I will google for Costas loop as you recommended in one > of > your other posts in this thread. > > Thank you again you helped me a lot!
I'm glad to have been able to. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Jerry,

pardon if it was me to top-post my answer. Surely i did not want it!

Please allow me some additional comments to this thread. While a location
like "comp.dsp" IS of course the right place to discuss fundamentals of
modulation and demodulation techniques, i get the impression that a lot of
questions do not ask for a explanation of the fundamentals but instead
people want to know "how to do this or that" by means of dsp.

Also in this case the problem was

> >>>I want to make a program that does synchronous AM demodulation
Since it was clear that a software solution is asked for, you should not have suggested things like a lock-in-amplifier. Instead you should have suggested the dsp equivalent of a lock-in-amplifier and the more i think about it, a lock-in-amplifier should be a easily done in dsp. While certain hardware devices and techniques may have a direct software equivalent, others have not! And one of the very first things that i have learned when i started with dsp demodulation techniques is that the idea of a square wave signal has better to be avaoid in dsp processing. Not only that a square signal reduces the amplitude information to 1 bit (= a reduction of information!), in addition the key information of a square signal, namely the position of the zero crossings and therefore the signal's frequency cannot be properly represented by means of a system based on time discrete samples. Only in the case that the sampling frequency is a integer multiple of the square wave's frequency and that the square waves phase is so that the Amplitude changes appear exactly at the sampling points chances are for a correct dsp representation of a square wave but not in general. That is why i asked you how you would generate a square wave at the carrier frequency that most probably does not have these properties. There is another thread running discussing the question how large the sampling frequency has to be to accurately determine the frequency of a square signal by dsp methods. For the reasons above i think this is a "wrong" question, at least as far dsp is concerned. Best regards Ulrich "Jerry Avins" <jya@ieee.org> schrieb im Newsbeitrag news:vqKdnXKDo6W0_MDfRVn-vw@rcn.net...
> Ulrich Bangert wrote: > > Good idea Jerry, that is exactly what a hardware synchronous AM
demodulator
> > does! > > > > Can you also explain how to generate a square wave at the carrier
frequency?
> > I do not think, this is a trivial questions, since we are always talking > > about amplitude-discrete AND time-discrete signals in comp.dsp or are we > > not? > > > > Best regards > > Ulrich Bangert > > > > > > "Jerry Avins" <jya@ieee.org> schrieb im Newsbeitrag > > news:l9GdnSHOnuDzbMbfRVn-qg@rcn.net... > > > >>spooky wrote: > >> > >>>Greetings. > >>> > >>>I want to make a program that does synchronous AM demodulation. > >>> > >>>I can't seem to find any good descriptions on the net how this is done. > >>>Could somebody please explain it, or point me to some resources? > >>>Thanks in advance. > >>> > >>> > >>> > >>>This message was sent using the Comp.DSP web interface on > >>>www.DSPRelated.com > >> > >>Multiply the signal by a square wave (+/- 1) at the carrier frequency. > >>The phase which produces a DC null is in quadrature with the phase for > >>demodulating. > >> > >>Jerry > >>-- > >>Engineering is the art of making what you want from things you can get. > >>&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295; > > Top posting makes a thread hard to follow, at least the way I read one. > Since the lines I write go down the page, I find following simpler when > the discussion itself doesn't go the other way. > > In order to have synchronous demodulation, there must be a synchronous > signal. I assumed you had that. (One often does. A lock-in amplifier is > an example.) You can derive the synchronous demodulating signal with a > PLL. (Costas loop, probably). If the carrier is quite stable, you can > extract it with a narrow filter and clip it. (That's an old technique > known as "exalted carrier reception.") > > Jerry > -- > Engineering is the art of making what you want from things you can get. > &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Ulrich Bangert wrote:
> Jerry, > > pardon if it was me to top-post my answer. Surely i did not want it! > > Please allow me some additional comments to this thread. While a location > like "comp.dsp" IS of course the right place to discuss fundamentals of > modulation and demodulation techniques, i get the impression that a lot of > questions do not ask for a explanation of the fundamentals but instead > people want to know "how to do this or that" by means of dsp. > > Also in this case the problem was > > >>>>>I want to make a program that does synchronous AM demodulation > > > Since it was clear that a software solution is asked for, you should not > have suggested things like a lock-in-amplifier. Instead you should have > suggested the dsp equivalent of a lock-in-amplifier and the more i think > about it, a lock-in-amplifier should be a easily done in dsp.
I did not suggest a lock-in amplifier as an answer to the OP's question. I cited it as an example of synchronous detection in which the modulating and demodulating carriers are derived from the same source.
> > While certain hardware devices and techniques may have a direct software > equivalent, others have not! And one of the very first things that i have > learned when i started with dsp demodulation techniques is that the idea of > a square wave signal has better to be avaoid in dsp processing. Not only > that a square signal reduces the amplitude information to 1 bit (= a > reduction of information!), in addition the key information of a square > signal, namely the position of the zero crossings and therefore the signal's > frequency cannot be properly represented by means of a system based on time > discrete samples. Only in the case that the sampling frequency is a integer > multiple of the square wave's frequency and that the square waves phase is > so that the Amplitude changes appear exactly at the sampling points chances > are for a correct dsp representation of a square wave but not in general. > That is why i asked you how you would generate a square wave at the carrier > frequency that most probably does not have these properties.
The square-wave signal I proposed consists of reversing the sign of the received signal whenever the sign of the demodulating carrier crosses zero. That is nearly, but not exactly, the same as taking the received signal's absolute magnitude. Surely, you can see no difficulty with such a standard technique.
> There is another thread running discussing the question how large the > sampling frequency has to be to accurately determine the frequency of a > square signal by dsp methods. For the reasons above i think this is a > "wrong" question, at least as far dsp is concerned.
That thread is a morass of unstated assumptions and undefined constraints. If I know /a_priori/ that the waveform is square, the question has a simple answer. If edge-sensitive capture registers are tools in your DSP world, no sampling is needed at all. Etc.
> Best regards > Ulrich > > > "Jerry Avins" <jya@ieee.org> schrieb im Newsbeitrag > news:vqKdnXKDo6W0_MDfRVn-vw@rcn.net... > >>Ulrich Bangert wrote: >> >>>Good idea Jerry, that is exactly what a hardware synchronous AM >>>demodulator does!
I trust you intended that as sarcasm. Note that the OP wrote that he found it helpful.
>>>Can you also explain how to generate a square wave at the carrier >>>frequency?
Having exactly the carrier frequency is central to synchronous demodulation. Ideally, the OP would not be asking about synchronous detection without it. My answer was intended in part to examine whether the detection the OP wanted was truly synchronous, or pseudo synchronous, without seeming to insult. BTW, the lock-in amplifier served to illustrate the difference.
>>>I do not think, this is a trivial questions, since we are always talking >>>about amplitude-discrete AND time-discrete signals in comp.dsp or are we >>>not?
Yes. If also discrete in frequency, then even pseudo synchronous detection can not always be done digitally. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Jerry,

...Snip

> The square-wave signal I proposed consists of reversing the sign of the > received signal whenever the sign of the demodulating carrier crosses > zero. That is nearly, but not exactly, the same as taking the received > signal's absolute magnitude. Surely, you can see no difficulty with such > a standard technique.
What you suggest here is common business in dsp. In addition i would have thought that it exactly and not only nearly the signal's absolute magnitude. Just because if you would sample a signal that has already been "rectified" in the analog domain at the same points in time you would get pretty much the same results as if you had sampled the "unrectified" and applied your rule. But if i am wrong, feel invited to correct me. Nevertheless, what you suggest is a rule that can be applied to every single sample without any hassle and therefore it is a dsp-compatible rule. And to my mind this is a different quality than to say "generate a square wave at the carrier's frequency" because this is a dsp-incompatble rule. ...Snip
> That thread is a morass of unstated assumptions and undefined > constraints. If I know /a_priori/ that the waveform is square, the > question has a simple answer. If edge-sensitive capture registers are > tools in your DSP world, no sampling is needed at all. Etc.
In my job i need to develop hardware AND software for stuff that is used with air pollution measurements and from that experience i know that some things are more easily done in hardware than in software and others are more easily done in software than in hardware. So i would agree that in some cases a edge-sensitive capture register may make a lot of sense. A lot of microcontrollers have edge-sensitive capture registers, we both know that. But the real clue of the edge-sensitive capture register is that it performs a action WITHOUT the slightest software interaction necessary. Therefore it belongs to my "hardware world". In contrast to that i see dsp as something that can at least in principle be done with a pencil and a sheet of paper and some kind of "brain". Given that equipment, it can be described what the capture register does but it can not been performed what the capture register does. In contrast all dsp actions can really be performed with this equipment. Therefore edge-sensitive capture registers are not tools in my dsp world. But to be honest, i do not want to make the discussion too philosophical. Best regards Ulrich
Ulrich Bangert wrote:
> Jerry, > > ...Snip > > >>The square-wave signal I proposed consists of reversing the sign of the >>received signal whenever the sign of the demodulating carrier crosses >>zero. That is nearly, but not exactly, the same as taking the received >>signal's absolute magnitude. Surely, you can see no difficulty with such >>a standard technique. > > > What you suggest here is common business in dsp. In addition i would have > thought that it exactly and not only nearly the signal's absolute magnitude. > Just because if you would sample a signal that has already been "rectified" > in the analog domain at the same points in time you would get pretty much > the same results as if you had sampled the "unrectified" and applied your > rule. But if i am wrong, feel invited to correct me. Nevertheless, what you > suggest is a rule that can be applied to every single sample without any > hassle and therefore it is a dsp-compatible rule. And to my mind this is a > different quality than to say "generate a square wave at the carrier's > frequency" because this is a dsp-incompatble rule.
If the sign of the signal is constant during each half cycle of the demodulating carrier, then reversing the sign and taking the magnitude amount to the same operation. In the presence of noise or phase shifts, it may not be. As you wrote, it is usually pretty much the same.
> ...Snip > > >>That thread is a morass of unstated assumptions and undefined >>constraints. If I know /a_priori/ that the waveform is square, the >>question has a simple answer. If edge-sensitive capture registers are >>tools in your DSP world, no sampling is needed at all. Etc. > > > In my job i need to develop hardware AND software for stuff that is used > with air pollution measurements and from that experience i know that some > things are more easily done in hardware than in software and others are more > easily done in software than in hardware. So i would agree that in some > cases a edge-sensitive capture register may make a lot of sense. A lot of > microcontrollers have edge-sensitive capture registers, we both know that. > But the real clue of the edge-sensitive capture register is that it performs > a action WITHOUT the slightest software interaction necessary. Therefore it > belongs to my "hardware world". In contrast to that i see dsp as something > that can at least in principle be done with a pencil and a sheet of paper > and some kind of "brain". Given that equipment, it can be described what the > capture register does but it can not been performed what the capture > register does. In contrast all dsp actions can really be performed with this > equipment. Therefore edge-sensitive capture registers are not tools in my > dsp world. But to be honest, i do not want to make the discussion too > philosophical.
Ulrich, You bring up a point that is necessarily philosophical. An edge-triggered capture register is surely a bit of hardware, but it is just as surely part of a programmable processor, and digital. The philosophical question is, does "digital signal processing" mean processing signals by digital means, or is its meaning confined to those operations that can be performed on any programmable computer? If we espouse the second view, how should we classify a codec? I believe that you are and I was good at what we do. Being good requires that we use the best and simplest tools at our disposal. I agree that it doesn't matter very much how we classify them. jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;