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.

Looking for compartor circuit with independent threshold adjustments

Status
Not open for further replies.
A few more parts, but easy to set independent threshold values and will not chatter.
 

Attachments

  • Untitled picture.png
    Untitled picture.png
    81.8 KB · Views: 128
It looks ok to me, but there are a lot of strange things with the circuit. Maybe it is because I don't know what you want to do. Anyway, it looks like you just want to light an led depending on if the voltage is above or below the threshold voltage while picking a relay above that same threshold?
If that's it I don't see a need for the diodes since you can adjust the threshold (reference) voltage and the hysteresis. It is not a good idea to have U4's hysteresis depend on U1's switching since their offsets may be slightly different. Don't understand the gain for U5 - seems like you just have to adjust the pot lower so you can amplify it back up. The lower comparator can't drive close to ground with the 3 1k's so the relay voltage will be low.

If you want it like I think you do, look at this one.
The ref. pot sets the trip point and the feedback pot the spread. The relay picks above the upper threshold and drops out below the lower threshold. One led on when the relay is on, the other when it is off.

If you use a rail to rail op amp instead of the 358 you can eliminate R5.
 

Attachments

  • hyst.png
    hyst.png
    148.1 KB · Views: 116
Last edited:
It looks ok to me, but there are a lot of strange things with the circuit. Maybe it is because I don't know what you want to do. Anyway, it looks like you just want to light an led depending on if the voltage is above or below the threshold voltage while picking a relay above that same threshold?
If that's it I don't see a need for the diodes since you can adjust the threshold (reference) voltage and the hysteresis. It is not a good idea to have U4's hysteresis depend on U1's switching since their offsets may be slightly different. Don't understand the gain for U5 - seems like you just have to adjust the pot lower so you can amplify it back up. The lower comparator can't drive close to ground with the 3 1k's so the relay voltage will be low.

If you want it like I think you do, look at this one.
The ref. pot sets the trip point and the feedback pot the spread. The relay picks above the upper threshold and drops out below the lower threshold. One led on when the relay is on, the other when it is off.

If you use a rail to rail op amp instead of the 358 you can eliminate R5.

The led is bicolor two so I can't split it which is the reason for the two comparators.

The goal of the diodes is to provide an individual setpoint for each threshold, less dependent on hysteresis and more dependent on the actual threshold values. Since the LM393 is a dual package, I'm not too concerned about the difference in offset between them. If they were two separate packages, I would be.

U5 is to amplify the sensor input, depicted in the circuit as R13. R13 is actual a sensor. There are two issues solved at once by the X10 gain of U5. First I get more difference between the thresholds (100's mV instead of 10's mV). Secondly, it places the operating range of the circuit in larger section and the middle of the power supply range 5-9 volts rather than 0.5 to 0.9V.

The opamp is an MC34072 (I think) as recommended in another thread.
 
A few more parts, but easy to set independent threshold values and will not chatter.

First, have we determined why it is chattering?

Second, this was actually the type of circuit I was hoping for. Independent thresholds and setable at any time independent of the output state. I got so excited by the quick and obvious response, I forgot the other criteria (not to mention I didn't explicit ask for it).

I still need to trace out the current paths to fully understand it, but (having recieved the necessary parts today) I have entered it into my simulator and have it working, My concern with the circuit is how to get the bicolor 2-pin led working. I am attempting to configure two optoisolators to give the opposite polarities I need in order to make it work. Here's my first attempt. I don't think it works yet as the current through R19 (placeholder for the bicolor LED) is 8uA and -6mA.

ccurtis1.JPG
 
First, have we determined why it is chattering?

Second, this was actually the type of circuit I was hoping for. Independent thresholds and setable at any time independent of the output state. I got so excited by the quick and obvious response, I forgot the other criteria (not to mention I didn't explicit ask for it).

I still need to trace out the current paths to fully understand it, but (having recieved the necessary parts today) I have entered it into my simulator and have it working, My concern with the circuit is how to get the bicolor 2-pin led working. I am attempting to configure two optoisolators to give the opposite polarities I need in order to make it work. Here's my first attempt. I don't think it works yet as the current through R19 (placeholder for the bicolor LED) is 8uA and -6mA.

View attachment 75575

Hi. I do not know why the diode circuit is chattering, but I suspect it has something to do with the diode junction voltage being non-zero, resulting in an inherent dead zone that is larger than the voltage difference between the lower and upper voltage thresholds you are using. Perhaps if you increase the difference between the lower and upper thresholds to something greater than 1.4 volts that circuit will work with that limitation. Perhaps.

I added your bicolor LED driver circuit to the circuit I offered, attached. I do not see a need for optocouplers. The two transistors Q1 and Q2 form a bistable latch so that once a threshold is breached by the input voltage the latch will switch to one state and remain in that state until the other threshold is breached, upon which the latch switches to the other state, and vice-versa.
 

Attachments

  • Untitled picture.png
    Untitled picture.png
    81.8 KB · Views: 139
Hi. I do not know why the diode circuit is chattering, but I suspect it has something to do with the diode junction voltage being non-zero, resulting in an inherent dead zone that is larger than the voltage difference between the lower and upper voltage thresholds you are using. Perhaps if you increase the difference between the lower and upper thresholds to something greater than 1.4 volts that circuit will work with that limitation. Perhaps.

I added your bicolor LED driver circuit to the circuit I offered, attached. I do not see a need for optocouplers. The two transistors Q1 and Q2 form a bistable latch so that once a threshold is breached by the input voltage the latch will switch to one state and remain in that state until the other threshold is breached, upon which the latch switches to the other state, and vice-versa.

I added the optocouplers because I did not realize there were or could be two outputs. I hadn't had the chance to trace through the circuit (I still haven't, honey-do list and all). I added your output section but my simulation is howing bouncing in the diode current after the transition. Is that going to be OK?

ccurtis2.JPG

ccurtis2sim_a.JPG
 
I added the optocouplers because I did not realize there were or could be two outputs. I hadn't had the chance to trace through the circuit (I still haven't, honey-do list and all). I added your output section but my simulation is howing bouncing in the diode current after the transition. Is that going to be OK?

View attachment 75583

View attachment 75585

I don't think that is going to be a problem. For one thing, the ringing time is short, not very great, and so not likely to be noticed by eye. Second, those are fast switching diodes used in place of the LEDs. I see the ringing (though not as bad as you are showing) using the fast switching diodes, but much less with the slower LEDs in my simulations. Junction capacitance of the transistors, the use of the fast switching diodes as a load, and/or the fact that the inputs to the transistors don't switch exactly simultaneously, or instantly, is probably the cause of the ringing. Modifications can probably be done to reduce the ringing, but it means adding more parts and the ringing is not a significant concern to bother with that in my opinon.
 
Neat circuit ccurtis,

I think ADW said the relay was 240 ma., so it might need a little tweek.

Just out of curiosity did you ever try the large resistor across the diodes to see if that stopped the chatter?
 
Last edited:
Neat circuit ccurtis,

I think ADW said the relay was 240 ma., so it might need a little tweek.

Just out of curiosity did you ever try the large resistor across the diodes to see if that stopped the chatter?

I have only tried the suggestions from or near those in the thread, so I had not tried a resistor across the diodes.

There was a comment about the optocouplers I used. The optocouplers are an effort to "decouple" the load requirements from the bistable latch design. I'm working on adding optoisolators near resistors RELAY and R8 then proceed to swap out the Q3/Q4 sections to accomplish this. But if anyone beats me to it, please post.
 
Neat circuit ccurtis,

I think ADW said the relay was 240 ma., so it might need a little tweek.

Just out of curiosity did you ever try the large resistor across the diodes to see if that stopped the chatter?

Thanks, ronv. I missed the relay current of 240 ma. Yes, to account for that use the following in place of the original values.
Relay -- -- resistor, 50 (was 100)
R7 -- -- resistor, 3.3K (was 6.8K)
R8 -- -- resistor, 1K (was 2.2K)

About the chatter, I think you are referring to the circuit that uses diodes to steer feedback for independent threshold control. I have not simulated that circuit.
 
Last edited:
I added the optocouplers because I did not realize there were or could be two outputs. I hadn't had the chance to trace through the circuit (I still haven't, honey-do list and all). I added your output section but my simulation is howing bouncing in the diode current after the transition. Is that going to be OK?
]

Thinking more about this, you can use the LEDs in the optocouplers to simulate LEDs instead of using the 1N914 diodes to simulate LEDs to see how that affects the ringing you see in your simulation.

In my simulations, 0.01uF across the bicolor diode pair kills the ringing, even if switching diodes are used in place of the LEDs. But I still think the ringing is not a problem.
 
Last edited:
I would like to replace (or add to) the resistors RELAY and R8, optocouplers to isolate the load from the bistable latch. It appears that the resistors in the latch are somewhat dependent on the load. I have another design that may benefit from this design, but I haven't been able to think through that design (as I'm still working on this one).
 
I would like to replace (or add to) the resistors RELAY and R8, optocouplers to isolate the load from the bistable latch. It appears that the resistors in the latch are somewhat dependent on the load. I have another design that may benefit from this design, but I haven't been able to think through that design (as I'm still working on this one).

True, the resistor values are dependent on the load. The considerations when selecting the resistors for the bistable latch are:

1. There is enough base drive to turn one transistor on when the other transistor is off. The amount of base drive required is dependent on the current through the load (resistor, relay, etc) when it's transistor is on, and the current gain of the transistor (Hfe).
2. The load resistors should not be so small that unnecessary amount of power is wasted in them when their respective transistors are turned on, yet not so large that there will be insufficient base drive for the associated transistor.
3. The comparators must have enough drive capability to pull the bases of their respective transistors low (well below 0.7 volts) to turn the transistors off, given the resistors selected.

Transistors will isolate the bicolor LED from the circuit more than optocouplers will, at least as far as the amount of loading on the circuit is concerned. That is because the current gain of a transistor can far exceed the current gain of most optocouplers, by a factor of 10, or more. In other words, the optos will load the circuit more than the base current of a transistor will. The optos, themselves, are LED loads. If you need the bicolor LED to be electrically isolated from the bistable latch, for some reason, that is a different matter. Too, a two-leaded bicolor LED has the unfortunate problem of a more complicated drive architecture than a three-leaded bicolor LED. A common anode, three-leaded bicolor LED and a couple of added resistors can easily be driven directly by the bistable latch, without additional transistors.
 
ccurtis,

My goal is to implement a design that I can use in another design without having to review and reselect the resistor values.

I know you're not a big fan of this layout, but how did I do with the resistor selections? The target was 5mA through the opto when the corresponding transistor is on.

bistable latch with opto.JPG

As I was typing the previous circuit, it also became clear as to what you meant about the transistors would isolate the loads at less (current) cost. So I revised your circuit and mine. The idea is to move the loads outside the transistors used for the latch. How did I do?

bistable latch with trans.JPG
 
Where is the relay?

It's not in the optocoupler circuit. I know the opto's will provide enough isolation between the bistable latch design and the load requirements that I didn't include it.

In the second circuit, in the upper right, represented 50 ohm resistor driven by R19/Q19.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top