I've been working on this project on and off for some months now and am really at a loss as to the nature of the signal I'm seeing - really hoping someone can help me out with this.

Let me start off by saying that I have much more experience with software than hardware - no EE degree, total hobbyist/hack, but I have been so for over 40 years, so I've got a certain level of experience.

A few months ago, I started playing around with a type of preexisting metal detector circuit board, used to detect the metal in cars. Connected to the circuit board is a large loop of wire, coming out of the circuit is a very simple NO/NC relay. As far as the contents of the circuit go, I don't really know, although it does contain a 16F628A PIC microcontroller, which is significant for several reasons (more on this later). It also contains a two pair transformer, where one pair goes to the coil that detects the car, and the other coil goes into the circuit on the board. I'm fairly certain that the circuit implements a Colpitt's oscillator, which is what is actually performing the detection.

Anyway, I have found two important things poking around on the board with an oscilloscope, while the device is running;

  1. A 0.1 second pulse (approximate) is generated by the PIC chip and used to excite the loop of wire.
  2. A modified pulse comes back into the PIC chip that appears to give the PIC the information it needs to make the decision if a car is there or not.

All of the other pins on the PIC are fairly uninteresting - ground, power, clock, relay output, etc.

Good so far - as I said, I believe that second pin contains the key to the decision making process (car or no car). Here's where my problem starts. I've attached two photographs to this post - one showing the waveform of that modified pulse when no metal is present, and the other one showing the waveform when there is metal. I can see the difference - in fact, I can see the difference when I start approaching the loop with my metal object (toolbox) even before the relay clicks. But I can't seem to measure, or even understand the nature of, the change in the waveform! As can be seen in the images, the change is slight - it's some sort of characteristic of the pulse train, just can't understand what it is though.

So, here's what I did next - I attached the two lines to a simple Raspberry pi circuit. My plan was to perform maybe an A/D conversion and also try to examine the frequency of the signal, along with the pulse width. I mean, the information must be buried in there somewhere, right? It does work...and quite well!

But I have found nothing - the A/D showed that the signal is binary in nature (which was expected, because the PIC chip has no built in A/D converter ), and I don't see the pulse width or frequency changing with respect to the presense or absence of metal. I just can't figure this one out!

So, back to the scope - I feel like if I just understood what I was seeing on the screen, I could know how to measure what was there.

Anyway, take a look at the images I've attached and ask me questions - I am certain I've left some huge holes in my description. I will do my best to get you answers! Thank you so much in advance! This problem is just killing me!!!!

Respectfully, Marshall

No metal No Metal

Metal Metal

  • 3
    \$\begingroup\$ You need to switch to 0.5 or 0.1 milliseconds per centimeter so you can see details of the signal. \$\endgroup\$
    – JRE
    Aug 18, 2017 at 11:10
  • 2
    \$\begingroup\$ Personally I can't see the difference - I would try zooming in a lot more, taking two photos with 100ns or even 20ns timebase. \$\endgroup\$
    – pjc50
    Aug 18, 2017 at 11:10
  • 1
    \$\begingroup\$ Besides that 1ms is an awful long timebase, removing a bit of the fluff of your question might help getting it read by more people. \$\endgroup\$
    – PlasmaHH
    Aug 18, 2017 at 11:12
  • 4
    \$\begingroup\$ @MarshallCummings I haven't read the question but your last comment there makes me think that you're just seeing aliasing effects from the scope. It looks like an old digital one, they may have a much lower sample rate than we're used to today. I know I've been fooled by my trusty old digital scope from the eighties, even though I should know better seeing I have a DSP background. \$\endgroup\$
    – pipe
    Aug 18, 2017 at 11:32
  • 1
    \$\begingroup\$ You may want to use a dual scope and compare the driving signal with that return signal. I have a feeling you will see a significant phase delay change with and without the presence of metal. IF the particular PIC has no ADC it's probably a timer function that is being used. \$\endgroup\$
    – Trevor_G
    Aug 18, 2017 at 13:42

3 Answers 3


I did a search and seems like the frequency change when a vehicle rolls over those induction loops in the street are quite tiny, as small a small as 0.13% for a motorcycle to several % for a car (% of change in inductance).

That would explain why you can sort of "eyeball" a change in the scope but hard to tell exactly what changed. Excerpt from the Federal Highway page:

"The vehicle classes are:

  • Class 1: 0.13 percent (DeltaL/L) or 0.12 muH (DeltaL) inductance change (small motorcycle).
  • Class 2: 0.32 percent (DeltaL/L) or 0.3 muH (DeltaL) inductance change (large motorcycle).
  • Class 3: 3.2 percent (DeltaL/L) or 3.0 muH (DeltaL) inductance change (automobile)."

Tons of details on this page: https://www.fhwa.dot.gov/publications/research/operations/its/06108/02.cfm

So, I'm sure the PIC is used as a frequency counter being driven by probably discrete LC oscillator (Colpitts, you mentioned) with the wire loop as the inductor and sounds like through a transformer. The transformer probably converts the impedance so the number of turns are reasonable to use for a street.

I've used a PIC for frequency counting (monitored a 32 kHz clock frequency down to a few Hz). No ADC is needed, one digital input and one of the PIC's internal timer blocks and some SW code.


I think you need to look at one pulse only. When a ferrous object approaches the inductor it should change the shape of the pulse.

It is likely there are many pulses for two reasons:

  1. Most if not all ADC circuits are noisy. It is common that as few as only half the ADC bits are significant. To combat this problem, multiple samples can be taken and averaged.
  2. ADC circuits take time to converge on the sampled voltage. This period of time may exceed the desired sample rate. A common trick is to repeat the event many times and gradually change the delay from the start of the event to the point where the sample is taken.
  • 1
    \$\begingroup\$ You are a software developer. This is where crappy hardware can be used because the above two software techniques can make up for it. This is how to design an inexpensive product with great features. If you disclose the OEM, there may be a patent we could look up to describe what you have stumbled upon. \$\endgroup\$
    – st2000
    Aug 18, 2017 at 12:59

Good morning!

First of all, thank you to everyone for their assistance with this - very much appreciated. A special thanks to Vince Patron as well - the link you provided was excellent, surprised I never stumbled upon that myself.

In any case, it turns out that it is indeed a variation in frequency as Vince suggested, nothing more. The reason I had such a problem getting any valuable results from the Raspberry Pi had to do with the Pi itself. Instead of sending the pulse train straight into the Pi, I programmed an additional PIC16F628a microcontroller to count pulses and send the information over to the Pi using a simple serial protocol. Once I did this, I started seeing information that made sense - specifically, a variance in frequency based upon the presence of metal. Mystery solved!

I'm still not entirely sure why the Pi isn't timely enough to measure this relatively slow frequency, but I have seen a number of articles that talk about how using the Pi for frequency measurement has its limitations. See http://www.science.smith.edu/dftwiki/index.php/Tutorial:_Interrupt-Driven_Event-Counter_on_the_Raspberry_Pi if you have any interest.

Thanks again, Marshall


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.