I am currently working with the LM393N and am inconsistently getting a high output when it should be low. Below is a schematic showing the inputs and outputs of the IC.
VCC is coming from a "12V" rail supplied by a 12V zener with a 5K current limiting resistor and a 47uF cap in parallel (I know it's not ideal but I'm on a budget!).
The comparator is supposed to output a low signal, turning on the IL420 phototriac, when the capacitor (C1 on schematic) is discharged below around 1.5V. The expected output can be seen in the circuit simulation below. What's actually happening is the output stays high regardless of the capacitor voltage...... sometimes. Perhaps the most frustrating thing about this is that the problem only occurs occasionally, if I had to estimate it's probably around 10% of the time, the rest of the time the circuit performs its job admirably.
What I've already tried/checked:
The LM393N output is open-collector so I thought that the combination of the 3.3K resistor and LED internal to the IL420 may not be behaving as a suitable pull-up resistor, so I put a 4.7K resistor from VCC to the output. No dice.
The input common mode range is listed on the datasheet as 0 to VCC-1.5V max, so I put the 40K resistor in between the source pin of the 2N7000 and the comparator input to ensure that the voltage wouldn't exceeded 9.5V (the voltage across the zener occasionally dips to 11.5-ish but I believe the input voltage stays within range).
Maybe this goes without saying but I've checked that the cap is fully discharging, the (+) input is getting 1.5V and that the output is high when it shouldn't be.
Note - I know using an N-Channel MOSFET to drive a load on the source isn't necessarily best practice but this is a rough prototype at the moment.
Note numero dos - It's also worth mentioning that I am using both comparators on the chip and the other behaves as expected, at least so far.
Thanks for any and all help,