Introduction: Metal Detector
Why not uncover the lost of treasures of bygone civilizations, (or perhaps forgotten goods from a beachside party) with your very own metal detector? In this Instructable, I'll show you how to build a metal detector that not only sounds when you've discovered something, but lights up as well! Using a handful of basic components and the Intel Edison, we'll build a basic detector capable of sensing metals of many sorts. You never know what valuables might be beneath your own feet...
Step 1: Parts and Materials
panel-mount LED holder
(3x) 2N3904 (NPN)
(1x) 2N3906 (PNP)
(3x) 1K resistor
(2x) 10K resistor
330 ohm resistor
380 ohm resistor
(2x) 0.1uF capacitor
5V6 zener diode
6x AA battery holder (9V)
(6x) AA battery
30 AWG magnet wire
18 ohm resistor
8 ohm speaker
Step 2: Electrical Design
The entire system is powered from a 9V source provided by six AA batteries. Power for the whole unit is switched on via a mini toggle switch and indicated with a single green LED that is powered via a 1K current limiting resistor. An additional 5V rail is created by a Universal Battery Eliminator Circuit (AKA a switching regulator), which provides power for the DotStar LEDs and the Edison board (via USB). The 1V8 source is from the Edison's mini breakout pin.
Main Circuit (Blue)
The actual metal detecting circuit is a slightly modified version of this circuit. I've swapped out the transistors and tweaked a few of the resistor values. If you'd like to just build a non-illuminated detector, you can ignore the yellow elements of the schematic, but be sure to add back in the speaker and its resistor (highlighted in red).
Secondary Circuit (Yellow)
Normally, the metal detecting circuit would modulate the base of the transistor to drive a small speaker. In lieu of the audio output, I decided to add visual feedback by sensing when the transistor is pulled low. The output of the main circuit is detected by one of the Edison's digital pins as a falling interrupt (all Edison pins are interrupt capable). So, whenever the circuit is reacting to the presence of a conductive object below the coils, then Edison can properly interpret those signals. For visual feedback, I chose to use a strip of DotStar RGB LEDs, which can be quickly configured and controlled via two pins in an SPI-like fashion. The DotStars need 5V logic on the clock and data pins, so I used a simply logic level converter between the Edison (using 1V8 logic) and the LEDs.
Step 3: Electrical Assembly: Main Circuit
The bulk of the circuitry can fit onto a single "half-size" protoboard. I prefer using Adafruit's protoboards as they are reasonably priced and resemble breadboards. I began by soldering female headers for the logic converter as it is the single largest individual component and I needed to ensure I had enough space for other components. I put female header blocks on both power rails, as well as a mini screw terminal block for both the 9V rail and 5V rail. I used male headers as jumpers for later addition of the coils, potentiometer, and the Edison's digital pin. I soldered the UBEC last as it is the only large, loose component.
Step 4: Electrical Assembly: Coils
Included in the .SVG files are paths for cutting out disks for winding the coils. The disks are aligned with matching wooden pegs that fit into slots in the center. The coils themselves are wound from 30 gauge enamel wire and are 70mm in diameter. One coils is 50 turns and the other is 70. After winding the coils, I soldered female header wires that I extended by a couple feet for attaching to the headers on the protoboard. The coils are then taped on top of one another.
Step 5: Mechanical Design
The main body consists of interlocking pieces of 3/4" plywood with an armrest, handgrip, mount for a control box, and a frame for the coil. Although I used plywood, you could easily build a body out of PVC as well. Just be sure that the coil frame doesn't contain any conductive material!
I designed the control to be laser-cut out of 1/4" plywood. The control box houses the battery pack, Edison, protoboard circuit. It also serves as a sturdy mounting point for the power switch, potentiometer, and LED. I've attached the vector paths as a .SVG above. A simple plastic "project box" would also make for a great control box enclosure!
Step 6: Frame Assembly: Base
The base can either be nailed or glued together. The top plate has a small hole for the coil wires. The DotStar LEDs have four wires that need to be soldered: VCC, DIN, CLK, and GND. I extended these connections with wires by a couple feet and added male header for VCC and GND and used female headers for DIN and CLK. The LEDs attached to the top plate with double stick tape.
Step 7: Frame Assembly: Control Box
The control box houses the electronics and provides a solid mounting plate for the external controls.
Baseplate - attaches via four 4-40 screws to the rear
Midplate- provides a mounting point for the Edison, battery pack, and protoboard. The Edison attaches via four 1" standoffs and is fastened with eight 4-40 screws. The battery pack attaches to the underside of the midplate and is held in place with two 4-40 screws and matching nuts. The protoboard mounts two 4-40 screws and four matching nuts (two on the underside and two below the midplate).
Faceplate- provides mounting holes for the potentiometer, LED, and powerswitch; these components pop into place and are secured with their matching nuts. The wires for the coils and DotStar strip must be fed through the hole in the faceplate prior to assembly.
Step 8: Software
The software is an Arduino-style sketch running on the Edison. The program itself is fairly simple and consists of counting the interrupt state changes on the digital pin connected to the circuit. This count is mapped to the length of the strip every 30 milliseconds and the LEDs are "redrawn.
For compatibility with the Edison, I removed line 111 of Adafruit_DotStar.cpp:
"SPI.setClockDivider((F_CPU + 4000000L) / 8000000L); // 8-ish MHz on Due"
Step 9: Operation
Operating the detector is fairly simple. After turning on the power switch and verifying that it is powered on, you can begin detecting! Adjust the sensitivity with the knob as you sweep along the ground. The lights should bounce as you encounter hidden conductive objects. Happy hunting!