Arduino Metal Detector Improvements?

image




  • You can play with the resonant frequency.

  • Another test would be, use a potentiometer on say A1 to adjust the code to produce a pulse train (green) around resonance.
    i.e. vary the green trace frequency about resonance.


  • Note to Santa, consider giving @kgray9 an oscilloscope for Christmas.
  • I quite like the LMV321 Low-Voltage Rail-to-Rail Output Operational Amplifier.

https://www.ti.com/lit/ds/symlink/lmv321.pdf?

  • These are very small.

Are you saying make the frequency of the Arduino's pulses externally adjustable to resonate the LC circuit perfectly? I could! I did calculate the capacitance already though to match the frequency of the Arduino rather than the other way around.

Haha thanks for sending him a note! I have one though... and I learned some skills from someone :wink: (Good Oscilloscope Projects for Beginners? / Skills Test / TDR - #49 by kgray9)

Do you have any idea whats going on here!? I only added a NPN transistor to discharge the capacitor!


The voltage at the capacitor is going to negative ~0.5V immediately after turning off the discharge transistor. :face_with_monocle:

  • Yes, as an experiment.
    However, your final circuit may not function as a metal detector with a resistance capacitor.



  • Hmm, capacitor when discharging generates negative voltage, a schottky diode should clip this better ?

  • Pink line is 0V for yellow capacitor waveform.

  • Draw a timing diagram, based on your code, showing capacitor discharge time overlay on green waveform.

Edit

  • R5 (10k) is not really needed, for now, drop it to 220R.
    5v / 30R = 166ma collector current constant current source.



  • Adjust trigger hold off ?
  • Trigger off the rising edge of the green trace.
  • Lengthen the discharge time.

  • What did you do different between these two ?

image

Okay! It was originally 5µs in that o'scope picture that I sent. In the original circuit (unmodified), it discharged for 20µs, so i changed it back to that.

Yeah! Do you know why it goes negative? I can't see how or why that would happen!
I added a Schottky diode as you showed in that schematic, and it does help a little, but that is it :man_shrugging:.

The diode helps a little! It still goes negative though :thinking:.

Here is what it looks like after I changed the 10kΩ gate resistor on the PNP transistor to 220Ω:

As you can see, the inductor and capacitor voltages are quite a bit higher! So i had to zoom out:

Exactly what I calculated it as! The 2n3906 I am using has a maximum collector current of 200mA.

The only difference is:
The first one has the Arduino switching the pinMode of the analog reading pin to OUTPUT, to drive the capacitor low.
The second one has a separate pin driving the capacitor to GND through a NPN transistor (2n3904).

What exactly do you mean? Something like this?


(All voltages shown are for trace 1 (yellow) )

Thanks again for the help @LarryD !

Also, I found this quite interesting:

This is the traces, when I remove the resistor between the Arduino pin and the PNP transistor gate, leaving the transistor unconnected completely.

  • Show us the changes to the schematic so we can visualize what’s happening.

  • Reviewing good images of the actual wiring helps us check things too.

  • Try to go back to where just the capacitor pin is used for both the analog input and discharge.

  • An NPN would only discharge the capacitor to VCE(sat), i.e. collector saturation voltage.
    Using just a GPIO pin (open Drain) or a logic level N channel MOSFET (open Drain configuration) would be recommended, or, as in your original circuit, the same analog input pin that reads the voltage.



  • Something like this:

The scope however is 1Megohm.
Leo..

1 Like

Hello again!

Sorry, been very busy! So I'm back at it, and I think I have improved it almost as much as I possibly can with this type of idea.

I am now using a much larger coil (4 wraps, ~13inch diameter, 14.86µH) with a circuit that uses a P-channel MOSFET with a base transistor to drive the coil. A transistor is used to discharge the capacitor and a voltage divider is used to read the capacitor so it can work above 12V now.

Schematic_Metal Detector 2.pdf (53.6 KB)

I found i had to decrease the frequency from 134.4kHz to 47.8kHz to use this larger coil... the original higher frequency wouldn't work at all, nor would 13.3kHz that i tried!

I think my next move, is to make another circuit, but this one just uses a 555 timer to generate a specific frequency pulse, and a ESP32 (because of its faster processor) to read the frequency from the inductor. A change in frequency would correspond with interference in the magnetic field.

Does this sound like a good idea to anyone?

@kgray9 schematic;

Both of your BJTs need base resistors.

Tom.. :smiley: :+1: :coffee: :australia:

1 Like

:+1:

2 Likes

Thanks @TomGeorge !

Got it, ill add base resistors on the BJTs.

What did you all think of my next idea?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.