LM393 Unexpected behaviour - Page 1
Forum section: electronics / beginners

author: pman92
author_rank: Contributor
timestamp: December 20, 2021, 09:58:01 am
content: Hey guys,I have an AC voltage signal from an automotive inductive speed sensor that I would like to convert to a 5v square wave for use with a microcontroller. The AC voltage amplitude depends on the speed, ie at faster speeds the voltage/amplitude and frequency both increase. I would like to be able to measure from as low as 0.5v up to a much higher voltage, maybe 50v or so.I'm trying to use an LM393 comparator to achieve this, see the attached picture of the circuit.There is 2x 1N4148 diodes that are intended to clamp the input voltage to +/- 0.6v or so (a diode voltage drop), which is connected to the inverting input of the first comparator.The non-inverting input is connected to 0v/ground, with a 150k resistor from the first comparator output for some hysteresis (about 0.3v or so).I have found the circuit works exactly as intended, as long as the input signal voltage stays below approx. 2.2v.Above that, the clamped voltage falls below -0.5v on its negative cycle, at which point the comparator output is not what I would expect (see picture).The effect being I'm getting 2 small square wave pulses on the start and end of each negative AC cycle, instead of one single pulse.I believe this may be because my input voltage into the inverting input is falling below the "Input Common Mode Voltage Range" listed in the datasheet, but I am not sure. I don't really understand what a common mode voltage range means.Is this correct? and if so what is a good solution for the problem? Is there a completely different / better / easier way to go about what I'm trying to achieve?Thanks in advance

author: wraper
author_rank: Unknown
timestamp: December 20, 2021, 10:20:41 am
content: https://www.ti.com/lit/an/snoaa35b/snoaa35b.pdf?ts=1639909420735&ref_url=https%253A%252F%252Fsuche.web.de%252FQuote

author: Kleinstein
author_rank: Super Contributor
timestamp: December 20, 2021, 10:41:58 am
content: Solution to avoid the problem is to add a little (e.g. 0.5 V) positive offset after the diodes. This could be a resistor of some 15 K together with the 150 K already there towards 5 V. Alterntively schottky diodes instead of the 1N4148 could also do.

author: Zero999
author_rank: Super Contributor
timestamp: December 20, 2021, 11:30:23 am
content: Can't you bias the input around half the supply voltage, so it never goes negative?

author: pman92
author_rank: Contributor
timestamp: December 21, 2021, 09:16:48 am
content: Thanks for the help guys.I've added 2 more resistors as shown in the picture. The circuit now works perfectly as expected, even with a low amplitude input signal. And the comparator input never falls below about -0.15v, so its within spec now.Cheers

author: Terry Bites
author_rank: Super Contributor
timestamp: December 21, 2021, 09:08:49 pm
content: Comparators dont like working down near GND.

author: BrianHG
author_rank: Super Contributor
timestamp: December 23, 2021, 12:01:21 pm
content: Unless you find a specific Rail-Rail input comparator, or one which was designed to operate with the inputs outside the rails.I would still move both the diodes tied to GND to at least ~1v and maybe use schottky diodes.