Metal Detector

From Makerpedia
Jump to navigation Jump to search

by Ayaka Moriyama

Project Overview

This project builds a circuit that detects the presence of metal. When an air-cored coil is close to metal, the inductance of the coil changes. In the RLC circuit, this change of the inductance causes the change of the effective impedance of L and C, which results in the change in the frequency of the signal. People will hear a different sound from the one without a metal close to the coil.

Tools and Materials

  • (Number of items) item name
  • (1) 555 timer (I used LM555CN that was found in the maker space)
  • (2) 1k ohm resistor
  • (2) 2.2 µF capacitor
  • (1) 0.1 µF capacitor
  • (1) 10 µF capacitor
  • (1) coil of some inductance (in this project, I made a coil whose diameter is 8 cm with around 65 turns using copper wire whose width is 1 mm. To measure the inductance, read step 2)
  • (1) 8-ohm speaker*

Step-by-Step Instructions

Step 1 Set up a 555 timer as a square wave generator As Fig. 3 explains, a 555 timer can generate a square wave at a constant frequency. The output Vout (pin3) of the 555 timer goes into the speaker and the threshold voltage Vth (pin6) is connected to the RLC circuit. R1 = R2 = 1 kΩ, C1 = 2.2 µF, C5 = 0.1 µF In this configuration, the expected value of the frequency at which the Vout oscillates is 220 Hz because f = 1.44/((R1 + 2R2) * C1)). The measured value was 230 Hz. Pk-pk and mean value of Vout were 8.8 V and 5.79 V and those of Vth were 3.04 V and 4.47 V respectively. These were reasonable because Vcc = 9V and Vout should be close to Vcc and Vth should oscillate between 1/3 Vcc and 2/3 Vcc. When building the whole circuit, you want to choose the values of the resistors and the capacitor so that the circuit can generate an audible frequency (20-20 kHz), but you do not need to do so for a 555 timer alone. Step 2 Make an air-cored coil The configurations of a coil can be anything you want. Examples that I found on the internet were 10-20 cm in diameter and 150-200 turns. As long as it is air-cored and not too many turns, the coil should give a different frequency in response to the presence of a metal. Some websites calculate the inductance if you give certain parameters. This website ( calculated the inductance of my coil, which was 1.3 mH. However, the calculated value might not be correct. You could measure the inductance by using the LR circuit. Build a circuit like Fig. 4 (a) and send a square wave from a function generator. Using the oscilloscope, you can measure the rise/fall time by selecting the option from the measure button. Since the oscilloscope reads values on the screen, make sure you zoom up like Fig. 4 (b). This allows you to calculate the value of tau by tau = rise time / 2.2. The inductance L is the product of the tau and total resistance of the circuit, which is the sum of the resistance of the load, the coil, and the function generator. You can measure the resistance of your coil using the multimeter. Carleton’s function generator has an internal resistance of 50 Ω. If you measure a rise time for different values of the load’s resistance and plot tau vs. 1/R, you will get the value of L as its slope equals to L. My coil had a resistance of 0.61 Ω. I measured the rise time for a 10, 40, 100, 500, and 1000 Ω load resistor. The slope of my plot was 3.003 * 10^-4, and hence the inductance was around 0.30 mH. I also measured rise times with metal inside the coil, and the calculated inductance was 0.32 mH. If the inductance of the coil is smaller, the change of the inductance caused by given metal would be bigger. At the same time, the overall frequency gets higher and harder to hear. This characteristic makes sense considering the equation of the resonance frequency, which is 1/2π√LC (the circuit does not necessarily function at the resonance frequency as my circuit did not). The frequency of the entire circuit was bigger when my coil had a fewer number of turns and a smaller inductance. You need to adjust the configuration such as the number of turns depending on what you want. Step 3 Build a RLC circuit as a metal detector In this RLC circuit, the charge flows back and forth between the capacitor and the inductor when there is an AC input. When the frequency is at the resonance frequency (1/2π√LC), the effective impedance of L and C, which is Z(ω)=jωL+1/jωC , becomes zero. The RLC circuit does not necessarily oscillate at the resonance frequency in this project, but it is a good reference point with which I can compare the actual measurement of the frequency of the entire circuit. R3 = 47 kΩ, C2 = 2.2 µF, L = 0.3 mH In this configuration, the resonance frequency is around 6.2 kHz. The measured value was 10.9 kHz. If the inductance measured in step 2 was correct, this difference indicates that the circuit had a frequency that was different from the resonance frequency. The effective impedance of L and C at the measured frequency 10.9 kHz was 12.5, which was much smaller than R (47 k). This configuration allows enough current to flow through the coil so that it can react to the presence of a metal. Step 4 Connect a speaker and bring a metal closer to the coil. As the circuit (Fig. 1) shows, connect a10 µF capacitor and an 8 Ω speaker. The capacitor removes the DC offset. My circuit produced 10.9 kHz without metal and 10.7 kHz with metal inside the coil. The resonance frequency of the RLC circuit whose L is 0.3 mH and C is 2.2 µF is around 6.3 kHz. As mentioned in step 3, the circuit’s frequency seems to differ from the resonance frequency, but to calculate the possible difference of frequency due to the presence of a metal, here I use the resonance frequency. If the inductance of the coil with a metal inserted was 0.32 mH as measured in step 2, the resonance frequency would be 5.9 kHz. The expected difference in frequency is -0.4 kHz. The measured difference in frequency was -0.2 kHz. Although the value was different from what I expected, this reduction of the frequency shows that the circuit functioned properly. It is also possible that the overall frequency is the sum, or the difference of the 555 timer’s frequency and RLC circuit’s resonance frequency, or something else. Although I was not able to figure out the details of the output signal, my circuit was able to respond to the presence of a metal piece by producing a different frequency. Step 5 (Extension) Connect to the Arduino to light LEDs in response to the presence of a metal The change in the sound can be too subtle for someone to recognize. To accommodate the needs of those who cannot hear well, this step 5 uses Arduino to light LEDs when the circuit changes its frequency so that people can tell the presence of metal visually. In Arduino, there is a library called FreqCount (see more information here: This library allows you to count the frequency of the digital input. First, connect the pin3 of the 555 timer and the digital pin5 of Arduino (the library tells that the digital pin5 is the input). I tried to connect the digital pin5 to the point right before the speaker, but there was some error in Arduino, and so I recommend connecting it to the pin3 of the timer (it would be interesting to investigate the reason for thisa). As long as you connect the input to the right pin, you can do whatever you want with the frequency count. In this project, I wrote a code so that I can light a yellow LED when the signal is stable, a blue one when the frequency is decreased, and a red one when the frequency is increased. You could set the range of frequencies when the coil is not close to metal to accommodate the fluctuations of frequencies, but I observed that the frequency slowly decreased without any interaction with metals. For this reason, I wrote a program that changes the color based on the comparison between two consecutive averaged frequencies. For the actual code, see the additional files (Metal Detector_ArduinoCode_FreqCount_LED changes the color of the LED when the measured frequency exceeds the range of frequencies determined by a user, and Metal Detector_ArduinoCode_FreqCount_LED changes the color when the difference between two consecutive averaged frequencies exceeds a certain value determined by a user). In the future, I would like to investigate how the mixed signal is composed to satisfy my physics curiosity. To extend this project, it would be interesting to work on improving the sensitivity to a smaller metal and on adding an indicator that tells how close a metal is.