Announcement

Collapse
No announcement yet.

Announcement

Collapse
No announcement yet.

Android Phone Based Metal Detector - FCMD

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

  • #91
    Hi Paul,

    oh ok, I realise, that you are demodulating the I/Q channels with a bipolar unity gain rectangular reference waveforms (+1/-1, one reference channel is 90 degree phase shifted) of the demod frequency. This is very clever and very efficient on microcontrollers as you don't need any multiplications and divisions at all. Only fast integer add, sub, accumulate operations.


    Nevertheless, I could do this on my sound card up to 192 kHz/4 = 48 kHz demodulation frequency in the same manner too. But must also demodulate a reference signal from the TX to get the correct phase lag between TX and RX signal. ENOB (due to noise) and limitted SR (max 192 kHz) limits the signal quality however.
    You are definitely a winner with your $5 Chip. No doubt.

    Cheers,
    Aziz

    Comment


    • #92
      Originally posted by moodz View Post
      Finished V1.0 of the code for the STM32H750 chip ... I use this board: Its a chinese board by weact studio.
      I will do a bit of testing then release the firmware. It detects a 10 x 10 cm foil at nearly a meter...
      That detection range sounds very good!
      For the real world use; will this design have trouble with wet/beach soil or near power lines, and will it actually be able to tell apart a common iron nail from, say, a silver coin?

      Comment


      • #93
        Hi Paul,

        I think your AI hallucinate​s.

        If I compare the STM32H750 with typical 11 bit ADC ENOB @ 3.2 MHz SR with a high end sound card with typical 20 bit ADC ENOB @192 kHz SR I get the following figures:

        Times N more samples due to higher SR of STM32H750:
        N = 3.2 MHz / 192 kHz = 16.7

        Extra bits resolution for N=16.7:
        Extra bits = ½ × log₂(N) = 2.03 bits
        So the typical ENOB of STM32H750 increases to 11 + 2 = 13 bits
        On the other hand, the sound card has still 20 bits ENOB.
        Without taking any integrations into account.

        Am I doing something wrong?
        Aziz

        Comment


        • #94
          The AI never says the H750 ADC is better than a 24 bit ADC .... however for the purposes of this design a tiny $5 chip with $10 of components can make a sensitive detector and achieve good results all other things considered and the whole detector will fit in a matchbox.
          For instance there is no point using an uber ADC sound card chip with -137db performance if the noise floor at the coil is -90db.
          The AI does say that the H750 can achieve around 20 bit performance which is adequate for the application.
          Read the summary extract again :
          ---
          Comparison Summary

          | Configuration | Base ENOB | Samples/Int | Eff. ENOB | Dyn. Range |
          |-----------------------|-----------|-------------|-----------|------------|
          | STM32H750 dual 16-bit | 11 | 80,000 | ~20 bits | ~120 dB |
          | 24-bit mid-range | 17 | 3,000 | ~23 bits | ~137 dB |
          | 24-bit high-end | 20 | 25,600 | ~27 bits | ~164 dB |

          ---
          Key Insights

          1. The STM32H750 approach recovers ~9 bits through massive oversampling (3.2 MHz vs 32 kHz) and synchronous integration
          2. Diminishing returns on raw ADC bits: Going from 11→17 ENOB (6 bits more) only yields ~3 bits advantage after integration, because the faster ADC integrates more samples
          3. Sample rate matters as much as resolution: The STM32H750's 3.2 MHz rate allows 80,000 samples vs 3,000 for a slower 24-bit ADC
          4. Cost/complexity tradeoff:
          - STM32H750: ~$5, integrated, simple
          - 24-bit high-end: ~$20-50, external, complex analog design
          5. Practical limit: At ~20+ effective bits, other factors dominate (thermal noise, component stability, interference)

          Bottom line: The dual 16-bit @ 3.2 MHz approach achieves ~20 effective bits, competitive with mid-range 24-bit ADCs, at lower cost and complexity.​​

          Cant get much simpler than the minimal detector circuit below ( useful as a pinpointer ). I proved this works because my circuit still detects metal at the coil with the transmitter boost turned off due to leakage currents from the driver cct.

          Click image for larger version

Name:	image.png
Views:	226
Size:	50.6 KB
ID:	444435

          Comment


          • #95
            Originally posted by ivconic View Post

            That detection range sounds very good!
            For the real world use; will this design have trouble with wet/beach soil or near power lines, and will it actually be able to tell apart a common iron nail from, say, a silver coin?
            it will probably have many more problems than you mention as well. It has not left the bench yet. This version is based on the FPGA design which does use a high end 24 bit ADC but costs alot more and is more troublesome to code for.
            There is just a cap connecting the rx coil ( no RX preamp ). The tx is a bipolar 32 khz current square wave with 3us rise time +/- 90 volt flybacks across a 300uh 0.5 ohm coil. The coil current should be about +/- 400 ma. It can tell ferrous from non ferrous but that is a work in progress as I have a number of "channels" to choose from and of course the channel with the best discrim has the poorest ground rejection.

            Comment


            • #96
              Originally posted by Aziz View Post
              Hi Paul,

              oh ok, I realise, that you are demodulating the I/Q channels with a bipolar unity gain rectangular reference waveforms (+1/-1, one reference channel is 90 degree phase shifted) of the demod frequency. This is very clever and very efficient on microcontrollers as you don't need any multiplications and divisions at all. Only fast integer add, sub, accumulate operations.


              Nevertheless, I could do this on my sound card up to 192 kHz/4 = 48 kHz demodulation frequency in the same manner too. But must also demodulate a reference signal from the TX to get the correct phase lag between TX and RX signal. ENOB (due to noise) and limitted SR (max 192 kHz) limits the signal quality however.
              You are definitely a winner with your $5 Chip. No doubt.

              Cheers,
              Aziz
              I did get a version working with the sound card where I use the left and right input RX channels with L = coil and R = reference from TX. However this worked upto around 30 khz before phase slipping started occurring .. so either USB was dropping samples or bufferring jitter .. dont know ... I gave up. The AI didnt though it came up with very elaborate DSP to digitally correct the errors by dynamically altering the TX on the fly to compensate. I viewed this as creating a new source of problems to fix another source of problems. So went for the KISS H750

              Comment


              • #97
                Originally posted by moodz View Post
                ... the channel with the best discrim has the poorest ground rejection...
                Ok, there's the answer to the problem.
                Use that channel and find a way to additionally (laterally, without mixing) have GEB data.
                Present them separately on GUI/Audio...


                Comment


                • #98
                  Originally posted by moodz View Post
                  I did get a version working with the sound card where I use the left and right input RX channels with L = coil and R = reference from TX. However this worked upto around 30 khz before phase slipping started occurring ...
                  That's better than my card, which does everything the same up to 13-14kHz.
                  The specification of the chip on the card is done under ideal conditions.
                  When you put the chip on the card and connect it to USB and to a standard PC (phone/tablet is worse); deduct at least 50% of the specifications.

                  Comment


                  • #99
                    Hi Paul,

                    thanks for clarifications. It caused a glitch in my matrix. My bad.

                    I like the KISS H750 version. Let's think further and improve it to handle GB, ability to detect tiny gold on severe ground conditions and get the relation of Resistive R / Reactive X response for simplified discrimination.

                    The triangular coil current can be considered to be wide band TX. You can decode the high frequency response parts too. A simplified and effective ground balance can be done using only the magnitudes of the frequency responses. Or take a rectangular pulse driving transmitter. Or anything else. Any wide band transmitter works the same.

                    Known parameters and naming conventions: simplified for two frequencies in this example (IB-configuration):
                    Slo stands for current decoded signal, low frequency part
                    Shi stands for current decoded signal, high frequency part (any high frequency part)
                    ref refers to a reference signal
                    X() refers to pure reactive response
                    R() refers to pure resistive response (we are interested in R() to make detection without ground response X() )

                    Let's begin:

                    Slo = signal magnitude of low frequency response (for instance 32 kHz)
                    Shi = signal magnitude of higher frequency (let's take the next harmonics, 64 kHz)

                    Sloref = reference of low frequency response (32 kHz), taken by ground balance procedure or auto tracking mode GB
                    Shiref = reference of high frequency response

                    For simplification we look at the absolute value changes: d stands for delta, a change of signals, so dSlo and dShi is always >= 0
                    dSlo = fabs(Slo - Sloref), absolute value change of Slo
                    dShi = fabs(Shi - Shiref), absolute value change of Shi

                    The signal changes follows X and R responses during normal operation. dSlo and dShi is affected by pure reactive X and resistive R responses. Grounds affect the X and targets R. Iron target both:
                    dSlo = X(dSlo) + R(dSlo)
                    dShi = X(dShi) + R(dShi), where
                    X() is the pure reactive X ground response and
                    R() is the pure resistive target response

                    Ground effects will cause pure reactive response X (no resistive targets present). It is a linear equation behaviour.
                    k1*X(dSlo) = k2*X(dShi)
                    It means k1 amount of dSlo caused by pure X ground response will cause k2 times of dShi pure X ground response.

                    Forming the linear equation:
                    X(dShi) = k1/k2 * X(dSlo), pure X response for high frequency
                    c=k1/k2 is the linear combination factor. If we adapt c, we can make left and right side of the equation equal and do ground balance.

                    This is the ground balance equation:
                    X(dSlo) - k2*X(dShi)/k1 = 0, (no ground signal)

                    You can remove the X part of your high frequency response and get the resistive response R():
                    dShi = X(dShi) + R(dShi), this is what we have, X() and R() response for the high frequeny reponse, we don't know how much X() and R()
                    R(dShi) = dShi - X(dShi), if we subtrace X(), we should get R()
                    R(dShi) = dShi - k1/k2 * X(dSlo), putting X(dShi) into the equation

                    We know the parameters dShi, k1 and k2 can be obtained by GB procedure or workbench testing with pure reactive responses
                    But we don't know the value of X(dSlo) to solve the equation.

                    We don't know during the normal operation, how much dSlo contains R(dSlo) and X(dSlo).
                    Remember:
                    dSlo = R(dSlo) + X(dSlo)

                    We are taking an assumption and setting R(dSlo) = 0 and assuming there is only ground response X() present.
                    R(dSlo) = 0,
                    dSlo becomes
                    dSlo = 0 + X(dSlo)
                    X(dSlo) = dSlo
                    This is a good compromise in the first instance.

                    Now we can calculate R(dShi):
                    R(dShi) = dShi - k1/k2 * X(dSlo), where X(dSlo)=dSlo
                    R(dShi) = dShi - k1/k2 * dSlo

                    We can also calculate the X()-part:
                    X(dShi) = dShi - R(dShi)
                    We get a good information about the ground or target conditions if we look at the relation R()/X(). We can track ground conditions by observing X() or the relation to track target conditions.
                    We can signal the output speaker with modulated combinations of X() and R() or R()/X() or put only the R()

                    This simple assumption lead to subtractive GB algorithm. Subtractive GB algorithms will lose some target response however. But the ground response will be higher on low frequencies. Target responses will be high on higher frequencies. So finding the biggest relation of X()/R() in the frequency domain. And we lose not much target response. This is the case for dSlo in my example.

                    We can apply the procedure to all higher frequencies each individual. Or group (integrate) the higher frequencies into one high frequency response.
                    dShi = fabs(Shi_1 - Shiref_1) + .. + fabs(Shi_n - Shiref_n), 1..n, high frequency responses, where
                    dSlo remains the same

                    This can be evaluated by post #22 published here:
                    https://www.geotech1.com/forums/foru...352#post444352

                    I am also refering to the post #82, #83 in this thread.
                    https://www.geotech1.com/forums/foru...903#post443903

                    Remember, I have used an unsigned change using the fabs()-function for the changes. This simplifies the calculations. You can use the signed changes as well.
                    And remember, I have used only the demodulated magnitudes (amplitudes). No phase info is processed. If you can do it, it will probably help in improving GB and discrimination.

                    I have finally put the example calculations in the post #22 for a X and R separation of iron target.
                    It works with any targets. Just imagine: a gold nugget in iron oxide ground behaves like an iron target on mild ground.

                    There is a big big nice feature for IB-configurations:
                    Any mechanic shock or temperature drift to the TX/RX coil arrangement will change (mismatch, disturb) the induction balance. This will lead in pure reactive X response seen by the RX-coil. This GB-method removes these unwanted effects automatically. You can work with less stable IB coils!

                    Big disadvantage:
                    This simplified GB-method can not eliminate Viscous Remanent Magnetism (VRM) effects and conductive salty grounds causing resistive response R().
                    You have to make either a manual adjustment to subtract some amount of resistive signal out of the calculated R() or do some kind of auto tracking during ground balance procedure so R() gets 0 (R() = 0 ) to eliminate such effects. But the ground conditions can change over time and you usually don't know when.
                    I think, nobody can handle these effects at the moment really.

                    Now the very important info:
                    This subtractive GB principle works on:
                    - IB Multi-frequency domain (shown here)
                    - Pulse induction on the sampled voltages over time v(t1), .., v(tn) on the decay curve, t1 early time, t2 later, and so on
                    - Pulse induction on the sampled integrated voltages (windows) w(dt1), .., w(dtn) on the decay curve, dt1 being early time integration with dt1 integration time, and so on

                    It isn't a rocket science. It has been described and published over the past decades. It is a simple linear combination subtractive GB method.
                    I hope, I didn't make any mistakes in the formulas.
                    I remember now, what I have done.
                    This is it. Bang, bang, bang! It's Oreshnik time!

                    Cheers,
                    Aziz

                    Comment


                    • I see two flaws. First, dS = X(dS) + R(dS) is not true. It is



                      Second, "Grounds affect the X and targets R. Iron target both" is also not true. Ground is primarily -X but usually has some +R mixed in* (loss angle), and the loss angle can vary as you move around which is why ground tracking is needed. Tiny gold nuggets and foil are primarily +R but big silver coins are primarily +X, and other non-ferrous targets can have any mixture of +X and +R. Smaller ferrous targets (nails) have a mixture of -X and +R, and large ferrous targets can easily move into the +X region. All of this is, of course, frequency-dependent.

                      To make GB work you absolutely have to account for loss angle. If you only balance out the X component you will have a very noisy GB.

                      *In saltwater it is the opposite: mostly +R.

                      Comment


                      • Thanks for your comments Carl,

                        Originally posted by Carl-NC View Post
                        I see two flaws. First, dS = X(dS) + R(dS) is not true. It is



                        Second, "Grounds affect the X and targets R. Iron target both" is also not true. Ground is primarily -X but usually has some +R mixed in* (loss angle), and the loss angle can vary as you move around which is why ground tracking is needed. Tiny gold nuggets and foil are primarily +R but big silver coins are primarily +X, and other non-ferrous targets can have any mixture of +X and +R. Smaller ferrous targets (nails) have a mixture of -X and +R, and large ferrous targets can easily move into the +X region. All of this is, of course, frequency-dependent.

                        To make GB work you absolutely have to account for loss angle. If you only balance out the X component you will have a very noisy GB.

                        *In saltwater it is the opposite: mostly +R.
                        I didn't look at the phase angles yet. As I am using the fabs() for changes, both X and R effects lose their polarity. The term "dS = X(dS) + R(dS)" should had been read as that the signal change consists of X response and R response change.
                        But the GB works very well. Even it is simplified.
                        We can do a better GB next time. I am preparing the test platform for making lots of measurements.

                        Aziz

                        Comment


                        • my AI mate has provided this analysis ... he read your answer above Aziz and he knows how my detector works.
                          Attached Files

                          Comment


                          • The AI is on a roll ... here is an update with waveform analysis.

                            Attached Files

                            Comment


                            • Hi Paul,

                              Originally posted by moodz View Post
                              The AI is on a roll ... here is an update with waveform analysis.
                              WTF!

                              I'm impressed. Can I borrow your AI mate?

                              Well, ok, we are going to calculate with complex numbers for the GB algorithm next time. I'll prepare my software doing so.
                              Thanks for your effort. Interesting reading...
                              Aziz

                              Comment


                              • Hi all,

                                if my IB-wideband test measurement platform is finished, I'll provide full complex frequency spectrum responses for different ground and target types.
                                The complex FFT delivers a complex frequency spectrum either. Each for TX reference and RX signal. So a coherent RX signal spectrum can be extracted.
                                All tracking parameters will be complex numbers.

                                We can ask the AI mate, how he would solve the GB problem in detail.

                                Comment

                                Working...
                                X