Author Topic: Circuit with op amp lm339  (Read 28239 times)

0 Members and 1 Guest are viewing this topic.

Offline alsetalokin4017

  • Super Contributor
  • ***
  • Posts: 2055
  • Country: us
Re: Circuit with op amp lm339
« Reply #50 on: December 31, 2015, 11:28:07 pm »
I just use MS Paint and cut and paste the original symbols.

Ditto, but I use mtPaint on Linux. Same difference.

The 1n4148 or 1n914 type diode is very cheap, and is very common in small signal applications where you don't need the very low Vf of a Schottky diode. I get them for 15 cents each, and that's pretty expensive. If you want to wait for delivery, you can get them for a penny apiece in lots of 100 from China. Free shipping too.

But you could probably use many other diodes in this application.
« Last Edit: December 31, 2015, 11:36:15 pm by alsetalokin4017 »
The easiest person to fool is yourself. -- Richard Feynman
 

Offline nForceTopic starter

  • Frequent Contributor
  • **
  • Posts: 393
  • Country: ee
Re: Circuit with op amp lm339
« Reply #51 on: January 04, 2016, 05:36:52 pm »
Ok, now I am confused.

I have made the @Hero999 version of the "magnetic field detector". (I don't need smoothing capacitors).

Now the LED is always on (like before), but when I get closer with the magnet, the LED turns off. Ok then.

But here is another thing, when I don't move the magnet (so it get's stuck on the coil)  the magnet is present, but not moving the LED is off.

How is that? I thought it would be a sensor for sensing CHANGE in a magnetic field. Now it works for just the presence of a magnetic field.


Can someone please explain to me how does this work?
 

Offline nForceTopic starter

  • Frequent Contributor
  • **
  • Posts: 393
  • Country: ee
Re: Circuit with op amp lm339
« Reply #52 on: January 04, 2016, 06:17:48 pm »
OK, now it works for changing the magnetic field. But still is off when the magnet is stuck on the coil.

And the LED is always on, but the brightness is much dimmer as it would be if I just connect to the positive. Why is that? Because there is always a small current? Because the comparator is not perfect?
 

Offline alsetalokin4017

  • Super Contributor
  • ***
  • Posts: 2055
  • Country: us
Re: Circuit with op amp lm339
« Reply #53 on: January 04, 2016, 08:19:54 pm »
From your description it sounds to me like your circuit is still oscillating somewhat. Look at my modification of Hero999's modification of your schematic and put the capacitors in. If it still oscillates try increasing the value of the capacitors from 100 nF to 200 nF. See the quote from the Data Sheet below.

The circuit does not work for the _presence_ of a magnetic field. The mere presence of a constant magnetic field does not induce any voltage in a coil. The field must be _changing_ for a voltage to be induced. See Faraday's Law of Induction. The circuit responds to induced voltage in the coil, so if the field is not changing there is nothing to respond to. If the LED is on fully or dimly, then there is either enough changing magnetic field to induce voltage in the coil, or the circuit is oscillating, or both. When the magnet is stuck to the coil, it is possible that this changes the tendency of the circuit to oscillate, so the LED goes out.

One solution to oscillation is to add capacitors. You should have a local decoupling capacitor of 100 nF or so as near as possible to the chip, across the chip's Vcc and Vss (supply and ground) pins 3 and 12, and also have capacitors from the input pins 6 and 7 to ground. (See the quote from the Data Sheet below.)
Wiring should be direct and short and your breadboard should be in good condition.

Also, if you are still using the LM339 quad comparator, the 3 unused comparators in the chip can cause oscillations if they are left floating (no input or output). The Data Sheet for the TI LM339 says
Quote
The LM139 series are high gain, wide bandwidth devices which, like most comparators, can easily oscillate if the
output lead is inadvertently allowed to capacitively couple to the inputs via stray capacitance. This shows up only
during the output voltage transition intervals as the comparator changes states. Power supply bypassing is not
required to solve this problem. Standard PC board layout is helpful as it reduces stray input-output coupling.
Reducing this input resistors to < 10 k? reduces the feedback signal levels and finally, adding even a small
amount (1 to 10 mV) of positive feedback (hysteresis) causes such a rapid transition that oscillations due to stray
feedback are not possible. Simply socketing the IC and attaching resistors to the pins will cause input-output
oscillations during the small transition intervals unless hysteresis is used. If the input signal is a pulse waveform,
with relatively fast rise and fall times, hysteresis is not required.

All pins of any unused comparators should be tied to the negative supply.


If you have an oscilloscope you should be able to see if oscillations are keeping your LED glowing.


ETA: I just tested the circuit with LM339. It oscillated, keeping the LED on as you describe.  Without using any capacitors, simply tying all remaining pins of the 3 unused comparators (2, 4, 5, 8, 9, 10, 11, 13, 14) to Ground killed all my oscillations and now the circuit works as you probably expect it to.
« Last Edit: January 04, 2016, 08:52:03 pm by alsetalokin4017 »
The easiest person to fool is yourself. -- Richard Feynman
 

Offline nForceTopic starter

  • Frequent Contributor
  • **
  • Posts: 393
  • Country: ee
Re: Circuit with op amp lm339
« Reply #54 on: January 05, 2016, 06:15:40 pm »
Thank you.

I have one question, can I make the same circuit with an op amp let's say lm741? Instead of using a comparator.

Because the original author of the circuit choosed the comparator.
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Circuit with op amp lm339
« Reply #55 on: January 05, 2016, 06:25:27 pm »
Yes but likely the inputs must be raised above ground.  Use one resistor to common aqnd another to power as I indicated in a previous example.
 

Offline nForceTopic starter

  • Frequent Contributor
  • **
  • Posts: 393
  • Country: ee
Re: Circuit with op amp lm339
« Reply #56 on: January 05, 2016, 06:55:32 pm »
Is there any particular reason why the author choosed the comparator? Do you maybe know?
 

Offline alsetalokin4017

  • Super Contributor
  • ***
  • Posts: 2055
  • Country: us
Re: Circuit with op amp lm339
« Reply #57 on: January 05, 2016, 07:15:15 pm »
Thank you.

I have one question, can I make the same circuit with an op amp let's say lm741? Instead of using a comparator.

Because the original author of the circuit choosed the comparator.

Didn't you see my version with TL082? And the video demonstration I did of it? It is a lot more sensitive than the comparator version.
The easiest person to fool is yourself. -- Richard Feynman
 

Offline nForceTopic starter

  • Frequent Contributor
  • **
  • Posts: 393
  • Country: ee
Re: Circuit with op amp lm339
« Reply #58 on: January 05, 2016, 08:00:15 pm »
oh sorry, I thought it was a comparator.

So op amps can be used as a comparator or amplifier but, it isn't true the other way around.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: Circuit with op amp lm339
« Reply #59 on: January 08, 2016, 08:52:53 pm »
The circuit I posted was designed for the LM339 which has PNP input transistors which sources bias current. The LM741 has NPN input transistors so sinks bias current. The inputs on the LM741 also do not work down to the negative rail.

oh sorry, I thought it was a comparator.

So op amps can be used as a comparator or amplifier but, it isn't true the other way around.
No quite. Generally op-amps shouldn't be used as comparators. Some can behave unpredictably when the difference between their inputs exceeds a certain threshold or the output saturates.

Using an op-amp as a comparator is a bodge and should only be done caution and when there's a spare op-amp in a package to save space and cost. If you have a choice, don't do it!

It's also not true that comparators can't be used as op-amps. In reality, many comparator ICs (not all though) can be used as op-amps but care needs to be taken to prevent oscillation and filter out any such oscillation from the output. The LM339 even has an example of one of the comparators being used as an op-amp integrator on the datasheet.

http://www.ti.com/lit/ds/symlink/lm339-n.pdf

The comparators which should not and cannot be used as op-amps are those with built-in hysteresis (these will oscillate with no chance of becoming stable) and the ones with a CMOS output which will draw excessive current when both the transistors in the output stage are turned on.
 

Offline nForceTopic starter

  • Frequent Contributor
  • **
  • Posts: 393
  • Country: ee
Re: Circuit with op amp lm339
« Reply #60 on: January 11, 2016, 08:48:22 pm »
@Hero999

When you calculated the resistor value for increasing voltage on the pin of the comparator, you have used Ohm's law.

But how can I imagine with intuition, why the voltage has been increased. Does the electrons slow down and start accumulating at the pin. So that's why voltage has been increased?
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: Circuit with op amp lm339
« Reply #61 on: January 11, 2016, 11:15:41 pm »
The electric current flows out of the input pin (conventional flow) through the 470k resistor which causes a voltage to be developed across it.
 

Offline nForceTopic starter

  • Frequent Contributor
  • **
  • Posts: 393
  • Country: ee
Re: Circuit with op amp lm339
« Reply #62 on: January 12, 2016, 09:57:00 am »
Yes, i know. But what happens from electrons perspective? They slow down, and start bumping each other? So that the voltage increases.

Here it's one resistor and the voltages increases, if we use two resistors in series it's a voltage divider. In this case it decreases.
 

Offline nForceTopic starter

  • Frequent Contributor
  • **
  • Posts: 393
  • Country: ee
Re: Circuit with op amp lm339
« Reply #63 on: January 13, 2016, 10:56:35 am »
So no one knows, what happens with electrons in a wire?
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
 

Offline nForceTopic starter

  • Frequent Contributor
  • **
  • Posts: 393
  • Country: ee
Re: Circuit with op amp lm339
« Reply #65 on: January 13, 2016, 04:40:34 pm »
So, my explaination is correct. Electrons slow down, and because of that we have an increase of voltage.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf