Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

comparator circuit question

Status
Not open for further replies.

dano

New Member
I know plenty about metalworking machines but little about electronics so any help would be appreciated.
I've been trying to make sense of the following circuit but I'm not having any luck.
This is my third attempt ( in this post) at an attachment, I hope it works. What's the saying? The third time is the charm.
 

Attachments

  • comparator_circuit.gif
    comparator_circuit.gif
    3.8 KB · Views: 680
dano said:
I know plenty about metalworking machines but little about electronics so any help would be appreciated.
I've been trying to make sense of the following circuit but I'm not having any luck.
This is my third attempt ( in this post) at an attachment, I hope it works. What's the saying? The third time is the charm.

We say "Third time lucky"

I'm not surprised you cannot make sense of this circuit. To make it work, either R2 or R3 should be connected to a reference voltage, eg. ground.

If R2 is connected to gnd, then the voltage at the negative input will be about 7.5 Volt. Thus if a voltage is applied to R3 such that the + input is less than 7.5 Volt, then the output will be Low (ie. = 0 Volt).

Alternatively, if a voltage is applied to R3 such that the + input is greater than 7.5 Volt, then the output will be High (ie. = 15 Volt).

There will be some hystersis because of the positive feedback via R1.

But if R3 is connected to a voltage scuh as +7.5 Volt, then it becomes an inverting comparitor with hystersis due to R1.

I'll leave it to you to calculate the threshold voltages for each case as an exercise. If you have a problem doing this, let us know and we will help.

Len
 
Wow thanks for the quick reply. I'm still confused though. If R3 and R2 are low then the output of the comparator is low. If we apply a 15 volt pulse to R3 won't the output still be low. Also if we apply a 15 volt pulse to R2 the output is still low. The data sheet I copied the circuit from listed it as a bi-stable multivibrator. Once the output is low the plus input voltage will never get over about 5 volts. The minus input voltage will be either 15 volts or 7.5 volts. What am I missing?

Dan
 
You did not say what type of IC it is nor to what voltage the negative supply pin (Vee) is connected.

So I have assumed that it is a voltage comparator with an open collector output and that Vee is connected to gnd (0 Volt).

Now your questions and my answers:-

Q1. If R3 and R2 are low, then the output of the comparator is low? It could be High or Low depending on which state the bistable is in.

Q2. If we apply a 15 volt pulse to R3 won't the output still be low? Yes if it was initially Low.

Q3. Also if we apply a 15 volt pulse to R2 the output is still low? Ditto

Q4. The data sheet I copied the circuit from listed it as a bi-stable multivibrator?
It is a voltage comparator with hysteresis. So it can be used as a bistable if the input voltage (ie. at R3) is held normally between the threshold levels.

Q5. Once the output is low the plus input voltage will never get over about 5 volts? Yes if you limit the voltage at R3 to between 15 Volt and 0 Volt.

Q6. The minus input voltage will be either 15 volts or 7.5 volts? Yes, assuming R2 is connected to either gnd or +15 Volt.

What you are missing is that the voltage applied to R3 can go above +15 Volt or below 0 Volt.

My calculations show that the threshold levels are +22.2 Volt and -3.86 Volt - assuming that R2 is connected to gnd.

So when Vin (the voltage at R3) is > 22.2 Volt, the output will go High and remain high until Vin is reduced to < -3.86 Volt.

Thus the circuit acts as a Bistable if Vin is held normally in between the threshold levels (say at 0 Volt for example). Thus to set the bistable (ie. make Vout High), you must apply a pulse of > 22.2 Volt to R3. Once set High, it will remain high until you apply a pulse of < 3.86 Volt to R3.

If any of this is still unclear, please ask.
Len
 
dano said:
Thanks Len, things are clearer now. I was using the info from the data sheet here: https://www.electro-tech-online.com/custompdfs/2004/04/LM339-1.pdf page 8. I was assuming that the input pulses were between 0 and 15 volts.

Yes, I would assume that as well, and that the circuit runs off a single rail supply of 15V.

Is there a particular reason you're building this?, it seems a fairly clumsy way to build a bistable - unless you have a spare comparator left over from a chip already on the board.
 
hi, Nigel, in response to your question, yes there is a reason for me building this circuit. Let me start from the beginning.

I repair CNC machines for a living, I do both mechanical and electrical repairs. I've had training in both. Just not electronics. I've been dealing with a problem lately where the machine loses its motion control because of a problem in one of two areas. 1. An interface board problem 2. The machine loses it's 5 volt supply. Both of these problems are intermittant and never occur while I'm there. So I decided that I could eliminate the question whether the power supply was the problem by adding a comparator circuit and trapping any low voltage events (below 4.9 volts) . Now this brings me to the original post. While looking at the data sheets for the LM339 comparator I saw this circuit and thought I might use it to latch my low signal. I've been trying to design a circuit that will trap any low events on both my 5 volt and 24 volt rails. I have the LM339 already so that was the reason for using it. I want an LED to turn on if the 5 volts goes below 4.9 and a seperate one to go on if the 24 volts goes below 20 volts. These are DC voltages.

Sorry for the long post. Must run, time for the kids soccor games.

Thanks Dan
 
Dan,
You can achieve the thresholds you want if you change the resistor values in order to change the hystersis and the levels.

However, in order to achieve the 20 Volt level, you will have to do some level shifting. See below.

To detect the 20 Volt, connect R3 to gnd and an new resistor from the + input to the 24 Volt supply to be monitored and alter the values of R1 and R3 as necessary. This arrangement means that you need to set the threshold to say 10 Volt (ie. half of 20 Volt). Alternatively, you could increase the supply voltage to say 18 Volt in order to give you more leeway.

When you design the circuit, post it so we can comment - there are some subtle points that you may not be aware of to do with input bias currents.

Len
 
Thanks Len, I was wondering if I can power the comparator with a battery, connecting the minus terminal of the battery to the 0 volt rail of the power supplies being tested. I'm just thinking that if the power supply drops out then there is no power to my circuit?

Thanks

Dan
 
dano said:
Thanks Len, I was wondering if I can power the comparator with a battery, connecting the minus terminal of the battery to the 0 volt rail of the power supplies being tested. I'm just thinking that if the power supply drops out then there is no power to my circuit?

Thanks

Dan

Yes you can, but the battery will have a limited life. Yes connect the - battery terminal to 0V.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top