I'm trying to simulate a design I found for an inductance meter based on an LC tank and Arduino. To simulate this circuit, I put an amplitude for the current pulse of 40 mA, approximately the current that an Arduino pin gives to 5V. The values ​​for the rise and fall times of the pulse are also set according to those of Arduino, as I read, about 10 ns. The diode would be to protect the output pin of the Arduino from high voltages that could occur at the output of the RLC circuit. For L and C I have chosen suitable values ​​so that the underdamped circuit condition is fulfilled (R>2*sqr(L/C). The resistor connected to the comparator output is a pull-up resistor so that it does not is "floating", since the output is open collector. With all this, the output of the LM339 comparator should be a pulse signal with a cycle of 50% duty and same frequency as the resonant frequency.However it switches in the middle of the negative half cycles of the RLC circuit oscillation when it should be held at zero. Does anyone know why this might be happening?

Attached the results of the simulation

Circuit to simulate on LTSpiceenter image description here enter image description here


1 Answer 1


The specification sheet on page 12, paragraph, Input Voltage Range, states that the input must be between Vcc-2V to zero volts (assuming power ground pin is connected to ground). "Operation outside of this range can yield incorrect comparisons." The input voltage is going below zero volts.

Try connecting the power ground pin to a negative power supply (e.g., -5V) and see if this corrects your issue.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.