Pulse PI-AR metal detector based on stm32f103c8t6 microcontroller. The name is taken from the words PI – pulse principle of operation, AR – abbreviated from ARM microcontroller. The software is developed in the Arduino environment. Metal detector parameters, coin detection by air, 25 mm to 25 cm, large objects up to 200 cm. The schematic diagram is shown in Fig.
The principle of operation is the same as for all pulse metal detectors. A short current pulse is applied to the L1 search coil, (120 μs in this case) inducing eddy currents in the target. With a sharp interruption of the pulse, an EMF of self-induction occurs in the coil and these eddy currents increase the decay time of the self-induction pulse, then the signal is amplified by the analog part and recorded by the microcontroller. The figures show oscillograms, the first without metal in the field of view of the coil, the second with metal. The first channel of the oscilloscope, the output from the coil through the limiting circuit R5, D1, D2. The second channel is an input to the microcontroller contact (A0).
The pulse to the L1 coil is fed through the T1 transistor, which is controlled by the B9 circuit (contact of the STM32 board), R6, T2, R1, R2. Resistor R5 and diodes D1, D2 limit the self-induction voltage of the L1 coil to 2 volts. The analog part is made on an operational amplifier DA1 (TL072) and a transistor T3, the latter serves to amplify and match the levels with a 3.3 volt microcontroller. Then the signal goes to the input (A0) of the STM32F103C8T6 microcontroller, where the timer is captured from (1) to (0) and after processing the signal, the value is displayed on the indicator. This microcontroller was chosen because of its speed, which is very important in this case (I didn’t want to complicate the analog part, when it can be processed digitally), and the support of this board in ARDUINO. The indication is made on a ready-made WS2812B module of eight LEDs and a buzzer with a supply voltage of 5 volts. Control is carried out using an encoder (setting the sensitivity, brightness, turning off and on the buzzer, increasing, decreasing the detection depth and expanding the display scale.)
Making a coil
The coil is wound with a 0.7 mm wire, on a mandrel 200 mm, 25 turns, then tightly twisted with a thread. The coil body is made of 5 mm thick PVC sheet and glued with PVC pipe glue.
The rod
The rod is made of PVC pipes connected with glue. These pipes have good rigidity compared to those that are soldered, well, and are lighter in weight.
Software
In the ARDUINO environment, you need to download the library for STM32 boards, then install support for 32-bit CORTEX M3 boards in the board manager. Then select the Generic STM32F103C series board. Select a programmer (I used the ST-LINK programmer). The sketch for the firmware is attached in the archive. Everything is commented in the sketch so that everything should be clear.
Power supply
As a power source, I used a POWER-BANK 10 Ah and a DC-DC step-up converter. Since the POWER-BANK did not want to work with it, (the protection worked) I soldered the wires directly to the batteries, the output turned out to be 3.7 – 4.2 volts. In this case must be used EXTREMELY CAREFULLY !!! from a short circuit, batteries can explode and prevent a discharge below 2.7 volts (you cannot do this !!!, you need to put additional protection). Further, we set a voltage of 12 volts at the output of the DC converter. At the moment of power-up (while the microcontroller is initializing), the T1 transistor was open and the DC converter did not start, for this, a resistor R4 was added.
DC – DC boost converter MT3608.
Here I put a power filter (just in case).
Current consumption at the time of operation is 80 milliamperes.
PCB making
To manufacture the block itself, we need a ready-made board with an STM32F103C8T6 microcontroller, an encoder, a 5-volt buzzer, an LED module of 8 WS2812B LEDs in the form of a strip or circle, and radio elements indicated in the list.
The printed circuit board is made in Sprint-Layout software .
Assembled. Here, instead of R7, R8 and R10, R11 put trimmer resistors to adjust for maximum sensitivity.
Customization
A properly assembled circuit does not need adjustment. Instead of R10, R11 put a 10 kΩ trimmer resistor, the best option is R10 – 3 kΩ, R11 – 7 kΩ. Instead of R7 and R8, I also put a 100 kΩ trimmer resistor. The best option is R7 – 18 kOhm, R8 – 82 kOhm. All adjustments were made at a supply voltage of 12 volts. Connectors for connecting the coil and power supply should be set more powerful, such as in the photo will not work (affects the sensitivity and false alarms), but it is better to solder on a straight line. I redid it in this photo.
Working with the metal detector
When turning on the power, the search coil must be moved away from metal objects as the sensitivity is automatically adjusted. Further, the sensitivity of the metal detector is adjusted manually by rotating the encoder knob. There is also a menu mode. The first press on the encoder knob, we enter the LED brightness adjustment mode. The second press, the mode of turning on, turning off the buzzer. The third press, the mode of adjusting the depth of target detection, decrease or increase the pulse duration per coil, from 120 to 50 μs (default 120 μs). The fourth press, we enter the adjustment mode for large or small objects, expand the display scale (by default at the minimum, more sensitive). The fifth press, exit the menu mode and auto-adjust the sensitivity (move away from the metal).
Complete metal detector.
Video demo
List of radioelements
Designation | Type of | Denomination | Quantity | Note | |
---|---|---|---|---|---|
T1 | MOSFET transistor |
IRF740
|
1 | ||
T2, T3, T4 | Bipolar transistor |
BC547
|
3 | ||
VR1 | Linear regulator |
L7805AB
|
1 | ||
IC1 | MK STM32 |
STM32F103C8
|
1 | ||
R1 | Resistor | 6.8 kΩ | 1 | smd 1206 | |
R2 | Resistor |
20 ohm
|
1 | smd 1206 | |
R3 | Resistor |
390 Ohm
|
1 | 2W | |
R4 | Resistor |
10 kΩ
|
1 | smd 1206 | |
R5 | Resistor |
620 Ohm
|
2 | 1W | |
R6, R13 | Resistor | 3.9 kΩ | 1 | smd 1206 | |
R7 | Resistor |
18 kΩ
|
1 | smd 1206 | |
R8 | Resistor |
82 k Ohm
|
1 | smd 1206 | |
R9 | Resistor |
1 mΩ
|
1 | smd 1206 | |
R10 | Resistor | 3.6 kΩ | 1 | smd 1206 | |
R11 | Resistor | 7.5 kΩ | 1 | smd 1206 | |
R12 | Resistor |
1 kΩ
|
2 | smd 1206 | |
R14 | Resistor | 100 | 1 | smd 1206 | |
C1, C5, C6 | Capacitor | 100n | 3 | smd 1206 | |
C2 | Capacitor | 3300 uf | 1 | 25 in | |
C3 | Capacitor | 1 uf | 1 | 16 in | |
C4 | Capacitor | 10 uf | 1 | ||
C7 | Capacitor | 2200 uf | 1 | 10 in | |
C8 | Capacitor | 1000 uf | 1 | 10 in | |
VD1, VD2 | Diode | 1N4841 | 2 | ||
DA1 | Operational amplifier | TL 072 | 1 |