JohnRob:
Your issue is the common mode voltage of the LM339 is Vs - 1.5 V.
This means both the + and - inputs cannot go above 3.5V when powered with 5V.
This is a very old part. I'm sure there are newer comparators available that are designed for 5V operation (with a larger common mode voltage). I don't know any off hand but perhaps digikey website can help.
Okey so summed up my VREF cant go higher then 3.5V ?
Grumpy_Mike:
Then why does the diagram say it uses a LM393?
I guess LM393 and LM339 are the same comperators only difference LM339 has 4 of them integrated
larryd:
An LM339/393 is still a good comparator for this.
I like using the inverting 339 comparator circuit.
Your R1 should be close to the parallel value R4 and R5.
You may have to tune the hysteresis.
With Vcc = 5V
“ change the R5 to 39kOhm so that way VREF is 4V ?”
39k is reasonable.
Show us your wiring with the 39k
Try 3.5v as mentioned.
.
As im doing this in school i will try tommorow chaning VREF to about 3.5V and afterward make a picture if it still doenst work. But finally I got an clue what it could be thanks to you guys.
jremington:
As stated in reply #2, the LM339 comparator WILL NOT WORK with 4V on the inputs, if powered by 5V.
Use a 9V power supply for the comparator instead of 5V.
So if use then a 9V Power Supply will the output will jump onto 9V? or am i wrong?
//EDIT: And yea i measured VREF 4V are on it
One more question where can i find Vs= 1.5 V in datasheet so if needed i can look for a different comperator? What is it normaly named? Cause in the LM393 or LM339 Datasheets i cant really find it