Metal Detector BT1e

Metal Detector BT1e

The pulse detector BT1e is a completely revised version of the BT1 in which all previous improvements have been incorporated. The most significant improvements relate to the driver stage for the power transistor and the integration of an ISP interface.

BT1 came about for two reasons. On the one hand from the more intensive study of the possibilities of digital signal processing with AVR processors and on the other hand from the idea of ​​accommodating a pulse detector in a robust pipe body with a standard diameter (e.g. 40mm sewage pipe from the hardware store). Incidentally, installing it in a tube is very useful for building an underwater detector 😉 The present circuit was originally only intended for experimental purposes, but I liked it so much that I built a small detector out of it. It is planned to use the BT1e as a hand-held detector to search the excavation and the excavation hole, since a large detector is too unwieldy for this task and a large coil for positioning the find is too imprecise. For this task I had also installed a metal differentiation (LED) in the BT1. This was abandoned in favor of the BT1e’s sensitivity. The LED is only an optical display parallel to the speaker. There is now also an underwater version of the BT1, the BT1uw. The only difference here is the water pressure-resistant design of the housing.

The components and the dimensioning of the BT1 should be as small as possible. This was achieved by letting the processor take over the tasks of the pulse generator, tone generator and differential amplifier. The ATtiny12L was chosen as the processor. This has the necessary comparator, a small design (8-pin DIP) and an internal clock generator. This also eliminates the circuitry required for the processor clock. Incidentally, everything should also be as inexpensive as possible and be procurable from a supplier (hence an IRF9640 since the MPT2P50 is not so readily available).

Technical specifications

  • Operating voltage : 7 – 15V / DC
  • Operating current : 60 – 120 mA (software/voltage dependent)
  • Frequency : 300-500 Hz (software dependent)
  • Pulse duration : 10 – 200 yS (software setting)
  • Rechargeable battery / battery: 6-12 Nc/Ni-MH, 9 volt block, 5-10 alkaline
  • Range: up to 100cm (object and coil dependent)

Schematic diagram

Parts List

Printed Circuit Board PCB

Operation principals

In the BT1e pulse detector, the entire control is taken over by an ATtiny12L microcontroller from Atmel. All timing can be set in the program (pulse duration, half cycle, delay). The processor generates a pulse signal with a width of 10 to 200 μS (pulse duration = 1..20) at an interval of approx. 1.7 – 3.5 mS (2 x half cycle + pulse duration + delay). The pulse signal is present at PB3 (PIN2 ATtiny12) and is given to the power transistor (IRF9640 / MPT2P50) via a FET driver (ICL7667). The driver stage is necessary because the outputs of the ATtiny12L can be loaded with max. 5V 3mA HI / 20 mA LO and thus cannot drive the MOSFET directly. The power transistor switches the primary pulse, which is fed from a 4700 to 10,000 μF electrolytic capacitor. The coil thus generates an electromagnetic pulse. The secondary signal that occurs after switching off the pulse (if there is metal near the coil, the course of the falling edge changes) is amplified by the operational amplifier (LF357 / CA3130 / LM318) and passed to the comparator input PB1 (PIN6 ATtiny12L) of the microcontroller. The comparator works continuously and compares the voltage between PB0 and PB1 (PIN5/6 ATtiny12L). The reference voltage is fed to PB0 via the potentiometer with switch (voltage divider via ground and +5 V, tapping point at PIN5). The software evaluation of the comparator is carried out after a pause (delay). If the signal at PB1 is above the reference voltage at PB0 at this blanking point (ideally 15 to 20 yS after the end of the pulse), a pulse is sent to the speaker (PB2). The speaker is driven by a transistor (BC547). Compare the pictures of the Oszi. In the original version of the BT1, additional sample points were queried to determine the width of the secondary signal. So you could use the LED and the changed sound to infer the size or type of metal. However, since the signal level usually rises again somewhat in the further course, despite attenuation, several sample points on the BT1 effectively lead to a lower sensitivity. However, there are definitely still ways to implement this function with maximum sensitivity.

Signal curve with no metal in the search area and with a euro in the search area. Yellow the reference voltage from the potentiometer and the two blanking times of the comparator. Red the signal processed by the operational amplifier. Signal curve for a small screwdriver (iron) and for a larger brass object.

Apparently, shortening the SamplDelay is a way to higher sensitivity but also a shift into the critical, steep area of ​​the falling curve. The optimal timing can be set via the software and is between 15 and 20 yS. However, an oscilloscope should be used for this. In any case, the timing must be adapted to the specific coil (inductance) and the supply voltage (7-15V). The brutal increase of the supply voltage to 15V brings less than expected. With a 9V block you can already achieve quite remarkable results with less space and weight for the battery.

The half-cycle time of the main loop can certainly be changed. It should be noted, however, that changing the run time of the main loop means a change in sound. For the driver stage (BC547 max. 100 mA load) of the speaker (8 ohms), the 50 ohm resistance can be reduced to 22 ohms when using headphones (32 ohms). The supply voltage must not be below 7V, otherwise the 78L05 voltage regulator will no longer deliver a clean 5V voltage. Special circuitry measures to ensure a trouble-free Power On Reset are not necessary, since the ATtiny12 has a delayed Power On Reset cycle.

Handling the BT1e

When starting up, there must be no metal in the search area of the coil. Switch on the potentiometer with the switch and fully open the potentiometer. Then slowly turn it down until the LED and speaker are off (this is where the art lies in hitting the most sensitive area).

Operational! Calibration with scope (recommended)

For this purpose, the intended coil and the planned power supply should be installed. There must be no metal in the search area of the coil. A 2K2 trim pot is to be installed as a damping resistor. Monitor the signal at PIN6 of the OPV with the oscilloscope. Slowly reduce the damping resistance until no more overshoots or undershoots (red) can be seen. Then do not change the trim pot and measure the damping resand. Replace the trimpot with a 2 watt fixed value resistor close to the measured value.

Calibration without scope

For this purpose, the intended coil and the planned power supply should be installed. There must be no metal in the search area of the coil. A 2K2 trim pot is to be installed as a damping resistor. The rotary potentiometer with switch is to be switched on and placed in the middle position. Slowly reduce the damping resistance until the sound in the speaker just comes out. Then do not change the trim pot and measure the damping resand. Replace the trimpot with a 2 watt fixed value resistor close to the measured value.

coil (planar coil)

  • – Cover the base with foil
  • – Fix a mold for inner diameter (100mm x 5mm high) (screwed here).
  • – Seal the gap between the base and the core mold (e.g. silicone).
  • – Evenly prepare approx. 5cm around the ring with tough glue. Brush with UHU power glue, for example, and leave to set for 3-5 minutes.
  • – Wind the coil wire from the inside to the outside under slight pressure, spirally and tightly 24 turns around the core (the tough glue keeps the wire in position).
  • – Draw a 5 mm high bead of silicone around the coil at a distance of 5 mm. – Fill the coil with epoxy resin.
  • – Cast an approx. 7-8 cm long connection piece of epoxy resin in one piece from the pipe body. This allows the coil to be inserted precisely into the tube and close it.
  • – After hardening, glue both parts with 2-component glue.

Code Source For Micro-controller

;* Werkzeuge :SiSy 2.16 mit GNU Assembler/Linker 3.x, AVRDUDE 3.x
;———————————————————————–
.equ ACSR,0x08
.equ PINB,0x16
.equ DDRB,0x17
.equ PORTB,0x18
;———————————————————————–
.equ PulsDauer,8 ;Pulsdauer..80 yS
.equ HalbZyklus,80 ;Gesamtzyklus ca 1,7 mS 2 mal 800 yS
.equ Delay,2 ;Sample-Delay 20yS plus Fine-Tuning
;———————————————————————–
rjmp main ;$000 Power On Reset handler
reti
reti
reti
reti
reti
;———————————————————————–
; Start, Power ON, Reset, I/O init bei ATiny12 kein SRAM und kein STACK
main: nop
cbi DDRB,0 ; PB0 IN OPV comperator
cpi DDRB,1 ; PB1 IN poti comperator
sbi DDRB,2 ; PB2 OUT SPEAKER
sbi DDRB,3 ; PB3 OUT Endstufe
sbi DDRB,4 ; PB4 OUT LED
;———————————————————————–
mainloop: wdr
ldi r16,HalbZyklus ;wait ca. 800 yS
waitZyklus1: rcall wait10
subi r16,1
brcc waitZyklus1 ;Warteschleife
ldi r16,0b0001000 ;PB3=1
out PORTB,r16 ;IMPULS ON
wdr
ldi r16,PulsDauer ;wait 80 yS IMPULS
waitPuls: rcall wait10
subi r16,1 ;Warteschleife
brcc waitPuls
ldi r16,0b0000000 ;PB3=0
out PORTB,r16 ;IMPULS OFF
wdr
ldi r16,Delay ; 1. sampledelay
SampleDelay: rcall wait10
subi r16,1
brcc SampleDelay ;Warteschleife
nop ;Fine-Tuning
nop
nop
in r24,ACSR ;check COMPERATOR
ldi r16,0b0000000 ;alles aus oder …
sbrs r24,5 ;wenn schwellwert skip next
ldi r16,0b0010100 ;PB2=1 Speakerimpuls Ton1
out PORTB,r16
wdr
ldi r16,HalbZyklus ; HI für LED und SPK
waitZyklus2: rcall wait10
subi r16,1
brcc waitZyklus2
ldi r16,0b0000000 ;alle Lichtel aus 😉 PB2-4
out PORTB,r16 ;LO für LED und SPK
skip: rjmp mainloop
;————————————————————————-
wait10: ldi r25,2 ;warte 10 yS bei 1,2MHz
w10: subi r25,1
brcc w10
ret
;————————————————————————-

Hexadecimal Dump

:1000000005C0189518951895189518950000B8987A
:100010007130BA9ABB9ABC9AA89500E520D00150DD
:10002000E8F708E008BBA89508E019D00150E8F708
:1000300000E008BBA89502E012D00150E8F70000EC
:100040000000000088B100E085FF04E108BBA8952E
:1000500000E505D00150E8F700E008BBDDCF92E0F5
:060060009150F0F7089535
:00000001FF

error: Content is protected !!