Originally posted by Daren
View Post
Announcement
Collapse
No announcement yet.
DSP in commercial prospecting and treasure hunting metal detectors ... and GPZ 7000 speculation
Collapse
X
-
Dividing by 200 was just to keep things easier to send over the serial port he says.Originally posted by Davor View PostThis way of addition of 3 consecutive samples actually removes the 3rd harmonic, and with factors sqrt(0.5) also the 5th as the components of the 3rd and 5th contained in them get mutually subtracted. Higher harmonics are far more volatile with changing ground proximity, so this will give more quiet rig. Even harmonics are removed due to the balanced sampling.
I have no idea why dividing by 200, and it must have something to do with arduino atan2 function that returns arc tangent of y/x. Applying ideal atan2 function would yield same result with and without divide by 200. As I'm not familiar with arduino math, I have no idea what might be the motive there. Most probably atan2 is based on some lookup table and precision may vary.
What would I do different?
First off, I'd avoid micro in the first place, despite the tempting FIR boxcar filtering. Lets pretend I regained my liking for the micros.
First there are a few details that are missing here, namely ground balance. Without it this is merely a nice pinpointer. To add a ground balance, one should play with phases in a way that linear combination of the orthogonal phases (bin0⊥bin2 and bin1⊥bin3) produce zero at ground phase. Simple really, as the routine to establish phase is already implemented. In the end the amplitude (all metal, no ground) is absolute value of the ground balance vector, instead of the sum of squares, as implemented now.
The fun part with this rig is that it is fully static, with simple "calib" function to remove offset. It would be much simpler if there is a simple boxcar highpass added as well, but it would take many more samples to average than just 1024. If there is enough memory to do 1 full second or more, it would be interesting to see perfect FIR slow motion detector with no ringing. Switch on and go - that simple.
So my approach would be to add FIR boxcar high pass in duration of, say 4 seconds, and a button to turn on GB calibration in place of the "calib" function used now. THAT would be something else.
So a high pass filter of 4 seconds would give you a gb signal that is updated every 4 seconds? With the Nucleo it should be quite easy.
As Tinkerer says, it is impressive, but you have to run it at 96 mhz if you want to use the USB channel for comms.
And as for a high pass FIR there are two ways to do this. keep a lot of memory readings, remove the oldest add in the newest. I do that with a 32 entry buffer in the medical device. BUT
There is also a way to do it with only having to store one value.
I don't have the basic algorithm handy, but my memory serves to tell me it involved taking a single stored value, and a sample value, and modifying the stored value by a multiply and divide involving the input.
Would have to do some webbing.
http://iowahills.com/5FIRFiltersPage.html seems to be a good general link.
With a filter designer.
4down voteNew average = old average * (n-1)/n + new value /n
This is assuming the count only changed by one (in case it changed by m then:
new average =old average * (n-m)/n + sum of new value/n).
This is the mathematical formula (I believe the most efficient one), believe you can do further code by yourselves
Of course you have to replace old average with the new one....
Leave a comment:
-
I don't know if that is a secret or not, I did see it described in multiple places. I'm trying to fully understand magnitude of the phenomenon and find a "metric", "signal signature" or "signal space" where the differences between metals are most pronounced. If such signature can be found then build discriminating PI with just mosfet, mosfet driver, opamp and uC seems trivial.
The new STM32 nucleo F334R8 has software environment significantly different... it will take a while to rebuild enough system to continue collecting data...
Leave a comment:
-
The I and Q are at perfect quadrature, but X and Y channels in metal detectors may be at slightly different angle. Very similar thing.
You may understand role of I and Q by observing the Weaver method of obtaining SSB, only without the second mixers. These are called baseband because their frequency response mirrors against DC, and is always bandwidth limited by some sort of LPF. All software defined radios use this approach because it is handy for digital implementation.
It was LTspice, a free spice program that is used a lot among amateurs and beyond.Originally posted by scrungy_doolittle View PostSo what program did you use to model this? The first picture is obviously a model of the sampling applied to a wave form. The second is an fft of that sampling, correct? I presume the 125 is an artifact of something in the model, since this code actually runs around 7.1K.
So what about the algorithm supresses the 3rd and 5th harmonics. And how does this compare to a band pass filter?
I used 1ms per sample for simplicity, so 8 samples in a period gets you to 125Hz.
The peak sample has amplitude 1, the smaller ones have 0.71, and there is a zero. These resemble the 3rd removal additions. The negative side is for negative samples, and why I did it this way should require a semester in signal processing, so just take it as is.
The point is that if you shove a square signal in, after this crude digital filter it will lose the most of the 3rd and 5th, which makes a square Tx a lot more appealing. You may imagine the square signal as simple as the polarity of samples.
Leave a comment:
-
Interesting.Originally posted by Daren View PostSTM32 the is the way to go. STM32F3 or F4 can sample 12 bits at 20nS
You can setup a nice ADC/DMA stright to your buffer then process it. It is absolutely amazing what that chip can do. Plenty of memory, 72MHz, DAC for sound or to drive coil, etc....
Here is a sample plot from the simple PI detector. Signal sampled after the first and only opamp (used to shift and expand signal to the ACD range)
plots of "base line - no target", "steel" and "gold".
[ATTACH]32399[/ATTACH]
After you have the profile then slow/fast integrators are done in software to detect target.
I fried my STM32F3 (12V charged cap plugged into 3.3V ooops
); Just got STM32F4 nucleo but did not have time to play yet, the spec are spectacular
.
You publish one of the best kept secrets in your pi.jpg picture and nobody notices it. Or does nobody understand the significance of the pivot?
Leave a comment:
-
I come from old school analog detector usage i.e 5900di pro 6000/di series 3. Where you don't do any bobbing. Raise loop, press button, lower loop listen to tone, adjust balance, raise and repeat until there is no variation in tone. This is technically bobbing the coil, as you have to adjust and press the switch.Originally posted by Davor View PostMr Crocker deserves a bit more praise. I like the 3rd (and 5th) removal mechanism. It supports square wave Tx, which means you may design an incredibly simple and effective energy saving Tx that operates at just about any frequency you throw at it, without tuning anywhere. It may enable a completely brain-free and frequency independent implementation of dual frequency method, AND keep the energy saving goodies too.
Now GB.
Ground signal is impractical to extract from the received signal using sumation methods simply because the amplitude of GB is changing with differences in ground proximity while waving around. Therefore in VLF we extract it by means of a GB channel that is orthogonal against the ground response vector. Such a channel that does not contain ground response is used to generate audio. There is not much to it, you simply apply some muffling mechanism to avoid chatters, and do some tone generation, either proportional audio or VCO.
If you only use a GB channel, you get a TR detector that detects all metals, and no ground. Such configuration is the most sensitive VLF scheme.
Tuning GB to properly reject ground is done by bobbing the coil, and thus maximising the amplitude variation of ground response. When GB is correct, there is no response while bobbing.
By applying discrimination you lose a bit of sensitivity.
Practical implementation...
A GB channel in a classic VLF is done by sampling demodulation of input signal at 90° from ground response. You tune it to precisely 90° by adjusting phase of a clock supplied to a sampling demodulator. Resulting voltage has 0V response for any amplitude of ground.
In micros you operate on vector components I and Q, and these are demodulated baseband signals. Each of the components has its own amplitude, and a vector they represent is seen in a Cartesian diagram. Obtaining any phase in between is performed by simple addition/subtraction of the I and Q components.
It goes like this...
Say you have a vector V with amplitude r and angle α
- in Cartesian coordinates it would stand as x= r cos(α), and y= r sin(α)
Say we want to rotate a whole vector by angle β
- we obtain x' and y' as follows: x'= x cos(β) -y sin(β) and y'= x sin(β) + y cos(β)
To obtain ground balance in such constellation we'll use either x' or y' (not both) that has minimum value (preferably 0) while bobbing a coil. To reach at that angle we may either establish the angle β directly using atan2 method as Mr Crocker, or more precisely by successive approximation (PLL/Costas loop style) where noise is less of a factor, and you may substitute sines and cosines with observing zero crossings. The best way of doing this is in a semi-automatic fashion: press button and bob -> find solution -> release button. You may try automating this as well in case you have lots of memory at disposal. It should work reasonably well on most terrains.
There is also a completely different approach using multiple frequencies, and so far amateurs did not tread in that direction. GB is achieved by subtracting (scaled) responses at two (or more) frequencies, and the catch is that practically all ground effects respond equally at different frequencies, while targets respond differently. After subtraction you get only a difference of target responses in a GB channel.
so if I understand right, standing at one spot and "bobbling" the coil up an down, and digitizing the signal looking for amplitude changes to be minimal is the same thing, then I'm good with that.
Your discussion of I Q and baseband lost me. how do I and Q relate to the whites X and Y channels? I know they generate a G channel based off one of these channels in their 4 filter machines.
I'll get this, and I am not as stupid as I sound, but it's going to take a bit to really understand this... On the other hand, my philosophy when teaching is "there are no stupid questions."
Leave a comment:
-
Thanks. got it. What a relief.Originally posted by 6666 View PostScrungy, log out, at top right hand side of screen where it says login tick the remember me box when you login .
Leave a comment:
-
Scrungy, log out, at top right hand side of screen where it says login tick the remember me box when you login .
Leave a comment:
-
hmm. I'm use firefox 27.0.1 but this time out in explorere, Chrome or firefox. not sure where the "remember me" button is.Originally posted by Qiaozhi View PostA few people have asked this question before, but there is no time-out set by the forum. The problem of "timing-out" is a feature of your browser. If you select the "Remember Me?" checkbox, this issue will go away.
All of this discussion by the way, is very helpful.
I hope it leads to a simple, open source code base for a fully computerized IB detector.
Leave a comment:
-
So what program did you use to model this? The first picture is obviously a model of the sampling applied to a wave form. The second is an fft of that sampling, correct? I presume the 125 is an artifact of something in the model, since this code actually runs around 7.1K.Originally posted by Davor View PostMost of us adopted that "remember me" option, and logout at exit. It works OK.
Regarding the 3rd and 5th removal, see the attached picture. As digital filtering is basically a convolution, you may treat each filter's mask as a signal source and see how it performs in frequency domain by observing FFT. If you have any problems following the previous sentence, simply observe the picture.
As you may see, the 3rd is suppressed by almost 60dB, and 5th even a bit more. Not bad for a simple scheme.
So what about the algorithm supresses the 3rd and 5th harmonics. And how does this compare to a band pass filter?
Leave a comment:
-
Most of us adopted that "remember me" option, and logout at exit. It works OK.
Regarding the 3rd and 5th removal, see the attached picture. As digital filtering is basically a convolution, you may treat each filter's mask as a signal source and see how it performs in frequency domain by observing FFT. If you have any problems following the previous sentence, simply observe the picture.
As you may see, the 3rd is suppressed by almost 60dB, and 5th even a bit more. Not bad for a simple scheme.Attached Files
Leave a comment:
-
A few people have asked this question before, but there is no time-out set by the forum. The problem of "timing-out" is a feature of your browser. If you select the "Remember Me?" checkbox, this issue will go away.Originally posted by scrungy_doolittle View PostBUT the forum times out to quickly. By the time I have composed a reply, it requires me to log in again, and I lose them all.
I wish carl would set the timeout for 10 mins rather than 1 min. The short "kill the user" time is really really irritating. Having to relog in every time you are idle for more than a minute really sucks.
Leave a comment:
-
How *does* it remove the 3rd harmonic?
I have a number of other comments to make on this, BUT the forum times out to quickly. By the time I have composed a reply, it requires me to log in again, and I lose them all.
I wish carl would set the timeout for 10 mins rather than 1 min. The short "kill the user" time is really really irritating. Having to relog in every time you are idle for more than a minute really sucks.
Essentially, the sampling portions of detectors in the analog VLF types, can be reduced to accessing a range of data items in a buffer if you have a fully digitized signal for both the transmit and recieve.
If you are generating a sine wave via table lookup and feeding a DAC, it is a trivial matter to save the data you send to the DAC into a buffer. Each time you output a value, you also sample the receive signal and
buffer it, you will have two digital data streams that can be in synch. Say you want to sample the wave form at 75 degrees through 114 degrees, and since C is 0 based, you actually would index
the signal relative to 0, so for (i=75; i<74+40;i++) { value=buffer[i]+value;}
Would add up all the values from 75 degrees through 114 degrees. This is one sampling window.
Whites generates another channel relative to the RECIEVED signal called rectangular_drive. That is used to auto ground balance. So if you have the reference transmit signal (square or sine) you can apply a
user selected setting to define the sample window across the received signals. Typically whites does that with a couple of comparators running off the transmit signal. One typically has a GEB control the other a
DISC control, and basically they are just setting the sample delay.
The one derived from the RECEIVED signal (i.e. centered on the recieved signal at the 90 degree angle) is done by scanning for the 90 degree angle, from the start of a cycle in the received buffer.
Leave a comment:
Leave a comment: