# LM2903 Configuration Question/Input/Help

#### QuantumElectro

Joined Jun 19, 2019
15
Hello,

This is my first time using the LM2903 Dual Comparator. I am designing a circuit for a school project and wanted some input on the circuit.

The circuit takes a voltage signal and compares it to two reference voltages (high and low threshold). I was reading about the LM2903; however, I am not that comfortable with dual comparators.

My goal for the comparator is to take the input bus voltage and compare that voltage with a high and low reference voltage. If it passes then the OpAmp would release a 1 fail is a 0.

ALL ADVICE/CRITICISM IS WELCOMED. I am an Electrical Engineering student, always willing to learn.

#### bertus

Joined Apr 5, 2008
21,850
Hello,

In real life the opamp will be blown.
The input voltages can not be higher as the powersupply.

Bertus

#### crutschow

Joined Mar 14, 2008
29,466
ALL ADVICE/CRITICISM IS WELCOMED. I am an Electrical Engineering student, always willing to learn.

The first thing you do, as a good engineer, is to thoroughly read and understand the data sheets of all the parts you use.
I know they are often hard to understand, and many newbie designers avoid it like the plague, but it's necessary if you are to become an effective designer.
Study each and every parameter until you understand what it means (you may have to do a Google search to understand some of them).
Otherwise you will likely use the device incorrectly and you'll then puzzle over why it's not working as you wanted.

For example, look at the common-mode input range of the LM2903 below:

As you can see, the input voltages must be no greater than 1.5V to 2.0V below the supply voltage.
You have a 5V supply with input of 15V, obviously way above the input voltage range.
(Note that few IC's will accept an input voltage higher than the positive supply rail or below the negative rail.)
So you either need to increase the supply voltage appropriately, or reduce the input voltage (perhaps with a resistive voltage divider).

The comparator outputs are an open-collector, so if you want a single output from the two comparators, you can connect them together with one pull-up resistor to the supply voltage.
This will give an AND function (both outputs have to be high for a high output).
So from that you should be able to determine how to connect the inputs to the two comparators to get the output you want.

#### QuantumElectro

Joined Jun 19, 2019
15

The first thing you do, as a good engineer, is to thoroughly read and understand the data sheets of all the parts you use.
I know they are often hard to understand, and many newbie designers avoid it like the plague, but it's necessary if you are to become an effective designer.
Study each and every parameter until you understand what it means (you may have to do a Google search to understand some of them).
Otherwise you will likely use the device incorrectly and you'll then puzzle over why it's not working as you wanted.

For example, look at the common-mode input range of the LM2903 below:
View attachment 180048
As you can see, the input voltages must be no greater than 1.5V to 2.0V below the supply voltage.
You have a 5V supply with input of 15V, obviously way above the input voltage range.
(Note that few IC's will accept an input voltage higher than the positive supply rail or below the negative rail.)
So you either need to increase the supply voltage appropriately, or reduce the input voltage (perhaps with a resistive voltage divider).

The comparator outputs are an open-collector, so if you want a single output from the two comparators, you can connect them together with one pull-up resistor to the supply voltage.
This will give an AND function (both outputs have to be high for a high output).
So from that you should be able to determine how to connect the inputs to the two comparators to get the output you want.
Thank you for the feedback. I updated the circuit based on the feedback. I switched to a 15v source.

#### crutschow

Joined Mar 14, 2008
29,466
Sigh. You didn't really understand my post.
The data sheet stated that the supply voltage has to be a least 1.5V above the highest input voltage (or the input voltage 1.5V below the supply voltage).
They can't be equal.

#### QuantumElectro

Joined Jun 19, 2019
15
Sigh. You didn't really understand my post.
The data sheet stated that the supply voltage has to be a least 1.5V above the highest input voltage (or the input voltage 1.5V below the supply voltage).
They can't be equal.
I understand now. Thanks

#### crutschow

Joined Mar 14, 2008
29,466
I understand now. Thanks
Good.

Do you know how to configure the input to do what you want?
What are the two voltage thresholds you need for the window?

#### QuantumElectro

Joined Jun 19, 2019
15
Yes. I plan on increasing VCC to 20Vdc and use a voltage divider to get to 15Vdc.

I want to keep the threshold between 13.9v and 15.0v

#### crutschow

Joined Mar 14, 2008
29,466
I plan on increasing VCC to 20Vdc and use a voltage divider to get to 15Vdc.

I want to keep the threshold between 13.9v and 15.0v
Do you have any power already available?
If so, it might be easier to operate the device at that voltage, and use resistive dividers to lower the voltages at the comparator input.

#### QuantumElectro

Joined Jun 19, 2019
15
Do you have any power already available?
If so, it might be easier to operate the device at that voltage, and use resistive dividers to lower the voltages at the comparator input.
This was my idea to complete the circuit... Does anyone disagree?

#### crutschow

Joined Mar 14, 2008
29,466
Did you simulate your circuit with a varying input to see if the window voltages are what you want?

#### QuantumElectro

Joined Jun 19, 2019
15
Did you simulate your circuit with a varying input to see if the window voltages are what you want?
Yes, from the plot I believe I have achieved my goal.

#### crutschow

Joined Mar 14, 2008
29,466
Yes, from the plot I believe I have achieved my goal.
The simulated limits look like about 13.94V and 15.07V, so if that's good enough, than you are finished.

#### QuantumElectro

Joined Jun 19, 2019
15
The simulated limits look like about 13.94V and 15.07V, so if that's good enough, than you are finished.
Thank you for everyones help!

#### QuantumElectro

Joined Jun 19, 2019
15
Should the output voltage be 20V? I was reading where the pull-up resistor should have a current value of 1ma so I changed it to 20k ohms. I will be having this output to an MCU and I am worried about the high voltage. is that a concern? it's an ATTINY2313A MCU.

I just had thought the pull up resistor would set the current to 1ma.

#### crutschow

Joined Mar 14, 2008
29,466
I am worried about the high voltage. is that a concern?
It certainly is.
(Note what I said in post #3 about the input voltage to an IC not being more than its supply voltage.)
So to limit the ATTINY input voltage to the supply voltage, connect the pull-up resistor to the ATTINY's supply.
If it's 5V then use a 5kΩ pull-up to get 1ma of current.

.

#### QuantumElectro

Joined Jun 19, 2019
15
It certainly is.
The ATTINY input voltage shouldn't be more than the supply voltage, so connect the pull-up resistor to the ATTINY's supply.
If it's 5V then use a 5kΩ pull-up to get 1ma of current.

.
Thank you.

#### QuantumElectro

Joined Jun 19, 2019
15
It certainly is.
(Note what I said in post #3 about the input voltage to an IC not being more than its supply voltage.)
So to limit the ATTINY input voltage to the supply voltage, connect the pull-up resistor to the ATTINY's supply.
If it's 5V then use a 5kΩ pull-up to get 1ma of current.

.
That is what I have done, but I am getting picoamps instead of mA. see photo

#### crutschow

Joined Mar 14, 2008
29,466
That is what I have done, but I am getting picoamps instead of mA. see photo
Look at the output voltage and you'll see why.
Obviously there is no current through a resistor if there is no voltage across it.
The output has to be low to get the 1mA current.

Last edited: