CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

detection of a metal part near an inductive loop
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
meereck



Joined: 09 Nov 2006
Posts: 173

View user's profile Send private message

detection of a metal part near an inductive loop
PostPosted: Tue Jan 08, 2008 1:56 pm     Reply with quote

hello all,
i would like to detect a metal part near an inductive loop.
There are for sure several principles, one of them is to measure a resonance frequency. Unfortunately, I haven't found any scheme which would be helpful.
Can I ask you for any suggestions on that? I do not insist on using that principle.

Thanks in advance,
regards meereck
Guest








PostPosted: Tue Jan 08, 2008 2:30 pm     Reply with quote

Like you said there are many ways to get to a solution here.

Do a Google search for: 'Metal Detector"

A simple one I designed many years ago is here,

edn.com/archives/1997/121897/26di_02.htm

HTH - Steve H.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Jan 08, 2008 4:11 pm     Reply with quote

The simplest to interface to a uP is to build the loop into an oscillator, then measure the frequency of the oscillation with the PIC.
_________________
The search for better is endless. Instead simply find very good and get the job done.
meereck



Joined: 09 Nov 2006
Posts: 173

View user's profile Send private message

PostPosted: Tue Jan 08, 2008 4:17 pm     Reply with quote

SherpaDoug wrote:
The simplest to interface to a uP is to build the loop into an oscillator, then measure the frequency of the oscillation with the PIC.

Do you mean to generate a sine wave and feed it into a LC circuit?
How can be the frequency measured by the PIC?

Thank you,
M.
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Tue Jan 08, 2008 4:44 pm     Reply with quote

Well, in theory you don't need a resonating circuit.

Connect one side of the inductive loop to a port pin, and the other side of the loop to another port pin set up as an input and also to a resistor, with the other side of the resistor to ground. Zero a timer, and start it running, and at the same time (doesn't need to be exact), set the port pin high.

Then what will happen is that current will flow from the port pin through the coil and resistor, with all the voltage drop initially across the inductor. Over time, the voltage drop will shift to being mostly across the resistor; this is an LR circuit that's in all the textbooks. You use the second port pin to monitor the voltage across the resistor, and when it makes the transition from "low" to "high" you trigger an interrupt and read the value of the timer. The higher the inductance, the longer this time interval will be. When the transition occurs, set the output pin low again. But be aware that current will continue to flow because you have an inductive circuit, and if you don't put a diode in to handle it, the port pin protection diode will conduct, and that might not be good. A Schottky diode oriented with its anode to ground would deal with this.

If you want to use more current through the coil than the processor pin can give, I don't see why the circuit would function any differently if you had a transistor to switch the current. Also, you could use an A/D input instead of just the low-high transition at the input pin, but it would be reading a varying voltage.

Note that I only said it was theoretically workable! I guarantee that this idea is worth every penny of what you've paid.
meereck



Joined: 09 Nov 2006
Posts: 173

View user's profile Send private message

PostPosted: Tue Jan 08, 2008 5:44 pm     Reply with quote

your solution makes sense, thanks for it. There is just one drawback which i didnt mention. I need to measure the inductance as fast as possible, which in the case of your principle cannot work since there is a time delay.

cheers
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Jan 08, 2008 6:18 pm     Reply with quote

meereck wrote:
SherpaDoug wrote:
The simplest to interface to a uP is to build the loop into an oscillator, then measure the frequency of the oscillation with the PIC.

Do you mean to generate a sine wave and feed it into a LC circuit?
How can be the frequency measured by the PIC?

Thank you,
M.


Use an op-amp to build a Colpitts oscillator using your inductive loop as the coil of the oscillator. Connect the oscilator output to a timer in the PIC. Periodically read the timer to determine the oscillator frequency. The longer you let the counter run the more resolution you will have. The higher frequency you build the Colpitts to run the faster everything happens so the sooner you get a response.
_________________
The search for better is endless. Instead simply find very good and get the job done.


Last edited by SherpaDoug on Tue Jan 08, 2008 7:43 pm; edited 1 time in total
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

PostPosted: Tue Jan 08, 2008 6:21 pm     Reply with quote

meereck wrote:
SherpaDoug wrote:
The simplest to interface to a uP is to build the loop into an oscillator, then measure the frequency of the oscillation with the PIC.

Do you mean to generate a sine wave and feed it into a LC circuit?
How can be the frequency measured by the PIC?
M.


You don't generate a sine wave. The oscillator that contains the inductive loop does that. All you need to do is measure the frequency of the oscillator by comparing it with the Timer in the PIC, preferrably using a CCP module.

Robert Scott
Real-Time Specialties
Embedded Systems Consulting
inductive_dave
Guest







inductive detection
PostPosted: Wed Jan 09, 2008 5:42 am     Reply with quote

Do a google search as suggested but type in "Pulse Induction metal detectors", this is basically a coil of wire fired with a square wave pulse, as the pulse switches off you get a decay curve, any metal near the coil alters this decay curve, this is probably a bit more complex than you want but their are pleanty of PI detector circuits available on the web for you to look at as well as explanations, there are a few simpler ones which you can adapt to include a PIC micro.
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Wed Jan 09, 2008 8:02 am     Reply with quote

You could describe my design as a "pulse induction metal detector" too. But I'm puzzled why a design using an oscillator would be fast enough and a pulse-based one wouldn't. Doesn't the oscillator need time to stabilize to a particular frequency and doesn't the processor need time to read it? I'd have thought that pulses produced by the processor and measured using one of its on-chip timers would be the simplest and most direct way of measuring the circuit's characteristics.
necati



Joined: 12 Sep 2003
Posts: 37
Location: istanbul

View user's profile Send private message

metal detector
PostPosted: Wed Jan 09, 2008 8:38 am     Reply with quote

http://sjeffroy.free.fr/DetectPI/detectpi.html
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Jan 09, 2008 9:09 am     Reply with quote

I have never used anything like the pulse induction detectors described, and they may work well and quickly. They do seem more complex than the simple op-amp oscillator and PIC frequency counter I described.

With the oscillator if you count frequency at the zero crossings you don't have to wait for the amplitude to stabilize. Actually you can monitor either amplitude or frequency to detect an anomaly. Generally it is easier for a uP to measure time than voltage so I use frequency. If your PIC Xtal is fast enough, or you use an external high speed counter, you can measure frequency by period in a single oscillator cycle.

Please tell us which method you try and how well it works.
_________________
The search for better is endless. Instead simply find very good and get the job done.
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

PostPosted: Wed Jan 09, 2008 1:15 pm     Reply with quote

John P wrote:
You could describe my design as a "pulse induction metal detector" too. But I'm puzzled why a design using an oscillator would be fast enough and a pulse-based one wouldn't. Doesn't the oscillator need time to stabilize to a particular frequency and doesn't the processor need time to read it?...


When a change in inductance occurs in an LC oscillator, the frequency of oscillation changes immediately. There is no stabilization period during which the circuit somehow "remembers" its old frequency. So that is not an issue. As for the time it takes to measure the frequency, that is simply a trade-off between speed of measurement and accuracy. You could use the highest resolution clock you can get and use the CCP in Input Capture mode to time-stamp each cycle of the LC oscillation. The accuracy of such a frequency measurement depends on how many timer ticks there are in one cycle of the measured frequency. Each period measurement is +/- 1 timer tick. If this does not yield sufficient accuracy for your purposes, then add up the periods of several consecutive cycles and base your frequency calculation on this average.

All that being said, this "measure the oscillator frequency" method is not optimal because it only measures one thing: inductance. The other methods, such as pulse induction, are able to measure something else: the ratio of inductive reactance to effective resistance. This would express itself as the Q of the oscillating circuit, but simply measuring the oscillator's frequency does not tell you anything about its Q. Apparently the eddy currents induced in target conductors tells you more about the kind of material you have than the purely magnetic effects. I found this article enlightening:

http://www.gi.alaska.edu/~jesse/treasure/misc/howdetector.html

It describes how other methods measure the phase shift between the driven signal and the received signal.

Robert Scott
Real-Time Specialties
Embedded Systems Consulting
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Jan 09, 2008 2:36 pm     Reply with quote

Tell us more about your application. Are you just detecting the presence of an object? Do you want to know the size or type of metal? What type of metal are you expecting? It makes a difference if you are detecting a car stopped at a red light, or a speeding bullet.
_________________
The search for better is endless. Instead simply find very good and get the job done.
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Wed Jan 09, 2008 4:42 pm     Reply with quote

I read the stuff at RLScott's link, and--wow, those things can be as complicated as you want them to be! But I doubt if the original question was aimed at anything like that.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group