I'm trying to design a pulse induction metal detector to increase my EE skills a little bit.
I started to sketch out the transmitting stage, which is just a MOSFET that switches current through a search coil and limits the back-emf for further processing.
What I want to achieve is to pull a pin on my microcontroller high (+5V) when the transmit pulse starts and pull it back to low (GND) when the back-emf sets in i.e the voltage goes negative on test point 2 (TP2).
The microcontroller pin is therefore connected to test point 3 (TP3) and the problem I have is that the transistor is still open (?) and the voltage drops to -12V, which kills the input pin on the microcontroller.
So my question is how could I improve the design to only have +5V or GND on the microcontrollers input pin? I've already tried to place a diode after the emitter but this still leaves a negative voltage of about -0.7V ...
Thanks for any advice!
PS: The TVS diode clamps the voltage to +/- 12V
RESPONSE TO ANSWER