Maker Pro
Maker Pro

Op amp comparator troubles

upload_2022-2-25_14-11-48.png

Above is my circuit it used the LM2903 op amp

https://www.mouser.com/datasheet/2/389/cd00000534-1795799.pdf

One half of the chip is grounded and not used. The other is functioning as a comparator.

The circuit should function as a brake light switch. Such that when the BSE_IN voltage is greater than OUT7 the output of the comparator will turn off, and the P-Channel MOSFET will conduct, turning on the brake light.

OUT7 is a voltage coming from a linear regulator that I can adjust from a pot.

BSE is brake system encoder (not an actual encoder, it's a hall effect sensor with an analog output from 0-5V)

The trouble:

The problem I'm facing is when the comparator output goes low it only goes to 3V, it should go to 0V. When it goes high it goes to 5V, which is what I want.

I'm not sure why this is occurring, thank you for any help you can provide.
 
Output of op amp is open collector.
Your circuit does not allow for that.
Show the complete circuit.

This is my complete circuit. (Everything that is relevant to this system.) I understand now that I'm lacking a pull up resistor. However I tried the circuit with a pull up resistor and the behavior was the same.

I will keep trying
 
Here's a PDF of the entire circuit.

The circuit in question is connected to an external trailer brake light. Which in turn connects to the main IO header and is grounded there. The idea is to switch on or off power to the light.
 

Attachments

  • PedalControl.pdf
    882.6 KB · Views: 7
However it still doesn't work when I use a pull up to 12V. I think this is because the opamp is connected to 5V.
No.
The LM2903 comparator (not an op amp) has an open collector output, so can operate fine with the output connected to a voltage different from its operating voltage.

I suspect a wiring error.
Double check all your connections as compared to the wiring diagram.
 

Harald Kapp

Moderator
Moderator
The MOSFET you use has a built.in gate protection diode. VGSmax = +- 6 V.
Your circuit applies VGS ~ -12 V when the output of the comparator goes low. This will activate the gate-source protection diode and thus lead to a high current with subsequent high voltage on the gate of the MOSFET, not ~0 V as you expect.
Two possibilities:
  1. Use another MOSFET without the gate-source protection diode
  2. Or add a resistor in series from the output of the comparator to the gate of the MOSFET. The diode will still be activated but current will be limited. I can find no data on the max. diode current in the MOSFET datasheet. Lacking this info let's assume 1 mA (should be tolerable). Let's also assume the diode has a zener voltage of 6 V (the exact value isn't in the datasheet, but that is the max VGS anyway. So we have 6 V across the series resistor and 1 mA through the resistor which makes for R = 6 V / 1 mA = 6 kΩ. Use anything you have in that ballpark. Even 10 kΩ should be fine.
It is not a problem when the diode's breakdown sets in as the gate of the MOSFET should be protected by this diode and the VGS is the high enough to fully turn on the MOSFET.
 
I've reconfigured the circuit based on all of your advice.

upload_2022-2-28_13-20-54.png

I've added a pull up resistor, changed out the old mosfet for the BSS314PE which has a Vgs max of 20V. I changed the comparator's supply voltage to 12V. I don't have a great reason for this other than it will be slightly easier to get 12V to this IC than 5V.

An LTSpice sim in which I used, mostly similar components and replaced the comparator with an NPN BJT worked as expected.
 
Only one thing, most automotive brake lights operate as negative return.
I'd prefer to do it that way. To be honest it's been a little while since I first made this circuit. I'm revisiting it as I need to fix it's issues. I can't remember why I did it this way. I think it's that else where in the circuit I need to know that the brake pedal isn't being pressed and that needs to be logic high.

The brake light I'm using is basically just an LED array so it does work with a positive "feed"

But I'm always happy to learn standards, thank you.
 
As your sim worked whilst using an NPN bjt, why not use that in your circuit. Much simpler.
I'm comparing the analog position of a brake pedal to a set voltage, hence the need for a comparator. But I'm sure I could do this with a BJT. I'm always open to new ways of doing something.
 
This is a minor nit for your circuit, but might be an issue in some future design.

At U30B, disconnect the comparator pin 7 from GND.

In general when tying off unused elements in a multi-element component (logic gate, opamp, whatever), you should leave unused outputs floating. For some components, tying the inputs to GND forces the output high, causing the part's output stage to produce maximum current into a dead short to GND, continuously. The 2903 is rated for continuous operation into a short circuit, but that is an exception rather than the norm.

In your specific case this does not matter because the output stage is open collector rather than a totem pole; it cannot source current into the load, dead short to GND or any other. But if the component were an actual opamp as your title suggests, this could be a real issue. With both inputs shorted together (to any potential), there is a 50% chance that the output will saturate high, pushing current to GND at its internally-set limit. Datasheet ratings notwithstanding, this is not a good practice for long-term reliability.

ak
 
If you wanted the DMG1013 to work, the gate would have a pullup to 12V and a series R of 10k to the collector output. thus providing 6 to 12V on the gate, making the builtin zener redundant.
 
Top