Introduction: Arduino Glove Metal Detector

This project is for the use of detecting metal for fun.

I wanted to create this because I drop my jewelry all the time and I am usually crawling on the floor for five minutes trying to find where it fell. To solve this problem I thought it would be great to make a metal detector to be used to find small objects that I drop.

I used this blog for help and as a guide and it is where I found the schematics and code I used here.

Step 1: Gather Materials

Parts:

Arduino UNO

28 gauge Magnet Wire

1 Switch

1 Piezo Buzzer

2 10k Resistor

1 1.2k Resistor

2 100n Capacitor

2 22n Capacitor

1 BC547 Transistor

9 volt Battery

Work Glove

Tools:

Plywood

Wood Glue

Sandpaper

Breadboard

Female/Male Jumper Wires

Male/Male Jumper Wires

Protoboard

Soldering Iron

Solder

Stranded Wire

Wire Strippers

Paint

Step 2: Make Coil

The first thing you want to do is create the component that will house the magnet wire and ultimately be your coil. The component needs to be 6 inches in diameter.

I found this component on thingiverse.

1. Download the stl files and set up the CNC to cut it out of plywood.

2. Glue the two rings of plywood together with wood glue. Wipe off the excess.

3. After it has completely dried, sand the edges to create a smooth component.

The next thing for the coil is to wrap the magnet wire.

1. Leave about five inches of wire to connect to the circuit.

2. Start wrapping the wire around after the five inches. You will need to wrap the wire 30 times around the plywood structure. Keep your coil neat and tight to get the best use.

3. After the 30 wraps, leave another five inches of extra wire to connect to the circuit.

Step 3: Setting Up on a Breadboard

To test if the coil works, you need to set up the breadboard. It is good to do this first before soldering on a protoboard just in case you make a mistake.

1. In the images, I have included the schematic I found from this blog and the fritzing model I made.

2. You can start plugging in parts however you like. I started with the transistor then went to resistors, capacitors, and then connecting the male/male wires on the breadboard and arduino. And lastly, I connected the switch and buzzer then connecting male/male wires to the breadboard and arduino.

3. Once you have the schematic done, attach the coil. You will need to take the ends of the extra wire that was left and scrape some of the coating off. The copper needs to be exposed to get a good connection. Use the female/male wires to connect the coil to the breadboard. The male part will go into the breadboard. The female part will have the magnet wire in it.

4. Double check that your wires are in the right pins. I had a couple of my wires in the wrong pin, and I thought that it was all messed up, but it was only this simple mistake.

5. You are almost ready to check if it works now. First you have to upload the code to the arduino. Go to the next step to see the code.

Step 4: Code

Again I have used this blog for the code. I had to play around with the code because I had a few issues, but I have read comments from other people who used the code and they had no issues. I recommend adjusting the sensitivity and seeing how it works for you.

Visit this blog for the original code. Below is the same code, but with minor changes.

// Arduino based metal detector
// (C)Dzl july 2013

// http://dzlsevilgeniuslair.blogspot.dk

/ Connect search coil oscillator (20-200kHz) to pin 5

// Connect piezo between pin 13 and GND

// Connect NULL button between pin 12 anf GND

// REMEMBER TO PRESS NULL BUTTON AFTER POWER UP!!

#define SET(x,y) (x |=(1<

#define CLR(x,y) (x &= (~(1<

#define CHK(x,y) (x & (1<

#define TOG(x,y) (x^=(1<

unsigned long t0=0; //-Last time

int t=0; //-time between ints

unsigned char tflag=0; //-Measurement ready flag

float SENSITIVITY= 1000.0; //-Guess what

//-Generate interrupt every 1000 oscillations of the search coil

SIGNAL(TIMER1_COMPA_vect)

{

OCR1A+=1000;

t=micros()-t0;

t0+=t;

tflag=1;

}

void setup()

{

Serial.begin(9600);

pinMode(13,OUTPUT); //-piezo pin

digitalWrite(12,HIGH); //-NULL SW. pull up

//-Set up counter1 to count at pin 5

TCCR1A=0;

TCCR1B=0x07;

SET(TIMSK1,OCF1A);

}

//-Float ABS

float absf(float f)

{

if(f<0.0)

return -f;

else

return f;

}

int v0=0; //-NULL value

float f=0; //-Measurement value

unsigned int FTW=0; //-Click generator rate

unsigned int PCW=0; //-Click generator phase

unsigned long timer=0; //-Click timer

void loop()

{

if(tflag)

{

if(digitalRead(12)==LOW) //-Check NULL SW.

v0=t; //-Sample new null value

f=f*0.9+absf(t-v0)*0.1; //-Running average over 10 samples

tflag=0; //-Reset flag

float clf=f*SENSITIVITY; //-Convert measurement to click frequency

if(clf>10000)

clf=10000;

FTW=clf;

Serial.println(f);

}

//-Click generator

if(millis()>timer)

{

timer+=10;

PCW+=FTW;

if(PCW&0x8000)

{

digitalWrite(13,HIGH);

PCW&=0x7fff;

}

else

digitalWrite(13,LOW);

}

}

1. Copy and paste this code into an arduino sketch.

2. Verify the code and upload it to your arduino.

Step 5: Testing and Soldering

Once the code is uploaded, you should be able to detect metals. Just hook up the arduino to a 9 volt battery and press the switch. The breadboard is used for testing and is not a stable way to use the metal detector. Now, it is time to solder your working circuit onto a protoboard.

1. Move the circuit from the breadboard to the protoboard. To start off, the breadboard has built in power and ground columns, so for the protoboard dedicate a section for power and ground that will be soldered together later.

2. Here you will wire strip the stranded wire to use on the protoboard.

3. Start soldering the parts one by one to make everything easier.

4. Once that is done, everything that was in the same row on the breadboard will need to be soldered together as one on the protoboard.

5. The wire coming from the switch connecting to ground needs to be soldered together and the wire coming from the switch connecting to pin 12 needs to be soldered together.

6. The wire coming from the buzzer connecting to ground needs to be soldered together and the wire coming from the buzzer connecting to pin 13 needs to be soldered together.

7. The power and ground areas will need a wire each to connect the protoboard to the arduino. Now you want to solder everything in the power area together. Same with the ground area.

8. After you have soldered everything on the protoboard, don't forget to solder the wires coming from the protoboard to the magnet wire.

Step 6: Mounting

To create more stability and easy maneuverability, now it is time to mount the protoboard and arduino to a piece of thin plywood.

1. Cut out a rectangular piece of plywood just the size you need to fit the protoboard and arduino.

2. Sand the edges.

3. I used sticky tack to attach the protoboard and arduino to the plywood. You can use whatever you think is best.

Step 7: Final Assembly

Now that you have a working metal detector, you can assemble it onto the glove.

1. Before the assembly, I decided to paint my plywood coil holder to make it look finished. I chose gray so that it would match my glove. You can choose whatever color you want as well as any type of glove.

2. Paint the plywood coil holder and wait for it to dry.

3. Attach the mounted protoboard and arduino to the glove. I used a hot glue gun. Again you can use whatever you think is best.

4. And there you have it hook it up to a 9 volt battery and press the switch, your glove metal detector is complete. Enjoy.

Some suggestions I got after presenting this project:

1. Use a speaker instead of a buzzer to hear the sound better.

2. Make a case for the protoboard and arduino to clip it on your side and have the coil attached to the glove.

Tech Contest

Participated in the
Tech Contest