This schematic was created for an FSAE prototype car, in order to be used to detect if HV is present. It's called the TSAL (Tractive System Active Light), and I based most of the design from YouTube.
I got the PCBs manufactured and everything works fine, apart from the LM311.
The HV connections aren't connected yet and the non-inverting (pin 2) input is pulled low through R5 & R6. The reference voltage is stable at ~3V. I would expect the LM311 to pull-low at the open-collector (pin 7) and drive the optocoupler. The output is low (~900 mV) however, the LM311 is not sinking any current. Instead it heats up by itself to 60-70°C (painful to touch by hand).
I received a batch of 5 LM311 ICs, and all of them behave the same way. I've tried testing the ICs independently on a breadboard, by also making the non-inverting input > inverting input. The output stays low (~900 mV which doesn't make sense). However it doesn't get hot this time. The comparator is not oscillating and the output is stuck at ~900 mV.
Seems like all the ICs are shorted internally which is very strange. Am I doing something stupid here?
More details
Here's a pic of the PCB layout PCB And here's a pic of the individual IC
I bought all 5 ICs locally through a retailer (like radio_shack kinda).