Voltage comparator

Thread Starter

Misieek

Joined Mar 17, 2021
34
Ok, here we go.
1616351255743.png
R8, R9, C3, and R6 values still need to be tested. Added R10 pullup resistor. Is R7 necessary? Any further changes? Some protection elements to add? Let me know :)
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
Ok, so I made a PCB. However, there is one problem. The voltage on TL431 output is not like I calculated. What is more it changes when I change the supply voltage. For example, for 12V VCC there is around 4.2V at the TL431, for 14V there is 5.1V etc.

Maybe the solution is to connect R3 to the VCC instead of TL431 output like on this schematic:
1616928362595.png
 

Ian0

Joined Aug 7, 2020
13,132
You need to allow 1mA for a TL431 to work properly. R5 is too high.


In your new circuit you have two inverting stages. When the input voltage is too high, the TL431 output goes low, turning the MOSFET on.
When the input voltage is too low, the TL431 output goes high, turning the MOSFET off.
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
You need to allow 1mA for a TL431 to work properly. R5 is too high.
Ok, I will change R5 to 4k7.

In your new circuit you have two inverting stages.
It's just TL431 example of implementation circuit to consider connecting R3 to VCC on my schematic.

For now, I will change R5 and then if it doesn't help I will connect R3 to VCC. Am I right?
 

Ian0

Joined Aug 7, 2020
13,132
R3 only goes to V+ if you are using the TL431 as a comparator. To use it to generate a reference voltage, it must go to the cathode.

You should allow for the minimum battery voltage of 10.8V. Then you also have 333uA through the divider chain, so the correct value should be (10.8-7.5)/1.333mA = 2.4k
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
the correct value should be (10.8-7.5)/1.333mA = 2.4k
I did 2.2k. Unfortunately it still doesn't work properly. I measured voltages on TL431 for different VCCs.
1616939118287.png

I attached light bulb to the output and began further tests. At 10,11,12 and 13V of VCC voltage level the mosfet is slightly opened, because I can see the light bulb slightly shining. So I measured voltage on IN_A TC4427. Maybe R10 is too small?

Edit: I can't measure IN_A on 10V VCC because whenever I put the voltmeter probes to that pin, something charges or discharges and the light bulb goes on and voltage is 0.03V.
 
Last edited:

crutschow

Joined Mar 14, 2008
38,508
Here's the LTspice simulation of the comparator circuit as, I think, you have it:
The TL431 reference voltage is steady at 7.3V and the comparator trips at 14.6V for the pot at the 50% setting.
If your voltages are significantly different (your attachment does not work), then check all the connections and resistor values.

1616940527379.png
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
Circuit with currently applied values:
1616946937104.png
I checked all resistor values with color coding. They're good.

I also made TL431 circuit on breadboard and it produced reference voltage like I wanted to. So I replaced TL431 on PCB with this one I tested a while ago, but it didn't help. Maybe LM393 is broken and brings voltage from TL413 down? Added Kicad project.
 

Attachments

Ian0

Joined Aug 7, 2020
13,132
Is your reference stable?
I've never been a great fan of the TL431, I've always found it has a tendency to oscillate. Does it need a decoupling capacitor? Some values make it more unstable.
I would have used a fixed reference such as an LM4040 and a different divider.
But as you've already got the TL431, try shorting out R5 and deleting R6 and the Pot to give a 2.5V reference, then make R3 15k
 

crutschow

Joined Mar 14, 2008
38,508
Here is the simulation of the circuit modified with the LM431 set to 2.5V, as Ian0 suggested:
It gives the same results but eliminates two resistors.

1616954397619.png
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
In my humble opinion the problem is not with TL431, because I build this part of the circuit on breaboard and it worked.
1616955772167.png
My idea is to cut the trace going from LM431 to LM393 and then measure the reference voltage to see if it works. If it will be ok, then I will cut the trage going from LM393 to TC4427 and measure voltages one more time.
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
Ok, so here are the results.

Firstly, I cut trace between LM431 output and LM393 input - the lightbulb goes randomly on or off while touching LM393 inputs. When light is on, the LM431 output voltages are right, according to assumptions. When the light is off, the LM431 output voltage isn't ok.

Then, I soldered that trace back and then cut trace which supplies (VCC) TC4427. The light is constantly on, the voltages on LM431 are good, the LM393 compares voltage as it should be outputting. Its output is LOW when VCC is smaller than reference voltage, and HIGH when it's higher.
 
Last edited:

Thread Starter

Misieek

Joined Mar 17, 2021
34
Update: It works without LOAD, but when I connect just a light bulb it refuses to work. Hystheresis is a little bit too wide, (0,4V) but it's the smallest problem for now. Any ideas?
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
Hello again... still fighting with that project. This is the new schematic:
1628070411731.png
I changed TL431 to LM4040, as @Ian0 suggested. However there is still a strange thing happening. The voltage on V- input of LM393 drops down when I try to measure it, or I touch it. Any ideas?
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
I tried replacing LM393 with LM358 but there is the same effect. Please, let's try to figure out what's going on here :/

Maybe MOSFET driver is the problem?
 

Papabravo

Joined Feb 24, 2006
22,082
I tried replacing LM393 with LM358 but there is the same effect. Please, let's try to figure out what's going on here :/

Maybe MOSFET driver is the problem?
Houston - we have a problem!
The LM393 is a comparator with an open collector output. Normally it is an open loop digital device, but the feedback resistor provides hysteresis.
The LM358 is an operational amplifier, and a pullup on the output is....ah unusual to say the least.
I would not expect this to either work or provide useful information.
Something is not right with your connections if you can move a node in a circuit around by measuring or touching it, then there is no driving source and you have nothing but high impedance paths. If you have a low impedance driving source you cannot do this.
 
Last edited:
Top