Electronic – MOSFET in LTspice sim conducts below the threshold voltage

comparatorltspicemosfet

Electronics noob here! I'm trying to create a circuit that feeds the output of a piezo transducer into a comparator, in order bring an arduino pin high when the piezo's output exceeds the comparator's reference voltage.

The annoying thing with this is that in order to test it, I have to physically depress the piezo. So in order to allow remote testing, I am trying to add the capability of bringing the input to the comparator high using software (in essence "emulating" a voltage from the piezo's output).

Here's the circuit I came up with:

enter image description here

The voltage source MCU is how I've modelled an output pin on the arduino, and similarly for the Piezo voltage source – both of which are 5v pulses.

When I simulated the circuit, it appeared that the MOSFET M1 always conducted ~4.5V between the drain and the source, even when the gate voltage was 0. Here is the simulation:

enter image description here

You can see that the input to the comparator "V(CompIn)" is always high, even when the MOSFET should be off. I'm sure it's just my lack of experience but could someone tell me what I'm missing here?

Best Answer

  1. Add a pull-down resistor, maybe 5-50 kohms between the comparator input and ground.

  2. Change the FET to a PMOS type. Keep the source and drain connections as they are.

  3. Invert the signal from the MCU (send a 1 when you previously sent 0 and vice versa).

Related Topic