Announcement

Collapse
No announcement yet.

Announcement

Collapse
No announcement yet.

INSTANTANEOUS GROUND BALANCE AND DISCRIMINATION SYSTEM FOR METAL DETECTION

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

  • INSTANTANEOUS GROUND BALANCE AND DISCRIMINATION SYSTEM FOR METAL DETECTION

    ...well here is my whitepaper on ground cancellation and discrim for review.

    Attached Files

  • #2
    Screenshot from javascript framework that animates the method.

    Click image for larger version

Name:	image.png
Views:	230
Size:	319.8 KB
ID:	444918

    Comment


    • #3
      Sorry to say, but you've re-invented the standard digital metal detector. I know that the DFX and V3 used something very similar, and I suspect other companies do as well. Beyond that, it has the same flaws as other methods. For example, "...while preserving full sensitivity to targets at different phase angles" isn't true. It has the same sensitivity roll-off as any other GB method. Here's why.

      Ground loss angle is normally 0°-20° but can extend all the way to 90° in salt water. So we can generate a table of K vs loss angle:
      Click image for larger version  Name:	image.png Views:	0 Size:	32.7 KB ID:	444943
      K is then applied to the I&Q signals and summed to produce the targeting signal T (what you call f(t) in the paper). And, yes, regardless of loss angle and regardless of amplitude, the targeting signal is always zero. This is exactly what other metal detectors do.

      But now let's apply a particular K to a range of target signals. Let's say the ground loss angle is 0° so that K=1. Targets can effectively span 0°-180° so we can now create a table of target signal strengths vs phase:
      Click image for larger version  Name:	image.png Views:	0 Size:	41.8 KB ID:	444944
      It's more enlightening to plot T vs phase:
      Click image for larger version  Name:	image.png Views:	0 Size:	24.4 KB ID:	444945
      What this shows is that targets at 0° produce a zero targeting signal (which is good, because that's our ground) and targets at 90° (small foil) produce a large targeting signal. But as you move toward 180° (Big Silver Coins) the targeting signal is again attenuated. If you were looking for Atocha bars you might be out of luck.

      Let's say the ground is 20°; the resulting target-vs-phase plot is:
      Click image for larger version  Name:	image.png Views:	0 Size:	24.5 KB ID:	444947​​
      Again, ground @ 20° produces a zero response but now targets at 110° (maybe a US nickel) produce a maximum targeting signal with diminishing results elsewhere.

      If you think this looks like part of a sine wave that's exactly what it is. This is covered in ITMD3:
      Click image for larger version  Name:	image.png Views:	0 Size:	25.0 KB ID:	444948

      And you get the exact same drawback when you use this method for discrimination:
      Click image for larger version  Name:	image.png Views:	0 Size:	52.3 KB ID:	444949
      If, for example, you set the disc to minimize foil (say, 95°) you will also attenuate other low conductors (gold, cupro-nickel coins) while Big Silver Coins are largely unaffected. This is how discrimination was done in the 70s and 80s. And if you then multiply this result with the GB result

      f(t) = f1(t) x f2(t)

      you end up with a double hump where there is a null at ground (say, 0°), a null at 95°, and a null at 180°, with everything in between attenuated. This follows Carl's No Free Lunch axiom, and is why no one does discrimination this way any more. They all do it digitally by looking at the target's phase and either passing it or blocking it, producing a brick wall filter that has no effect on undiscriminated targets. Also, your K goes to infinity at 135°, which is about where aluminum screw caps end up (assuming 10kHz).

      Another problem is with this paragraph:
      Existing ground balance systems typically employ one of several approaches: manual
      systems requiring operator skill, automatic systems using iterative algorithms with
      inherent latency, or tracking systems that may inadvertently track out legitimate target
      signals. A common approach uses synchronous demodulation to separate the received
      signal into in-phase (I) and quadrature (Q) components, then forms a weighted linear
      combination to achieve ground cancellation. However, determining optimal weights
      typically requires iterative adjustment or complex calibration procedures.​
      This was true back in the days of analog ground tracking, such as in the White's 6000diPro or early Tek designs. But modern digital detectors do it the way you have specified. And it still requires keeping track of the RX phase so there is always an inherent latency involved. That is, if you are constantly adjusting K to match the instantaneous ground phase then you will also track on targets. Instead, you have to look at a time frame of ground signals -- and with an applied phase limit -- and track on that, and if the signal exceeds the phase limit you have to lock K to the last known ground in order to avoid tracking out targets. This is the "target inhibit" function. This takes time, so there is always a latency with ground tracking.

      ​One of the things ITMD3 didn't cover very well is digital detector design. Partly because I'm still working for a detector company and even though the techniques we use are probably universal, the boss would still look at it as proprietary information. Also, the book was getting really big and I was getting really tired. In the future, I'm think about splitting it into 2 volumes where the second volume covers digital design and more cutting edge stuff.
      Attached Files

      Comment


      • #4
        Hi Carl as usual the proof is in the pudding ... I built the detector before I nailed down the maths. Below is an image from the patent but based on real data. It is the detection of a 1 gram gold nugget in a ferrite matrix. The data is taken from the detector buffer and shows the effect of application of correct K. aka instantaneous ground balance. This was a very difficult target for a PI to find ... and VLFs just said no target. The 7.6 reduction in peak to peak signal without ground reduction equates to a target gain. This target could not be heard at all with the ground excursion .. the big spikes are fast coil sweeps so everything is moving.

        Click image for larger version

Name:	image.png
Views:	280
Size:	105.1 KB
ID:	444953

        I would be really interested if you can reference a detector that uses a Cayley transform method to reduce unwanted signals vs wanted signals ( the implementation of a Cayley transform method "is" the patent ).
        ​You're right about the sinusoidal rolloff - the paper actually derives that explicitly: f(t) = √2·M·sin(φ − θg) / sin(θg + 45°). But here's the thing - yes, target response follows a sine curve, but if ground noise is removed then target signal-to-noise improves regardless. A target at 170° might only produce 20% of the response it would at 90°, but if I've also knocked 95% off the ground noise, I'm still way ahead on detectability. The sensitivity gain comes from the noise floor drop, not from boosting the target amplitude.
        ...and also remember ( and this is critcal ) ... that data in the buffer .. the K can be adjusted also to cancel the gold nugget leaving only the unwanted signal. So we can have a buffer with both signals and additional buffers with ground only or target only etc etc ...

        One thing though - your K table only goes from 1 to -1. K actually spans the entire real line. The formula is K = tan(45° - φ), so it maps all phases with asymptotes at 135° and -45°. The specific K values you get depend on where your hardware puts the I/Q axes relative to the signals - we don't calibrate the phase, so the absolute numbers are arbitrary to the setup. The point is K isn't bounded to [-1, 1].

        Another thing I want to push back on: we don't track RX phase at all. That's kind of the whole point ( ... and i had mentioned in other threads that phase tracking in VLF detectors might not be required ). I sample I and Q, compute K = (I-Q)/(I+Q), store K. During detection it's just f(t) = (K-1)·I + (K+1)·Q. No arctan anywhere, no phase unwrapping, no quadrant handling. K is the phase, just in a different coordinate system (that's the Möbius/Cayley transform bit). So when you say "keeping track of the RX phase so there is always an inherent latency" - that just doesn't apply here. There's no tracking at all - you press a button, K is computed or applied, done.
        Nor are there any lookup tables or scaling .. its all done by looking at the last n seconds in the sample buffer. ( in a way the operator hears the immediate signal based on the last n seconds that "teaches" the detector what to expect in the future)

        Re: DFX/V3 - I'd genuinely like to see how they did it. The patents I found (Teknetics '84, White's '88, Minelab '96 and '06) all describe weighted I/Q combinations but with iterative or feedback-controlled coefficients, not a direct closed-form computation. If you know where the DFX algorithm is documented I'd appreciate the pointer - happy to cite it if it's the same approach.

        The transform as described is not dependant on frequency ... so multiple frequencies can be processed up to the computation limits of your hardware.
        Another claim in the patent covers the implementation hardware .. my test platform uses a $5 chip and $5 dollars worth of parts to get PI like performance with pushbutton ground balance.

        Bottom line is I tried the magnitude / arctan path of "traditional" VLF detector architecture ... and I dont get the performance we see in fig 12 above"

        moodz

        Comment


        • #5
          Originally posted by moodz View Post
          I would be really interested if you can reference a detector that uses a Cayley transform method to reduce unwanted signals vs wanted signals ( the implementation of a Cayley transform method "is" the patent ).
          I recall that the White's V3 calculated a K (and they also called it 'K') using an algebraic method, not trig. But I don't recall the exact equation and I have no access to that code. Your particular way of calculating K may or may not be unique, I don't know, but the general method has been in use for at least 25 years.

          But here's the thing - yes, target response follows a sine curve, but if ground noise is removed then target signal-to-noise improves regardless. A target at 170° might only produce 20% of the response it would at 90°, but if I've also knocked 95% off the ground noise, I'm still way ahead on detectability. The sensitivity gain comes from the noise floor drop, not from boosting the target amplitude.
          Agreed, but that's what ground balance has been doing since 1974, whether analog or digital.

          ...and also remember ( and this is critcal ) ... that data in the buffer .. the K can be adjusted also to cancel the gold nugget leaving only the unwanted signal. So we can have a buffer with both signals and additional buffers with ground only or target only etc etc ...
          True as well, but as I said, this only further degrades the SNR. These phase notches are really broad and drag down all other targets. It's how discrimination was done until the White's Eagle came along, now no one does it this way.

          One thing though - your K table only goes from 1 to -1. K actually spans the entire real line. The formula is K = tan(45° - φ), so it maps all phases with asymptotes at 135° and -45°. The specific K values you get depend on where your hardware puts the I/Q axes relative to the signals - we don't calibrate the phase, so the absolute numbers are arbitrary to the setup. The point is K isn't bounded to [-1, 1].
          I normalized the signal to an amplitude of 1. You can plug in any amplitude you want, but the relative results are the same.

          Another thing I want to push back on: we don't track RX phase at all. That's kind of the whole point ( ... and i had mentioned in other threads that phase tracking in VLF detectors might not be required ). I sample I and Q, compute K = (I-Q)/(I+Q), store K. During detection it's just f(t) = (K-1)·I + (K+1)·Q. No arctan anywhere, no phase unwrapping, no quadrant handling. K is the phase, just in a different coordinate system (that's the Möbius/Cayley transform bit). So when you say "keeping track of the RX phase so there is always an inherent latency" - that just doesn't apply here. There's no tracking at all - you press a button, K is computed or applied, done.
          Yes, I understand that, and I'm using "phase" very loosely to mean K which, as you say, is a representation of phase. If you are doing AGT then you need to keep a short history of K and a boundary system for inhibit. If you are doing a push-button Ground Grab then you still want to keep a short history of K to do an average on the data so that you get a more representative ground K. That's what FTP Ground Grab detectors do and, yes, they are instantaneous. But in a true auto ground tracking detector you can't be instantaneous without the risk of tracking to targets.

          Re: DFX/V3 - I'd genuinely like to see how they did it. The patents I found (Teknetics '84, White's '88, Minelab '96 and '06) all describe weighted I/Q combinations but with iterative or feedback-controlled coefficients, not a direct closed-form computation. If you know where the DFX algorithm is documented I'd appreciate the pointer - happy to cite it if it's the same approach.
          There is no public documentation of the DFX or V3 algorithms, it was all White's proprietary. But one of the V3 coders works with me at FTP so I'll ask him. The other V3 coder is his wife. Maybe they'll recall.

          Comment


          • #6
            I talked with the V3 programmer today. It's his recollection that the K's were calculated using arctan(), so your approach may be unique.

            Comment


            • #7
              Thanks Carl. I will keep pluggin away LOL.

              Comment


              • #8
                Hi Paul,

                good job!
                I like your white paper, the graphs and the analysis very much.
                And I like the comments from Carl. But I haven't looked into detail yet.

                Does your GB works with single frequency response? Just like on a resonant frequency or close to it (LC-network resonating).
                Cheers,
                Aziz

                Comment


                • #9
                  Thanks Aziz .. yes the method works with single frequency and multifrequency and all it needs is theoretically a single I and Q sample of ground to calculate K. Where K = (I-Q)/(I+Q). Though in practice the last few seconds are used in a history buffer.
                  There is no requirement to know the reference phase.
                  Of course K can also be calculated for targets ... so targets are discriminated using K and ground is balanced using K so there is only one variable to rule them all.

                  There is no new physics here .. ( cant patent physics LOL ).
                  As Carl points out previous detectors arrive at similiar results .. this method ( I believe is a better way to arrive at the same result but using a method that is mathematically closed ( only need IQ samples ) ... by removing things like phase rotation this new method does not disturb the DSP signal chain.
                  Because the DSP chain is just pumping out IQ samples and there is no phase rotation going on .. its significantly more stable. ( yeh I know you can rotate it mathematically but this has its own issues ).

                  Below is a screen shot of math sim comparing phase rotation method to K method. In both cases the ground has been rotated to I axis.

                  There are some other aspects that fall out as a consequence ... eg multifrequency and harmonic channels .. there are nearly 50 claims in the patent.

                  Click image for larger version  Name:	image.png Views:	0 Size:	149.3 KB ID:	444976

                  Comment


                  • #10
                    Hi Paul,

                    this is really very very nice. Again a really good job!
                    This is the end of ...

                    I'll peer-review the method on local LC oscillator, LC-network (stimulated by external reference), TEM, TEM2, .. if I have finished my software sanity project (it's a big mess of code at the moment).
                    I am looking forward to code it... What a nice joyful work is waiting for me..
                    Cheers,
                    Aziz

                    Comment


                    • #11
                      Hi Paul,

                      I did try the AI mate on Google for specific code portions. Google AI is free and it doesn't cost you anything.

                      Example for an efficient Hilbert transformation (FIR-Filter type III) as C-Code libary.

                      Query: (just ask Google AI with the following query)
                      Code:
                      Create a C-based library for Hilbert transformations with arbitrary filter coefficient lengths for a broadband,
                      discrete-time, non-sinusoidal signal to generate a quadrature signal. Use an optimized form of double buffering
                      to avoid modulo operations. Optimize the library to avoid zero coefficients. Use the Hamming window function
                      for the Hilbert coefficients.
                      Output: (besides the AI text)
                      Code:
                      file: hilbert_lib.h
                      
                      #ifndef HILBERT_LIB_H
                      #define HILBERT_LIB_H
                      
                      typedef struct {
                          float *buffer;      // Double buffer of size 2*N
                          float *coeffs;      // Non-zero coefficients only
                          int *offsets;       // Index offsets for non-zero coeffs
                          int nz_count;       // Number of non-zero coefficients
                          int N;              // Total filter length
                          int pos;            // Current write position
                      } HilbertFilter;
                      
                      HilbertFilter* hilbert_init(int N);
                      float hilbert_process(HilbertFilter *f, float input, float *quadrature);
                      void hilbert_free(HilbertFilter *f);
                      
                      #endif
                      
                      
                      file: hilbert_lib.c
                      
                      #include "hilbert_lib.h"
                      #include <stdlib.h>
                      #include <math.h>
                      
                      #define PI 3.14159265358979323846f
                      
                      HilbertFilter* hilbert_init(int N) {
                          if (N % 2 == 0) N++; // Hilbert FIR must be odd length
                          HilbertFilter *f = malloc(sizeof(HilbertFilter));
                          f->N = N;
                          f->nz_count = N / 2; // Only odd indices are non-zero
                          f->buffer = calloc(2 * N, sizeof(float));
                          f->coeffs = malloc(f->nz_count * sizeof(float));
                          f->offsets = malloc(f->nz_count * sizeof(float));
                          f->pos = 0;
                      
                          int M = (N - 1) / 2;
                          int nz_idx = 0;
                          for (int n = -M; n <= M; n++) {
                              if (n != 0 && n % 2 != 0) {
                                  float hamming = 0.54f + 0.46f * cosf((2.0f * PI * n) / (N - 1));
                                  f->coeffs[nz_idx] = (2.0f / (PI * n)) * hamming;
                                  f->offsets[nz_idx] = n + M; // Map to buffer delay
                                  nz_idx++;
                              }
                          }
                          return f;
                      }
                      
                      float hilbert_process(HilbertFilter *f, float input, float *quadrature) {
                          // Double buffering: write to both halves to avoid modulo
                          f->buffer[f->pos] = input;
                          f->buffer[f->pos + f->N] = input;
                      
                          float q = 0.0f;
                          for (int i = 0; i < f->nz_count; i++) {
                              // Linear access within the N-length window
                              q += f->coeffs[i] * f->buffer[f->pos + f->offsets[i]];
                          }
                      
                          *quadrature = q;
                          float inphase = f->buffer[f->pos + (f->N - 1) / 2]; // Delayed center sample
                      
                          if (++f->pos >= f->N) f->pos = 0;
                          return inphase;
                      }​
                      
                      void hilbert_free(HilbertFilter *hf) {
                          free(hf->buffer);
                          free(hf->coeffs);
                          free(hf->offsets);
                          free(hf);
                      }
                      
                      ​
                      This is really nice. I will replace existing portions of the code or will add new parts. Pity, that the technology wasn't available 10 to 20 years ago. Now I have so much to do to clean up the existing code.

                      Cheers

                      PS: AI isn't perfect yet. Added hilbert_free() function. cosf() is cos() of course.

                      Comment


                      • #12
                        Hi all,

                        the AI is insane. Really insane. (AI = All Insane, Aziz Insane )

                        If you ask the AI to further optimize the Hilbert transform, it even uses the symmetry of the Hilbert coefficients. It simply doubles the processing speed.
                        Let's focus on AI prompting now. Forget the coding.
                        Aziz

                        Comment


                        • #13
                          Here is the missing link ( maths ) between VLF and PI.
                          This demonstrates the power of the K transform.
                          In this case we go from IQ samples ( VLF ) of a bipolar waveform and derive the decay curve of a PI f(t) and the target taus.
                          We do this by processing the fundamental and upto the seventh harmonic.
                          Because we have perfect knowledge of how the decay curve was derived from the underlying IQ components we can absolutely cancel ground components.
                          PS I patented this

                          Here is the ground response :
                          Click image for larger version

Name:	image.png
Views:	103
Size:	231.8 KB
ID:	445785
                          ...and now we ground balance.

                          Click image for larger version

Name:	image.png
Views:	82
Size:	236.6 KB
ID:	445786

                          ​.. and now with target. 5us gold target.

                          Click image for larger version

Name:	image.png
Views:	82
Size:	256.5 KB
ID:	445787
                          hoohah.

                          Comment

                          Working...
                          X