Arduino Metal Detector

74,528

230

83

Crazy about technology and the possibilities it can bring. I love the challenge of building uniqu...

Build a cool looking and very unique metal detector with 5 separate search coils that light up when metal is detected. The search coil closest to the metal will light up better helping identify the location of the hidden treasure!

Step 1: Gather Materials

Overview

The goal of this project was to have some fun exploring the use of multiple search coils, use light rather than sound to indicate detection and also house everything in the head of the detector.

The heart of the detector is the Arduino Nano Atmega328 which is used to measure the pulse width of a signal which passes through each search coil. The Arduino produces a square wave pulse which is fed into an LC Tank circuit which produces a decaying sine wave signal at a frequency determined by the resonant frequency of L & C. This signal is cleaned up through the LM339 voltage comparator which in effect produces a series of pulses that are presented to a digital input pin in the Arduino. The pulseIn function was used to attempt to measure the length of the pulse width of the pulses. After a lot of messing around and varying results I was able to get stable outcome by averaging multiple samples on each coil. When metal is placed near the coil the inductance of the coil changes which varies the resonant frequency of the LC circuit and therefore the pulse width. If the variation in pulse width compared against a baseline value occurs then a LED is lit directly above the coil.

Key components

  1. Arduino Nano ATmega328
  2. LM339 Quad Voltage Comparator chip x 2
  3. Vero Board 50mm x 80 mm
  4. 1K ohm resistors x 5
  5. 100 ohm resistors x 5
  6. IN4148 Signal Diode x 5
  7. 0.1uf Greencap Capacitor x 5 (Mounted by Coil)
  8. 330pf Ceramic Capacitor x 5 (Mounted on PCB to improve stability)
  9. 10K pullup resister x 1
  10. 3v LED strip with 150 ohm resistor attached (Cut from reel) x 5
  11. Suitable Mop Handle with plastic flexible joint
  12. MDF wood 6mm thick, 2 pieces 22cm x 23 cm
  13. Copper Wire 0.26mm approx 25m length (5 coils with40 turns with 20mm radius)
  14. Ping Pong Balls x 3
  15. Plastic sheet A4 Blue Color (used from document file sourced from a department store)
  16. Two part epoxy resin glue( 5min preferably)
  17. Single core 2-3mm shielded cable approx 30cm length
  18. Vero mounting posts x 20 (Small metal spikes that make it easy to attach wires to Vero Board)

Required tools

  1. Soldering iron
  2. Solder
  3. Jig Saw suitable to cut 6mm MDF wood
  4. Pliers and side cutters
  5. 50mm hole drill
  6. Hot glue gun
  7. Electric Drill
  8. Box cutter knife

Step 2: Build the Search Coil Assembly

    1. Create a Hexagonal cardboard template from cardboard by drawing a 80mm circle and dividing the circle into 8 equal segments.
    2. Use the hexagonal shape to draw the shape of the search coil assembly onto sheet of paper as per the diagram.
    3. Copy the shape onto the MDF board and using an electric Jig Saw and cut out the overall shape twice.
    4. Take one of the MDF shapes and using a 50mm diameter hole saw (door handle hole drill works well) drill 5 holes in the centre of each hexagon .
    5. Using epoxy glue fasten the two sheets together as per the diagram so that you now have 5 holes to mount the search coils.
    6. Wind 5 x copper wire coils made up of 40 turns around a 40mm cylinder (I used an old caulking gun tube)
    7. Use hot glue to stick the windings together and ensure that the start and finish of the winding has at least 20cm of lead so they can be connected to the PCB.
    8. Drill a 3mm hole in each of the Search Coil assembly to enable the copper wire coil leads to pass from bottom to the PCB as per the photo.
    9. Hot Glue the coils into place ensuring the copper wire leads are threaded through the hole and can reach the PCB. Use a lot of glue to ensure the coils are rigid and at least flush with the base of the MDF. You don't want the coils protruding out below the MDF otherwise they will be damaged when dragged across the ground.

    Step 3: Build and Test the Circuit

    The unusual shape of the circuit board was an attempt to keep the circuitry central to the device to avoid interference with the search coils.

    1. Use the stencil created earlier to mark out the Vero Board to the required shape.
    2. Mount the Arduino and LM339 devices first and use them to position the components so you can drill out the vero board as per the attached picture. Solder in the Arduino and LM339 devices.
    3. The resistors and capacitors where the added along with shielded cable to improve stability.
    4. I mounted the 0.1uf Capacitors directly on the MDF as they were quite bulky and needed to be attached to the Copper Wire loops directly. Then the shielded wire was cut to length, earthed at one end (not both!) and then connected to the PCB via a Vero pin. (See closeup of circuit)
    5. There is a calibration button on pin D2 of the Arduino that resets the threshold for each coil to enure any variations in construction can be zeroed out.

    Testing the unit

    1. Enclosed is a picture of the circuit diagram along with the Arduino code for testing the unit.
    2. Upload the code to the Arduino. Remove the USB cable from the Arduino (Important as 9v Battery + USB will overheat unit)
    3. Attach a 9v battery (Vin pin on Arduino) and observe that the unit has started up ok (Arduino flashing lights)
    4. Place the search coil somewhere away from metal. Press the calibrate button. Each LED should light as it calibrates each of the 5 coils.
    5. Move metal close to the search coil and the associated LED should light.
    6. If this does not happen check your circuit to see that everything is built correctly.

    Step 4: Complete the Case

    1. A plastic sheet was used to cover the top and the bottom of the unit and the sides where painted to ensure it was water proof.
    2. Drill holes in the cover on top to enable the LEDs to emit light. Ping Pong balls were halved and used as light diffusers to give quite a cool effect when metal is detected.
    3. A plastic container (In this case half and ear muff) was used to house the circuit board and 9v battery.
    4. In this case I chose a Mop Handle with a flexible joint that enables the Metal Detector head to swivel up and down to suit the height of the user an ensure it is comfortable to use.

    Step 5: Final Testing

    1. When the unit is turned on the sensors need calibrating.
    2. Lift the head away from any metal or objects and press the calibration button.
    3. The LEDs should light from left to right briefly and then the unit should be set to use.
    4. There are variables in the code that I have highlighted that can be played around with to improve or change performance.
    5. However I have tried to make this something you turn on and it just works.

    Enjoy

    Step 6: Single Coil Detector

    I've received a number of requests for a single coil detector for various applications so have added this section for individuals to try.

    There is a circuit diagram enclosed and the also modified code.

    Stability Tips

    1. Please note that the circuit operates at high frequencies and that the length of hookup wires can make the circuit unstable when used on a breadboard. Therefore keep wires short with minimal overlap and ensure cabling has no movement during operation.

    2. USB power from your PC will have an impact on the stability and frequency of the circuit. Therefore I recommend you power the circuit with an external 9v battery when testing.

    Share

      Recommendations

      • Make it Glow Contest 2018

        Make it Glow Contest 2018
      • Plastics Contest

        Plastics Contest
      • Optics Contest

        Optics Contest

      83 Discussions

      0
      None
      EthanW63

      6 months ago

      Hi! I'm trying to recreate your design, and it would be helpful to have a clearer image of the circuit, as it's hard to tell where some of your connections go.

      0
      None
      MaLikU9

      1 year ago

      This is the serail monitor..
      counters and pulses are not getting any value...?

      Untitled.jpg
      8 replies
      0
      None
      TechKiwiGadgetsMaLikU9

      Reply 1 year ago

      Hi

      I've included a single coil circuit and code for you to try. I suggest you start with this on breadboard and see how you get on.

      TechKiwi

      0
      None
      RaymondS78TechKiwiGadgets

      Reply 1 year ago

      Hi TechKiwi! Nice guide. I'm trying to make the single coil metal detector. Can I have some picture of the breadboard from the bottom view? And can i use veroboard instead of breadboard?

      Thanks!

      0
      None
      CameronL40TechKiwiGadgets

      Reply 7 months ago

      Thanks for these instructions - I have been having trouble getting results on using the single core circuit. I have been using 12V through the opamp on a breadboard with usb powering an Arduino UNO. I did briefly get a reading but can't reproduce it. I am wondering if I have blown something but have tested each component but it all checked out.

      I saw you have a 2nd capacitor from pin 2 of the opamp to ground in your schematic but couldn't make it out in your photo; thought this might help with discharging (like for a motor coil).

      Any clues? I will try with out pc power, and maybe solder it up

      0
      None
      TechKiwiGadgetsCameronL40

      Reply 7 months ago

      Hi the LM339 +Vcc pin should be connected to the 5v regulated power supply on the Arduino. Try this and let me know how you get on.

      0
      None
      CameronL40TechKiwiGadgets

      Reply 7 months ago

      Thanks, yes I just tried again but not getting a change. Are you able to tell me what the 3 black probes are doing in your photo? (also not sure how to put 9V or higher through the coil without hurting the arduino through the opamp output). Asking a different way - is +ve in your schematic the +vcc pin on arduino (i'm using the 5V PIN on the uno as opposed to VIN)

      0
      None
      TechKiwiGadgetsMaLikU9

      Reply 1 year ago

      Hi

      The circuit operates at a high frequency and would probably not be stable if assembled on a breadboard. I suspect the issue is being caused by the proximity of the breadboard wiring. Try removing 4 coils and just using one to gain stability first. I have code for a single coil detector if you want for testing. Otherwise, you can just edit the code to disable the other coils. Message me your email address and I will make contact so you can let me know how you get on.

      0
      None
      MaLikU9TechKiwiGadgets

      Reply 1 year ago

      cute_horrer@yahoo.com
      and yeah i will do it for one coil for testing...thank you so much for your reply

      0
      None
      RaymondS78

      1 year ago

      Hello, sorry i'm new to this. You said there's a calibrate button in D2, but i can't find it. I'm doing the Single Coil one.

      1 reply
      0
      None
      TechKiwiGadgetsRaymondS78

      Reply 1 year ago

      No probs. A 10k resistor is connected between +ve and D2. A push button switch (normally open) is connected from D2 to earth. This is used to callibrate the detector.

      0
      None
      EduardoL76

      1 year ago

      Good afternoon TechKiwi, I really liked your project and wanted to refer you to an article I'm developing, can you mean your full name so I can make a reference in my article?

      1 reply
      0
      None
      TechKiwiGadgetsEduardoL76

      Reply 1 year ago

      Hi
      Thanks for the note Im happy for you to refer to me as TechKiwi as thats the online name I use for Instructables.

      I recently changed this to TechKiwiGadgets only because I wanted a website domain and couldnt get the domain for TechKiwi.

      Hope this helps.

      TechKiwi

      0
      None
      MaLikU9

      1 year ago

      i have used 26 guage copper wire and 0.26mm meaning 30 guage wire is used in the project should i change my copper wires ?

      1 reply
      0
      None
      MaLikU9

      1 year ago

      I have made the circuit on bread board...
      Used copper coils..0.26 mm was not the unit here of coils so i have took the coil by guess seeing the pictures...the coil is aprrox smaller then the connecting wires...
      and have built the circuit according to scematic..
      All The lights (White lights of 3v connected by 100 ohm R) lights up when i connect the battery...and when i press the calibration button all the lights get off and dont detect the metal...
      i have tried sanding the ends of one coil to see if it works as coils are insulated...

      One led keeps blinking sometimes...
      Can u tell me where the problem could be i have to submit the project in 2 weeks

      20170504_195104.jpg20170504_195108.jpg20170504_195130.jpg20170504_195138.jpg
      0
      None
      AhmedE9

      2 years ago

      Hi TechKiwi

      Did you do any improvements to the detector or test the depth?

      Thanks

      2 replies
      0
      None
      TechKiwiGadgetsAhmedE9

      Reply 1 year ago

      Sorry, am picking up on this project again to see how to improve sensitivity. Will come back to you.

      0
      None
      Bean_MDTechKiwiGadgets

      Reply 1 year ago

      The best advice I can give, is power equals depth and the coil size equals sensitivity. The larger the coil, the lower the sensitivity. What helps is to make a oval search coil. It increases the depth but you have a small point of fokus. It also lengthens the search cone so to speak. Giving you more a tent shape than a funnel shape.

      Hope it helps.
      Btw. This is a very good detector...