LM324N as comparator, point at which triggers changes if output read by microcontroller

Thread Starter

AF_Maxwell

Joined Dec 12, 2018
34
So I have an odd problem with the LM324N.

I'm using it as a comparator. Its function is completely as expected if I use an LED and resistor as the output however if I try to connect the comparator output to a microcontroller so that I can use it to trigger external interrupts it triggers at half the voltage it should be.

This is not simply an issue with the microcontroller interrupt occurring without a sufficient signal, the actual output voltage of the comparator changes to half of the reference and the comparator becomes triggered at an input voltage that is half of the reference.

Can particular types of loads change the behaviour of the chip and why would that be the case?

Resistors and LEDS on output > works good
Microcontroller pin on output > triggers when voltage in is half of reference instead of equal to reference

Mind boggling situation, changed lm324n chips and same behaviour.
 
Last edited:

crutschow

Joined Mar 14, 2008
34,417
Since my crystal ball needs cleaning, I'll need a full schematic of your circuit, including the connection to the micro, to help determine what's going on. ;)
 

Thread Starter

AF_Maxwell

Joined Dec 12, 2018
34
Since my crystal ball needs cleaning, I'll need a full schematic of your circuit, including the connection to the micro, to help determine what's going on. ;)
If this isn't readable let me know.

The capacitor is supposed to be able to charge to 50V before the comparator turns on but this happens at 25V.

All the rails are VCC and GND, where VCC is 5V.

The capacitor is being charged by a boost converter but I can't see how this could affect the comparator since only the storage capacitor is connected to it.
 

Attachments

ericgibbs

Joined Jan 29, 2010
18,848
hi AF,
I see that you have set the the Vref at approx 3.7V.
Have you scoped the junction of the 2.2meg and the cap.??
I would expect the waveform at that point to be switching and if you are checking with a DVM you may measure a lower 'average ' value.

E
 

Thread Starter

AF_Maxwell

Joined Dec 12, 2018
34
Thanks for all of the replies.

I'll take hysteresis into account and increase the supply voltage according to the datasheet.

What's curious to me is this works when the microntroller isn't plugged in, would anyone be able to shed light on that? Can the microcontroller connected to the output be acting as a particular type of hysteresis?
 

danadak

Joined Mar 10, 2018
4,057
If the signal is sufficiently fast then hysteresis is not needed. Its when
the signal ramp/risetime is very slow that coupled with noise in
system you will get multiple interrupt triggers, normally an undesirable
situation.

The UP connected to comparator does not appreciably affect its operation.
Loading of an input minimal. Only case I can think of is if comparator operated
in low power mode, thereby raising its Zout and susceptibility to C loading from
UP input.

Regards, Dana.
 

crutschow

Joined Mar 14, 2008
34,417
What's curious to me is this works when the microntroller isn't plugged in, would anyone be able to shed light on that? Can the microcontroller connected to the output be acting as a particular type of hysteresis?
That is a puzzle.
I can think of no apparent way that connecting the comparator output to the micro should affect its trip point.

Does the micro input respond to a short spike from the comparator?
If so, you may want to put a delay loop so that the input must be high for a specific time before it responds.

How are you determining the state of the comparator?
Do you have an oscilloscope to view the signals?
 
Top