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

  • Here is the intial ESP32 based schema ...we use an external "best bang for buck" ADC and a tricksy way of getting the IQ for VLF.
    The sampling method can be used for PI or VLF ... just changeout the TX.
    This will also be the basis of MAGPI V4.

    Click image for larger version

Name:	image.png
Views:	171
Size:	699.1 KB
ID:	447134

    Comment


    • Ivica to answer your question T1 is found in just about every electronic appliance

      Comment


      • clue 2 ... LOL

        Click image for larger version

Name:	image.png
Views:	169
Size:	1.27 MB
ID:	447137

        Comment


        • The ADS1256 ... is very cheap for what it is. It can easily achieve 19.9 ENOB ( thats 20 bits error free ) at 1000 SPS with the software I have developed.
          Modules are available on PCB for around $10 au ... easier than falling off a log.
          Using a switch like the DG411 as the demod 1000 SPS is way above what we actually need to fully extract the I and Q.
          You can power the DG411 class switches upto +/- 22 volts or 44 volts single ended so its rugged.

          Click image for larger version

Name:	image.png
Views:	171
Size:	1.17 MB
ID:	447139

          Comment


          • Yet another rebuild of the interface ... there are alot of controls on this detector (16+ ) but now focussed on simple military style utility.
            No gimmick screens or wackydoo multiple page ..where is that control gone.
            One screen, one glance, one control ( slider ). Push a button and adjust with slider.
            Big buttons for gloved hands and the current value of that control is written on the button.
            Velcro the display to your sleeve or mount on the control stick. Totally simple.

            Click image for larger version

Name:	image.png
Views:	153
Size:	184.0 KB
ID:	447147

            Comment


            • Originally posted by ivconic View Post
              I like it Paul!
              Except that I don't understand the "T1"?


              What is its role there?

              Comment


              • Originally posted by ivconic View Post

                What is its role there?

                It broadbands the output .. the load is still tuned but if you go off frequency its not as sensitive as a "standard" E class amp to detuning which causes power loss.
                So you just change one cap to change frequency ...use relays or similiar.

                Comment


                • Originally posted by moodz View Post
                  The ADS1256 ... is very cheap for what it is. It can easily achieve 19.9 ENOB ( thats 20 bits error free ) at 1000 SPS with the software I have developed.
                  Modules are available on PCB for around $10 au ... easier than falling off a log.
                  Using a switch like the DG411 as the demod 1000 SPS is way above what we actually need to fully extract the I and Q.
                  You can power the DG411 class switches upto +/- 22 volts or 44 volts single ended so its rugged.

                  Click image for larger version

Name:	image.png
Views:	171
Size:	1.17 MB
ID:	447139
                  Ad1256 It's a very slow chip)))
                  Attached Files

                  Comment


                  • Originally posted by JoyJo View Post

                    Ad1256 It's a very slow chip)))
                    I am using the DG411 switch to demodulate to baseband.
                    Baseband for a metal detector is about 1 hz to 15 hz
                    30 ksps is actually way faster than you need to sample 15 hz.

                    Comment


                    • Most detectors are set up with a processing loop rate of 4-5 ms. During each loop, you want to sample all the signals and process them. That means you need a single signal sample rate of 200-250 Hz. If you are multiplexing 4 signals into a single channel ADC, then the ADC needs to run at 800-1000 Hz. It's true that the target response has a BW of 15Hz or so but you don't want to apply Nyquist sampling here; you want to oversample by a fair amount to get the peak of the response plus some of the up-slope and down-slope. That's why loop rates are ~200Hz.

                      Comment


                      • Originally posted by Carl-NC View Post
                        Most detectors are set up with a processing loop rate of 4-5 ms. During each loop, you want to sample all the signals and process them. That means you need a single signal sample rate of 200-250 Hz. If you are multiplexing 4 signals into a single channel ADC, then the ADC needs to run at 800-1000 Hz. It's true that the target response has a BW of 15Hz or so but you don't want to apply Nyquist sampling here; you want to oversample by a fair amount to get the peak of the response plus some of the up-slope and down-slope. That's why loop rates are ~200Hz.
                        Agreed sort of ... I use a "true baseband" design .. the demodulated baseband is DC to Fmax ( where Fmax is the maximum target modulation rate )
                        Fmax can be the coil being held stationary to say 2 meters / sec swing rate which is fairly fast ( but it could be higher )
                        Most detectors you see nowadays are "motion" detectors ..this means the detector head has to move at some rate to detect a target otherwise the target will null out if you just hold the coil still.

                        So my Fmax can be varied in software .... from 25 Hz down to 1.25 Hz. ( ie DC to 25 Hz DC to 1.25 Hz ).
                        Why would you want DC to 1.25 Hz ... if you are doing a really slow and careful sweep for a very faint target .. this is superb.
                        Your regular motion detector will not do this.

                        Once the target has been demodulated and we then sample using an ADC ... there is another modulation process to consider.
                        The process of sampling in an ADC utilises a modulator ( the sampler in the frontend ) this by definition will alter your samples according to Fin(dot)Fsample.
                        By sampling at the optimised rate we can do more things like eliminate mains interference ferinstance.

                        Here in OZ we use 50 Hz mains so my default sample rate is base on that which gives me a top target bandwidth of 25Hz ( downto DC ) but also removes mains interference.
                        60 Hz is solved also.

                        I understand that loop rates want to be high enough so you dont get "stepping" in the audio response for example when a target presents and the audio just goes bang.
                        In this case I use interpolated "fill in samples" that give the illusion of a smooth target transition and this allows me to go right down to the nyquist required bandwidth.
                        So my loop rate is 50 Hz for a 25 Hz target bandwidth with very smooth target responses.
                        If I ran the loop at say 200 Hz .. I am "wasting" upstream integration and possibly CPU bandwidth.

                        The control associated with all this are not trivial.
                        SAT ( target tracking modes / fixed / threshold tracking / mean tracking)
                        SATR ( tracking rate -- tracking speed or attack / decay )
                        QT ( quick track - re-establish the tracking base reference )
                        THR ( threshold AKA squelch - upper/ lower / both / none )
                        SM ( smoothing - basically interpolation fill in sampling )
                        SR ( vary Fmax -- response speed -- aka high yield / normal / deep )
                        BT ( baseline tracking - track / fixed )

                        Theres another 10 or so controls for the GB / Ktrack / Audio / etc etc

                        Here is the optimal sample rates from the datasheet.

                        Click image for larger version

Name:	image.png
Views:	89
Size:	360.9 KB
ID:	447246

                        Comment


                        • Originally posted by moodz View Post
                          ...
                          By sampling at the optimised rate 4ms (250Hz) or 5ms (200Hz) we can do amaizing things like eliminate mains interference in Rx Coil amplified and demodulated signal for instance.
                          ...
                          ?
                          Here in OZ we use 50 Hz mains so my default sample rate is base on that
                          ?
                          ?
                          60 Hz is solved also.
                          ?
                          How
                          https://www.youtube.com/watch?v=kNcGf7gCshI&t=760s

                          The digital filters with integer coefficients are preferable for real-time applications but it is difficult to achieve desired frequency characteristics. In this work we will present one alternative solution of integer-coefficients filter, which provides an adequate high-pass and power-line filtering.​
                          For the effective rejection of the power-line interference based on the simple principle for averaging of samples N with a predefined distance between them D. 50Hz Rejection FilterDxN has a comb frequency characteristic with high-pass cut-off defined by the number of samples N and zeros at the integer ratio of the sampling frequency fs divided by the number of samples D. For a predefined fs, FilterDxN is easily adjusted to different cut-off and zero frequencies only by changing D and N. In this work, we present the mathematical background for deriving the frequency response of FilterDxN, as well as one particular application of the filter, i.e. Filter10x19 designed for fs=250 Hz, high-pass at 1 Hz, zero at 50 Hz. Tests with both standardized and real signals proved that Filter10x19 is capable to remove very intensive baseline wanderings, and to fully suppress 50 Hz interferences with minimal affect on the waveform. FilterDxN would be preferable in systems operating in real time because of its linear filter equation with integer coefficients that hasten the speed of computations.​

                          https://www.academia.edu/20095427/Co...terference_rejecter_filter_for_ecg_signal_pro cessing

                          250/50=5 Sum(A+B+C+D+E)/5

                          Digital filter design A digital filter with integer coefficients was designed implementing the simple principle of moving averaging of N signal samples distanced each other by 4ms D as shown in Fig. 1. In order to avoid the phase shifting of the filtered signal versus the input signal, the number of the averaged samples N must be odd!

                          N Fig.1.Principle of averaging of FilterDxN. The filter is named FilterDxN, with difference equation given by where X(nT) is the input sample with index n, Y(nT) is the respective output sample. The equivalent z-transform domain equation of FilterDxN is presented in The derived transfer function in the z-domain for FilterDxN is The equivalent transfer function in the frequency domain is By applying the known relationship: , we derive from Equation is the general description of FilterDxN frequency response. From here, we can find the cut-off frequency, the slope, as well as the zeros of the filter. The analysis of the zeros of the filter H(ω 0 T)=0, yielded the equation Since is a periodical function with a period of 2π, we could simplify equation, so that . Therefore, FilterDxN is a comb filter with periodically distributed zeros at each frequency f 0 , which is an integer ratio of the sampling frequency fs to the number of samples D. The analysis of equation shows that for a fixed sampling period T, the frequency response could be easily adjusted by varying both D and N. One example of FilterDxN frequency response for fixed D and different N is presented in Fig.2.​
                          RESULTS The signal processing is implemented in the software package MATLAB 7.0. We focus our analysis on a particular application of FilterDxN for signals sampled at 250 Hz. This is an ordinary sampling frequency preferred in fast and low- power resource systems. Aiming at a zero at 50 Hz, we have 2 possible solutions for FilterDxN, i.e. D=5 (1 st zero at 50 Hz) and D=10 (1 st zero at 25 Hz, 2 nd zero at 50 Hz – Fig.2). For D=5 and D=10 we estimate the low cut-off frequency of the filter and the time for averaging in dependence on the sample number N (Fig.3).​
                          Attached Files
                          Last edited by Hristo; 04-19-2026, 04:38 PM.

                          Comment


                          • Originally posted by Hristo View Post

                            https://www.youtube.com/watch?v=kNcGf7gCshI&t=760s

                            The digital filters with integer coefficients are preferable for real-time applications but it is difficult to achieve desired frequency characteristics. In this work we will present one alternative solution of integer-coefficients filter, which provides an adequate high-pass and power-line filtering.​
                            For the effective rejection of the power-line interference based on the simple principle for averaging of samples N with a predefined distance between them D. 50Hz Rejection FilterDxN has a comb frequency characteristic with high-pass cut-off defined by the number of samples N and zeros at the integer ratio of the sampling frequency fs divided by the number of samples D. For a predefined fs, FilterDxN is easily adjusted to different cut-off and zero frequencies only by changing D and N. In this work, we present the mathematical background for deriving the frequency response of FilterDxN, as well as one particular application of the filter, i.e. Filter10x19 designed for fs=250 Hz, high-pass at 1 Hz, zero at 50 Hz. Tests with both standardized and real signals proved that Filter10x19 is capable to remove very intensive baseline wanderings, and to fully suppress 50 Hz interferences with minimal affect on the waveform. FilterDxN would be preferable in systems operating in real time because of its linear filter equation with integer coefficients that hasten the speed of computations.​

                            https://www.academia.edu/20095427/Co...terference_rejecter_filter_for_ecg_signal_pro cessing

                            250/50=5 Sum(A+B+C+D+E)/5

                            Digital filter design A digital filter with integer coefficients was designed implementing the simple principle of moving averaging of N signal samples distanced each other by 4ms D as shown in Fig. 1. In order to avoid the phase shifting of the filtered signal versus the input signal, the number of the averaged samples N must be odd!

                            N Fig.1.Principle of averaging of FilterDxN. The filter is named FilterDxN, with difference equation given by where X(nT) is the input sample with index n, Y(nT) is the respective output sample. The equivalent z-transform domain equation of FilterDxN is presented in The derived transfer function in the z-domain for FilterDxN is The equivalent transfer function in the frequency domain is By applying the known relationship: , we derive from Equation is the general description of FilterDxN frequency response. From here, we can find the cut-off frequency, the slope, as well as the zeros of the filter. The analysis of the zeros of the filter H(ω 0 T)=0, yielded the equation Since is a periodical function with a period of 2π, we could simplify equation, so that . Therefore, FilterDxN is a comb filter with periodically distributed zeros at each frequency f 0 , which is an integer ratio of the sampling frequency fs to the number of samples D. The analysis of equation shows that for a fixed sampling period T, the frequency response could be easily adjusted by varying both D and N. One example of FilterDxN frequency response for fixed D and different N is presented in Fig.2.​
                            RESULTS The signal processing is implemented in the software package MATLAB 7.0. We focus our analysis on a particular application of FilterDxN for signals sampled at 250 Hz. This is an ordinary sampling frequency preferred in fast and low- power resource systems. Aiming at a zero at 50 Hz, we have 2 possible solutions for FilterDxN, i.e. D=5 (1 st zero at 50 Hz) and D=10 (1 st zero at 25 Hz, 2 nd zero at 50 Hz – Fig.2). For D=5 and D=10 we estimate the low cut-off frequency of the filter and the time for averaging in dependence on the sample number N (Fig.3).​
                            Looks to reject mains very nicely. One point though is that there is a null at DC ... because this is a non motion detector DC must pass.

                            Comment


                            • Originally posted by Carl-NC View Post
                              Most detectors are set up with a processing loop rate of 4-5 ms. During each loop, you want to sample all the signals and process them. That means you need a single signal sample rate of 200-250 Hz. If you are multiplexing 4 signals into a single channel ADC, then the ADC needs to run at 800-1000 Hz. It's true that the target response has a BW of 15Hz or so but you don't want to apply Nyquist sampling here; you want to oversample by a fair amount to get the peak of the response plus some of the up-slope and down-slope. That's why loop rates are ~200Hz.
                              Originally posted by moodz View Post

                              Agreed sort of ... I use a "true baseband" design .. the demodulated baseband is DC to Fmax ( where Fmax is the maximum target modulation rate )
                              Fmax can be the coil being held stationary to say 2 meters / sec swing rate which is fairly fast ( but it could be higher )
                              Most detectors you see nowadays are "motion" detectors ..
                              I just want to say Just DIY like Carl Say with ADC 250Hz or 4ms delay between sample of the demodulated and amplified signal This is a correct way the Digital Rejecting Mains Filter 50Hz(60Hz) is just a DSP algoritham in MCU.

                              And if You Want to KNow-How or Why You Just Must a learn an Academic Study https://www.academia.edu/20095427/Co...nal_processing with the Bulgarian Scientist of Mathematics who published it on English language.

                              ELECTRONICS’ 2008 24 – 26 September, Sozopol, BULGARIA COMBINED HIGH-PASS AND POWER-LINE INTERFERENCE REJECTER FILTER FOR ECG SIGNAL PROCESSING

                              Ivo Tsvetanov Iliev and Serafim Dimitrov Tabakov - Department of Electronics - Technical University of Sofia 8 Kl. Ohridski str, 1000, Sofia, Bulgaria, e-mail: [email protected]

                              Vessela Tzvetanova Krasteva - Centre of Biomedical Engineering “Prof. Ivan Daskalov” - Bulgarian Academy of Sciences, Acad.G.Bonchev str. Bl.105, 1113, Sofia, Bulgaria, e-mail: [email protected]

                              A 50Hz sine wave sampled 250 times per second.
                              Explanation: four or five consecutive discretes describe a full period of the signal. When we add up the arithmetic mean of the values ​​of these five consecutive discretes, we will get zero.

                              If You want the Naked Try this Mains 50Hz DSP Rejecting 'Notch' filter is personaly my idea and we deweloped it in hardware with my homble leading scientist assitent back then in Technical University Varna laboratory togheter but in Bulgaria is a old Comunist Time 1945-1989 long tradition someone other with proper credits they say it "Our Man" to have get Authors Right and Published it in Academic World. And Get ALL IP and Credits for yourself.

                              Comment


                              • Technical AI(google) Analysis:

                                Processing Speed ​​and Oversampling:
                                Carl-NC explains why a frequency of 200-250 Hz is used in metal detector signal processing. Although the useful signal from a metal object itself is slow (up to 15 Hz), sampling at 200 Hz allows for a much more precise definition of the signal shape ("peak", "up-slope", "down-slope"). This is critical for metal discrimination (recognition).

                                If one ADC is used for several channels (multiplexing), its speed must be multiplied by the number of channels (e.g. 4 channels x 250 Hz = 1 kHz).

                                Filtering mains noise (50Hz/60Hz):

                                moodz points out an elegant mathematical method for removing mains noise (hum). At a sampling rate of 250 Hz, a period of 50 Hz (which lasts 20 ms) is described exactly by 5 samples (250/50=5).

                                The average of these 5 samples is theoretically zero for a pure sinusoidal signal. This allows for easy digital filtering of the "moving average" type, which acts as a "notch" filter.

                                The connection with ECG (Electrocardiogram):

                                The cited article by scientists from TU-Sofia and BAS addresses the same problem - how to remove 50 Hz noise from very weak biosignals (ECG) without distorting the useful signal. The principle in metal detectors is identical, since they also work with microvolt signals in a noisy environment.​





                                The mathematical algorithm described in the text is based on the principle of digital integration over a full period of the disturbing signal. In this case, it is the so-called "moving average" filter, designed so that its "zeros" coincide exactly with the frequency of the mains supply.

                                Here is how it works mathematically:

                                1. The relationship between frequency and sampling
                                To eliminate a 50 Hz signal, we must take samples in such a way that a precisely specified number of samples cover one full period of the sine wave.

                                The period of a 50 Hz signal is T=1/50=0.020 seconds (20 ms).

                                If the sampling frequency (Fs) is 250 Hz, then the interval between two samples is 1/250=0.004 seconds (4 ms).

                                The number of samples in one period is N=20ms/4ms=5.

                                2. The mathematical property of the sine wave

                                The main property of any pure sine wave is that its average value for one complete period (2pi radians) is equal to zero.

                                inegral from zero to T of sin(omega+fi)dt=0

                                In digital space, this becomes a sum of discrete values:
                                where Sum (xi) където N is the number of samples for one period (in this case N=5).

                                3. The algorithm (Moving Average)

                                The Notch filter calculates the average value of the last 5 samples at any given moment. The formula for the output signal y[n] given the input signal x[n] is:

                                y[n]=1/5 * Sum (x[n-4]+x[n-3]+x[n-2]+x[n-1]+x[n])

                                Or more simply:

                                y[n]=(x[n]+....)/5

                                4. Why does this work as a "Notch" (cutting) filter?

                                In the frequency domain, this filter has a characteristic of type sinc (sin(x)/x). The first "zero" (the point of complete attenuation) of this filter is located exactly at the frequency: Fnull=Fs/N=250/5=50Hz

                                This means that:

                                * The 50 Hz signal is theoretically suppressed to infinity (becomes zero).

                                * Its harmonics (100 Hz, 150 Hz, etc.) also fall into the "zeros" of the filter and are eliminated.

                                * The useful signal (the coil movement, which is below 15 Hz) passes almost intact, since it is very far from the filtering frequency.

                                5. Practical implementation in a microcontroller (MCU)

                                To make the algorithm fast, programmers often avoid division. Instead of dividing by 5, they simply sum the 5 values ​​in a queue​ //FIFO stack// "circular buffer" and only 4ms delay one samle overall ИМХО.

                                Since in metal detectors we are interested in the change in amplitude, the sum is quite sufficient for further DSP processing.

                                Advantage: Extremely simple code, does not require complex floating-point mathematics and works in real time with minimal delay (only 4-5 samples).

                                And You may fast divide by 4 with only two secuenced registryshift-right instructions of the sum this is way faster than divide by 5 if you actualy can divide by 5 in a Acumulator of the MCU with div instruction or will need small subprogram to divide.

                                Would you like to see an example implementation of this filter in C++ or Python?​
                                AI responses may contain errors. Learn more
                                Last edited by Hristo; 04-20-2026, 08:40 AM.

                                Comment

                                Working...
                                X