The LM339N trouble in my project

Show off any of your RTL-SDR or cheap SDR related projects.
Post Reply
Posts: 1
Joined: Tue Sep 11, 2018 7:35 am

The LM339N trouble in my project

Post by circuit » Tue Sep 11, 2018 7:45 am

I have been fascinated with electronics my whole life and read many books on it, but only recently have I began to really tinker, and I have often been befuddled by many salient details that are involved, that don't seem to be written down anywhere.
The current circuit I am working on is a LM339N comparator (LM339N_08 datasheet is given: ). It is on a 9v source. I have two voltage dividers feeding the +/- inputs. One is a simple 50% voltage divider, and the other has a photoresistor attached. The goal is that when the photoresistor detects no light, an LED attached to the output should light up.
So, the LED is attached to the outlet so it sinks to the comparator when it goes low (the fact that comparators only sink current and do not source it took me forever to discover - again it seems that there are many salient details that are hidden to newbs like myself).
The circuit works great if it does the opposite - if the light on the photoresistor turns the light off. Now, to me, it seems that if light on the photoresistor turns the light off, then I should be able to get my desired result simply by switching the inputs of the comparator. However, when I do this, the light never turns on.
The only thing I can think of (which I couldn't think of last night when I was working on it until midnight, but now that I'm in my office I'm wondering about), is that maybe the fact that the photoresistor is giving a variable voltage rather than a constant reference voltage is preventing the comparator from working.
Another possibility is that I don't know if the comparator is sinking current from my voltage dividers or not, and/or messing with their operation by providing a low-load path for electricity. Does it matter how stiff I make my divider? 200-ohm or 10k ohm dividers?
So, in short, if anyone knows much about comparators and can help me in the right path that would be great. But even more, if someone knows a good book that helps with the nitty gritty sorcery involved in electronics (like going through each major part and telling where the doozies are - like that comparators don't source currents), that would be even better.
LM339N cricuit
911b.png (11.21 KiB) Viewed 14762 times

Posts: 20
Joined: Fri Jan 19, 2018 10:37 pm
Location: Netherlands, Nuenen

Re: The LM339N trouble in my project

Post by Brightnoise » Fri Sep 21, 2018 2:19 pm

Nobody does answer. I will do. Your conclusions are right and there is no further error in your circuit. LDR in the dark rises LDR resistance; input on negative rail is then a low voltage and the inverted output is high: no LED indication. Changing plus and minus inputs results in "LED is ON when LDR is in darkness". Even simpeler is exchanging the LDR with R2. Check your circuit. Measure voltages. Must work fine. Success.

Post Reply