Electronic – Flyback diode is acting weird

comparatorflybackmosfetrelayzener

I have the following schematic:

Schematic

Vcc can vary from 12 to 15 volts, so the design was intended to switch on the relay through a MOSFET when the input voltage is over 13.4 volts. The actual Zener I've used has a Zener voltage of 6.9 volts, so the comparator output should turn on at 13.8 V. However, two things are happening that I cannot explain:

  1. There is some hysteresis in the circuit. The relay turns on at 13.8V, and switches off at 13.4. I've checked with a DMM at the comparator output: when below 13.4V it is almost 0, when in between 13.4 – 13.8 it is turning to ~7 volts, then increases as I increase the input voltage. How can I explain this hysteresis, and how can I control it?

  2. Once I forgot to put flyback diode D2 in place. The scheme worked OK, but hysteresis narrowed to 0.1V, from 13.7 to 13.8V. Then I decided to use an LED instead of a regular diode, so I replaced D2 with an LED (1.8V forward drop). So with the LED, hysteresis is back to 13.4 – 13.8 volts, and the LED is lighting in this interval, going from dim to bright, then turning dark over 13.8. If I switch off the power supply, the LED produces a flash as the relay clicks.

I guess these two facts are somehow connected. Please help me explain how and why?

EDIT:

So the suggested scheme is as below?

Second schematic

I should swap the inputs, connect the open Emitter to GND, and use a pull-up resistor between Vcc and open Collector/MOSFET Gate?

My second question is still in place – how to add and control a hysteresis to this scheme?

Best Answer

The LM311 has an open-collector output. You need to connect the open emitter to ground, not VCC, and provide a pullup resistor on the open collector output.

Don't try to use an LED as a flyback diode. Use a diode with a high surge current rating.