Announcement

Collapse
No announcement yet.

Digital I/Q demodulator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Digital I/Q demodulator

    Hi,

    I have question about how to perform the I/Q demodulation in a digital metal detector. In analog detectors this is commonly realized by using two comparators which trigger an analog switch
    on the positive/negative peak of the osicllator's sine wave.

    But how is this done in digital metal detectors which generate the TX signal with a numerically controlled oscillator?

    Here are some ideas I could think of:

    Solution #1:

    I generate the TX signal using direct digital synthesis - so I theoretically know the phase and amplitude of the TX signal which goes out of the microcontroller. The "cheapest" way to obtain a 90 degree phase shifted signal would be to just derive it from the DDS generator.

    But is this feasible? Because I'm not sure whether what I generate digitally has the same phase when it goes through the TX coil, also timing might become an issue.

    Solution #2:

    I tap the TX signal directly before or after the TX coil using a voltage divider and sample the RX and TX signal simultaneously. In this case I need to shift the tapped TX signal by 90 degrees in software, since the tapped TX signal only gives mit the I (in-phase) component, doesn't it?

    In this case I could think of multiple solutions how to phase-shift the signal in software:

    - Keeping a software PLL (costa's loop?) in sync with the tapped TX signal and derive an out-of phase signal digitally
    - Taking a sampling window of the tapped TX signal wide enough to contain 180 degrees so I could split it in two parts, each 90 degrees apart.
    - Applying a hilbert transform (complicated?)
    - Using FFT (expensive?)

    Unfortunately I haven't found any source code of existing projects, therefore I wonder how this is done in existing digital detectors?

    Thanks!

  • #2
    Costas loop would be perfect for a solution with Rx completely detached from Tx, so that it establishes a 0° phase on its own. Otherwise you don't need to go that way at all. You have Tx phase at hand always. I and Q give you opportunity to do many things to a signal in baseband, including phase shifting, so you don't have to rely on any exact phase - you can always shift it to zero in for a given coil and frequency.
    Signal source can be just about anything, and you can get 90° directly. The only thing you don't get with digital sources is Tx oscillation at precisely Tx tank resonance. I have a solution for that, but so far did not play much in that direction. I will do that eventually.
    You also do not have to worry much about signal shape, as it is fundamental you are after, and any periodic signal has plenty of it.

    Comment


    • #3
      thanks for your answer

      As far as I understand the basic principle works like this:

      - TX generates a sine wave
      - Assuming the RX is nulled perfectly, we get no signal on the RX coil
      - When a target is present, the TX signal gets coupled in to the RX coil through the target - the target acts like the core of a transformer.

      The RX signal is at the same frequency as the TX signal, but shifted in phase and with lower amplitude.

      The amplitude just tells use whether a target is present or not - while the phase is correlated with the target's conductivity and thus allows us to discriminate ferrous from non-ferrous.

      phase(Target) = phase(TX) - phase(RX)

      Isn't it important where we measure the phase of the TX? Let's say we start at time t=0 and with a phase of 0 degrees in the software oscillator, the output goes through an anti-alias filter, amplifier and then to the coil. At the time the TX signal goes through the coil there might be a phase shift from the anti-alias filter and amplifier, so we would have to measure the phase shift introduced by the anti-alias filter and amplifier right?

      For the tank resonance I thought I could just measure the current through the coil and then sweep through a frequency range until the current peaks and then take this as TX frequency.

      Comment


      • #4
        Originally posted by sled View Post
        The amplitude just tells use whether a target is present or not - while the phase is correlated with the target's conductivity and thus allows us to discriminate ferrous from non-ferrous.
        It's not quite as simple as that. Both the RX amplitude and phase are required for discrimination between ferrous and non-ferrous targets. And ... don't forget about ground balance. Read Chapter 7 of "Inside the METAL DETECTOR".

        There are also other factors to consider when designing a digital VLF detector. Depending on which processor you choose, and how much you want to implement in software, there are a lot of gotchas waiting to jump out. Even digitally generating the sample pulses can be a nightmare, due to restrictions on the internal timer resolution, and handling overlapping sample pulses. Most of these issues do not come to light until you begin writing the code. Then, if you start thinking about digital filtering ... well, that's an altogether different ball game.

        The best advice I can give is to make a start with your own ideas. You will very soon discover what you're up against, and you'll learn a lot more that way.

        Comment


        • #5
          Originally posted by sled View Post
          As far as I understand the basic principle works like this:

          - TX generates a sine wave
          - Assuming the RX is nulled perfectly, we get no signal on the RX coil
          - When a target is present, the TX signal gets coupled in to the RX coil through the target - the target acts like the core of a transformer.
          ad 1) Tx may generate square or sawtooth - it doesn't matter as Rx will sort out fundamental from harmonics. The most important part is amplitude stability because AM will find its way through Rx - this way or another.
          ad 2) correct, but let's keep it in real world and allow ~1mV of residual Tx signal there. It is referred to as "air signal" (with no particular reason)
          ad 3) yes and no, depends on the target nature. If target is ferrous, it will act as a core and it will increase inductance of both Rx and Tx coils, resulting in 1st/3rd quadrant responses (ferrous). If target is not ferromagnetic the effect on the coils is negligible, and it acts as a phase shifted source due to eddy currents in a target, with phase shift related to the target conductivity. We often relate it to the target "tau" (L/R) which is spoilt only by target's geometry. Say copper in bulk form has a tau ~140us. Non-ferrous targets reside in 2nd/4th quadrants.

          Originally posted by sled View Post
          The RX signal is at the same frequency as the TX signal, but shifted in phase and with lower amplitude.

          The amplitude just tells use whether a target is present or not - while the phase is correlated with the target's conductivity and thus allows us to discriminate ferrous from non-ferrous.

          phase(Target) = phase(TX) - phase(RX)

          It is more or less so, but just have in mind that responses in phase with Tx are useless for detection, and are usually a few orders of magnitude higher than the responses we can discern in quadrature from Tx. This particular quadrature channel is often referred to as "ground balance" or "all metal". There are fine distinctions between the two (ground may shift phase past the all metal phase), but on easy grounds they are one and the same.

          Originally posted by sled View Post
          Isn't it important where we measure the phase of the TX? Let's say we start at time t=0 and with a phase of 0 degrees in the software oscillator, the output goes through an anti-alias filter, amplifier and then to the coil. At the time the TX signal goes through the coil there might be a phase shift from the anti-alias filter and amplifier, so we would have to measure the phase shift introduced by the anti-alias filter and amplifier right?
          Yes, but in practice (and easy soils) it all boils down to tuning the ground balance. Ground balance is established by bobbing a coil up and down and shifting a phase until we get no response (ground gets balanced). Because on easy grounds the soil response is near 0° against the Tx - all hobby detectors assume that GB channel is also an all-metal channel. It is so on easy soils, but just add some salt (GB shifts towards 90°) and it is wrong. That is the main reason most IB detectors suck on beaches - they all miss a proper all-metal channel, and their GB tuning range is usually limited to only a few tens degrees.

          Originally posted by sled View Post
          For the tank resonance I thought I could just measure the current through the coil and then sweep through a frequency range until the current peaks and then take this as TX frequency.
          You can do that, and it will work fine on easy soils. Alternatively you may use a phase shift on Tx tank to establish PLL reference - which is my solution for this problem. Your approach is similar to the nowadays commercial solutions, and to avoid amplitude variation due to soil proximity, such solutions use low Q tanks and use more power. A PLL solution uses a high Q tank and less power.

          Comment

          Working...
          X