Is my LM339N Broken?

Thread Starter

hellohellosharp

Joined Apr 19, 2011
27
I am trying to use an op amp in this chip and it seems to be dysfunctional. Is there a simple way to test this?

Here is an image:



I tried hooking pin 3 (VCC) to six volts, pin 12 to ground, pin 4 to ground, and pin 5 to 1.5 volts, and pin 2 to an LED. But the LED won't turn on. Shouldnt there be 6 volts coming from pin 2?
 

JohnInTX

Joined Jun 26, 2012
4,787
The 339 is a comparator with an OPEN COLLECTOR output. Its intended that the output be pulled up to +V (or in your case, an LED and resistor) for proper operation.

With the + input higher then the - the output will be OFF, allowing the presumed pullup to make the output high. The 339 does not source any current itself.

You'll want to connect the cathode of the LED to the output and the anode through a resistor to +V. The LED will turn on when the output is low i.e. the - input is > the + input.
 

Thread Starter

hellohellosharp

Joined Apr 19, 2011
27
Thanks for the help guys. I got it working like John said, i put the annode in 7.5 volts and the cathode on the out for the op-amp :)

I now need to use this op-amp to trigger the clock on the 4013BE flip flop. Any ideas how to do this?
 

crutschow

Joined Mar 14, 2008
34,470
Thanks for the help guys. I got it working like John said, i put the annode in 7.5 volts and the cathode on the out for the op-amp :)

I now need to use this op-amp to trigger the clock on the 4013BE flip flop. Any ideas how to do this?
The LM339 is a comparator, not an op amp. They both use the same schematic symbol but a comparator is like an op amp without feedback compensation, so it can't be readily used in typical op amp feedback circuits. It's normally used open loop to give a digital (2-state) output signal.

If you connect the LM339 output to the 4013BE clock input, it should trigger the FF if you configure the LM330 to generate a clean pulse (typically this requires the addition of some positive feedback to provide hysteresis and prevent oscillations at the trip point). Also the LM339 output resistor should connect to the 4013BE power.
 

Thread Starter

hellohellosharp

Joined Apr 19, 2011
27


Here is a diagram of my Comparator circuit. When I shine light on the photoresistor, the LED turns on.

So instead of the LED turning on, I need to simulate a clock pulse to my D Flip Flop.
 

MrChips

Joined Oct 2, 2009
30,824
Yes.

Put a resistor (270Ω to 470Ω) in series with all your LEDs.
Eventually, you should connect all unused inputs to GND.
 

Thread Starter

hellohellosharp

Joined Apr 19, 2011
27
I tried this...the 2nd LED (connected to the D Flip Flop) instantly turned on. Unfortunately though, shining light on the photoresistor or putting it in darkness does not change the state of the LED or D Flip-Flop.

New diagram just to be sure I got your right:

 

Thread Starter

hellohellosharp

Joined Apr 19, 2011
27
That kind of worked :) Thanks!

The LED turns off when I flash a light on the photoresistor, and turns back off with another flash of light...

The problem is that its a bit unstable. Sometimes it needs three or four flashes of light to turn the LED on and vice versa. Is there anything I can do it make it more stable?

Thanks again for your help :)
 

Audioguru

Joined Dec 20, 2007
11,248
The LED turns off when I flash a light on the photoresistor, and turns back off with another flash of light...

The problem is that its a bit unstable. Sometimes it needs three or four flashes of light to turn the LED on and vice versa. Is there anything I can do it make it more stable?)
Where is your schematic?? Maybe its voltage thresholds are wrong.
Am LM339 can switch many times very quickly. Maybe the switch on your flashlight is dirty and it turns on and off many times when it is turned on (but it switches so quickly that you cannot see it switching).

Your flashlight needs a "debounce circuit" or the comparator circuit must be slowed down.
 

JohnInTX

Joined Jun 26, 2012
4,787
With the changes suggested by Mr Chips, add something like 330K between pin 2 (output) and 5 (+input) of the 339 to add hysteresis i.e. slightly different on and off voltages. Without it, the 339 will likely oscillate during switching making many clocks as it does.

Smaller values of the R will increase hysteresis making it less likely to oscillate. Too small and it will switch and stay that way. Find a good value in between. The LM397 datasheet has a section on hysteresis that would apply to the 339 as well.
 
Last edited:

Thread Starter

hellohellosharp

Joined Apr 19, 2011
27
Thanks a bunch bro :) I added a high resistor and it seems much more stable!

Thanks to everyone who has helped so far!

A video of my completed circuit.

I still want to add what Audioguru was talking about though with the debounce.

Would like to personally thank Austin Clark, Mr. Chips,JohnInTX and Audioguru for their contributions.
 
Last edited:

Audioguru

Joined Dec 20, 2007
11,248
The link to your video does not open. EDIT: It took a long time to open. It shows extremely dangerous wiring.
Where is your schematic?
 

Audioguru

Joined Dec 20, 2007
11,248
Your relay coil is an inductor that generates a very high voltage when it turns off. A diode is needed parallel with its coil to dump the high voltage into the power supply.

Hee, hee. Hold the relay coil terminals in ONE hand. Power the coil from a 9V battery then while still holding the coil terminals, disconnect the battery. ZAP!
The diode parallel to the coil protects the transistor or your hand from being zapped by a high voltage.

Your relay has no spec's and no part number so we don't know its coil voltage and current.

The transistor needs a resistor in series with its base that is determined by the unknown relay current.

The +7.5V supply needs a bypass capacitor to ground of 10uF to 100uF.

I didn't look at the CD4013 IC.
 

Thread Starter

hellohellosharp

Joined Apr 19, 2011
27
Thanks for your reply. Which way should the diode face...?

I am not sure what relay it is at its part of a board I am using right now.

I also have a mini one that I will be switching over to soon. it's a blue mini-relay from Radioshack by Tyco Electronics....I can't find the part # or anything though.

What would the capacitor do?

Sorry for the nooby questions.
 
Top