Circuit with op amp lm339 - Page 1
Forum section: electronics / beginners

author: nForce
author_rank: Frequent Contributor
timestamp: December 25, 2015, 10:31:14 pm
content: Hello, i have buildthis simple circuiton a breadboard to learn electronics.But when I connect power supply, the led turns on. I thought that the led will turn on only when I apply a magnetic field to the coil. How do I achieve that?Because now the op amp works as a comparator, and when I apply the magnetic field it induces a current on both sides of a coil, but it should do just on one of the terminals to connect the gnd to power supply. And then led should turn on. (Theoreticaly)Can someone analyze the circuit and describe, what is actually happening here? Thank you.

author: Zero999
author_rank: Super Contributor
timestamp: December 25, 2015, 10:45:29 pm
content: Yes, that's what you should expect to happen. The op-amp's bias current will flow out of both the inverting and non-inverting inputs. The voltage at the inverting input will be slightly higher than the non-inverting input because the resistance of the coil will mean it develops a voltage across it.When a magnet is moved across the coil then LED may flicker off if the coil generates a negative voltage for long enough.

author: Seekonk
author_rank: Super Contributor
timestamp: December 25, 2015, 10:58:56 pm
content: You could bias the negative input slightly, a few milivolts, to insure the op amp does not turn on until a signal is present. That circuit is not guaranteed to work with every chip.

author: Yansi
author_rank: Super Contributor
timestamp: December 25, 2015, 11:27:11 pm
content: LM339 is not opamp. It is a comparator. And beware od the pinout.

author: nForce
author_rank: Frequent Contributor
timestamp: December 26, 2015, 02:09:38 pm
content: How do you know, that when I move a magnet across the coil, it generates anegativevoltage?How can I make with only these components the other way around? So that when I move a magnet across the coil it will light up the led.

author: Zero999
author_rank: Super Contributor
timestamp: December 26, 2015, 04:19:27 pm
content: Moving a magnet across the coil will produce both a negative any a positive voltage, depending on the field and direction of movement.Have you measured the voltage on the coil using an oscilloscope?

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 26, 2015, 07:52:37 pm
content: I can confirm that the circuit does work, using one of the opamps in a TL082. The LED is off, until I move a magnet rapidly past a coil taken from a small relay. Then the LED flashes briefly -- as it should, since the circuit isn't a "magnetic field detector" but rather a "change in magnetic field detector". See Faraday's Law of Induction. The voltage induced in a coil is proportional to the _time rate of change_ of the magnetic flux applied to the coil.I don't know why nForce's LED is on all the time.A ratiometric Hall effect sensor (Allegro A3503) makes a much better "magnetic field detector" than the relay coil does, though.

author: nForce
author_rank: Frequent Contributor
timestamp: December 26, 2015, 08:17:20 pm
content: That's strange, there are two different explanations of how the circuit works. And it's a simple circuit.My theory is this:The output of the op amp (someone called it a comparator) is switching between a GND and 9 V. Because those two voltages (0V and 9V) are on the supply terminals of the op amp. If there is 9 V on the output, there is no potential difference between the terminals and no current will run. If there is GND, there is a potential difference and the current will run, lightning up the LED. But there is something odd, why doesn't the LED burn out, because there is 9V? Maybe that 1K ohm resistors helps.Well this is how I understand working of this circuit. Can someone with a lot of practice confirm it?@Hero999 Sorry i don't have an oscilloscope, because i don't have the money for buying one. I have bought these electric components for $10.

author: Seekonk
author_rank: Super Contributor
timestamp: December 26, 2015, 10:43:13 pm
content: It is a hobby circuit designed to teach you not to trust what you see on the internet. The 339 has up to 3mv of offset on the input. Shorting the inputs to common the output is undefined. You should always have several mv designed into the circuit to define the output to a certain state. The input is not protected. Spec says not to let input drop below -.3V. Get near a good magnetic field and the chip may self destruct. Good luck.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 26, 2015, 11:19:50 pm
content: The inputs are not exactly shorted to ground... well, one is, but the other one is on the other end of the relay coil. The relay coil I used for testing my version has about 50 ohms DC resistance.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 27, 2015, 12:22:01 am
content: May I suggest this slightly modified circuit?I don't know if it will work with the lm339 but it's a lot of fun with the TL082. It will detect the motion of a magnet, moving quite slowly, from several inches away.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 27, 2015, 01:02:20 am
content: Quote from: nForce on December 26, 2015, 08:17:20 pmYes, the op-amp is being used as a comparator in this circuit. The output changes state from HI to LO depending on which of the inputs has the higher voltage.What you have said here is correct. Say the LED's forward voltage drop is 2.2 V. So to calculate the current through the LED and the 1000 ohm resistor with a 9V supply, you use Ohm's Law. V=IR, so I=V/R.(9-2.2) = 6.8 V , and 6.8 V / 1000 Ohms = 6.8 mA, which is fine for a modern, bright LED.Homework question: Say you want 20 mA through the LED. What should the value of the resistor be in that case?

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 27, 2015, 01:36:10 am
content: Oscilloscope trace (single-shot) obtained by sweeping one pole of a NdBFe magnet rapidly past the end of the 50 ohm miniature relay coil. If I use the other pole of the magnet, the trace is reversed (first peak positive, second peak negative.) If I go faster the voltages are greater. Faraday's Law of Induction in action!

author: Zero999
author_rank: Super Contributor
timestamp: December 27, 2015, 11:13:13 am
content: Quote from: nForce on December 26, 2015, 08:17:20 pmNo, only one explanation for how the circuit works has been given. I only provided a possible reason for the circuit not working.Quote from: Seekonk on December 26, 2015, 10:43:13 pmYes, unless the resistance of the coil is very high, the input offset voltage will dominate the bias current.The circuit should work with the LM339, with a couple of modifications. Connect a 470k resistor between the non-inverting input to raise the input voltage a few mV above 0V. The bias current will develop a voltage across the resistor which should be greater than the offset voltage, thus ensuring the non-inverting input high enough above the inverting input to cause the output to go high and the LED turn off. Adding diode in reverse parallel with the coil will provide some protection against negative voltages.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 27, 2015, 04:26:16 pm
content: Two points: The circuit above is still not a "magnetic field detector", it is a _change_ in magnetic field detector. If the applied field isn't changing, there is no voltage induced in the coil and the circuit just sits there doing nothing.And the circuit (on my breadboard using 1/2 TL082 and a 50 ohm miniature relay coil) still isn't very sensitive. It still requires very fast magnet motion very near to the coil for the LED to flash briefly.Try this variant. It has much improved sensitivity, will detect fast magnet motion from several inches away and slow magnet motion from an inch or so by turning the LED on for as long as it detects the magnet is moving.I don't know if it will work the same way with the LM339 (using the correct pin numbers for that op-amp of course), I don't have one on hand to test. It doesn't work very well with the LM358n, it probably needs the high-impedance inputs provided by the TL082.

author: Seekonk
author_rank: Super Contributor
timestamp: December 27, 2015, 04:58:17 pm
content: YIPES!

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 27, 2015, 05:36:51 pm
content: Quote from: Seekonk on December 27, 2015, 04:58:17 pmChange the feedback resistor R2 to 47k for even greater sensitivity.(I've made this change on the circuit diagram and reposted it above.)A 0.1 uF cap in parallel with the feedback resistor may be needed if the circuit oscillates.

author: Seekonk
author_rank: Super Contributor
timestamp: December 27, 2015, 05:50:11 pm
content: Capacitors. Let's add some capacitors.I don't need to build one of these. I have a GHOST METER that I picked up. Photo is unretouched, you can find these on ebay. It flashes and beeps. This won't do anything around my equipment or TV but there is a place in the middle of the living room that it goes crazy, oooooooooh scary. GHOST METER, Don't stay home without it!

author: Zero999
author_rank: Super Contributor
timestamp: December 27, 2015, 05:54:16 pm
content: Quote from: Seekonk on December 27, 2015, 05:50:11 pmLol, how about doing a teardown?

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 27, 2015, 05:59:47 pm
content: The scale should read "milliGHOSTS" instead of milliGauss.....

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 27, 2015, 06:41:59 pm
content: Quote from: Seekonk on December 27, 2015, 05:50:11 pmOK.... how about this then. Eliminate the feedback resistor altogether and replace it with a 200 nF monolithic ceramic cap (I used 2 ea. 100nF in parallel). Now the circuit has _crazy_ sensitivity. It will detect the motion of a weak magnet moving slowly, several inches away, and a strong magnet at six inches or more.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 27, 2015, 09:43:43 pm
content: Some one asked a few days ago about simple circuits for scoping. This is one such. The circuit has a tendency to self-oscillate, which makes the LED look like it's "ON" continuously, but really it is turning on and off very rapidly. (This is why the OP's LED appeared to be continuously ON, probably: the op-amp was probably oscillating and making the LED look like it was continually lit. Maybe.) This effect can be seen with the scope, which can tell you whether the LED is in fact solidly ON, or is oscillating rapidly, and so helps you to find the right place to install capacitors to kill the oscillations.

author: edavid
author_rank: Super Contributor
timestamp: December 27, 2015, 09:54:37 pm
content: Quote from: alsetalokin4017 on December 27, 2015, 01:02:20 amIf it's an LM339, it's actually a comparator being used as a comparator

author: Seekonk
author_rank: Super Contributor
timestamp: December 27, 2015, 10:55:09 pm
content: When I was a kid I made the amplifier section of a radio cluck like a chicken. I probablycouldn't do that now if I tried. So there is something to be said about experimenting andconnecting parts up randomly.The following circuit provides about 3 mv (matching that of the maximum offset of the 339)of bias assuming a 50 ohm coil. This should guarantee a solid off or on state of the LED.Input connections depend it you want it off or on. This should prevent oscillations. Anadded advantage is that it offsets the inputs at half the supply voltage. That shouldprovide sufficient protection for input spikes.Biasing the input will make it stable. However, you never know which way the offest ofthe op amp input is. That could require up to 6 mv of signal before the comparator trips.Placing the coil in a resistor H configuration with a 10K pot in the upper or lower feedia an option. Then it could be adjusted to the edge of tripping with just 1 mv of offset.

author: nForce
author_rank: Frequent Contributor
timestamp: December 28, 2015, 11:37:39 am
content: Quote from: Hero999 on December 27, 2015, 11:13:13 amHow did you calculate the resistor value? So it has to be 470k?

author: Seekonk
author_rank: Super Contributor
timestamp: December 28, 2015, 02:40:30 pm
content: 25nA input current X 470,000 to get at least 3mv, though it appears to be three times the resistance needed unless I missed a decimal place.

author: Zero999
author_rank: Super Contributor
timestamp: December 28, 2015, 02:51:24 pm
content: Quote from: Seekonk on December 28, 2015, 02:40:30 pmYes and choosing thee times the resistance needed was deliberate, as the bias current could be much lower than specified on the datasheet, which just gives the typical and highest values, not the lowest.

author: Yansi
author_rank: Super Contributor
timestamp: December 28, 2015, 05:21:13 pm
content: Quote from: nForce on December 26, 2015, 08:17:20 pmSorry to bother you again, that is not "someone called it", LM339 actually is a comparator, cannot be used as a general purpose opamp! You cannot interchange the two. Not the same!Another piece you should know (and was mentioned in the beginning) is that some type of input circuitry (usualy with PNP stages) allows operation below ground level. Usually up to some hundred mV. Typical OPAMPies and COMPies like that are LM358, LM324, LM393, LM339, ... In the datasheet search for a term of "input commonmode voltage range" and that shout "include ground" if operation like that is required.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 28, 2015, 07:06:28 pm
content: OK... so I went out to my local supplier and bought an LM339. For a dollar ... what a ripoff, could have ordered 10 for $3.50, free shipping from Colorado, but I didn't want to wait 3 or 4 days for them to get here.I breadboarded Hero999's version and it works fine ... but it does have a tendency to oscillate, which keeps the LED "on" (really, it's flashing on and off so fast it looks continuously on.) I cured this self-oscillation by putting 0.1 uF ceramic caps from pins 6 and 7 to Ground. Now the LED stays nicely off until I move a magnet past the coil.The circuit is more sensitive than I expected (using the same ~50 ohm miniature relay coil) but nowhere nearly as sensitive as the TL082 version that I posted and demonstrated in the video above.

author: Zero999
author_rank: Super Contributor
timestamp: December 28, 2015, 07:30:26 pm
content: Quote from: Yansi on December 28, 2015, 05:21:13 pmYes, it's important to be aware of the internal workings of the op-amp/comparator when dealing with a circuit like this. Looking at the input stage it's clear the bias current is positive, i.e. the inputs source current.It's also interesting you mention the distinction between op-amps and comparators. It's possible to get an LM339 to work as an op-amp but it's not ideal. The datasheet even shows an example of a VCO which uses one of the comparators as an op-amp to form an integrator.http://www.ti.com/lit/ds/symlink/lm339-n.pdfQuote from: alsetalokin4017 on December 28, 2015, 07:06:28 pmWow that's expensive!You could've easily used the LM393 which will probably be cheaper as it only contains two comparators.

author: nForce
author_rank: Frequent Contributor
timestamp: December 28, 2015, 07:51:07 pm
content: Quote from: Seekonk on December 28, 2015, 02:40:30 pmThis is maybe a beginners question, but: From where does thisinputbias current come from? There is no negative loop, no positive loop and no current or voltage source. Only the coil.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 28, 2015, 07:59:48 pm
content: @Hero999:Looking through my parts stash, I found a LM393 in there, a used pull! So I'll give it a try next.But what's worse.... I found 2 brand new LM339s that I didn't know I had, not on the inventory list. SO I didn't need to go out and spend any money, either way.

author: Zero999
author_rank: Super Contributor
timestamp: December 28, 2015, 08:49:57 pm
content: Quote from: nForce on December 28, 2015, 07:51:07 pmIt comes from the base of Q1 & Q4, shown in the schematic attached to my previous post.

author: nForce
author_rank: Frequent Contributor
timestamp: December 28, 2015, 09:15:33 pm
content: So if I understand correctly, the input bias current runs from non-inverting and inverting inputout. So away from the inputs, notinthe comparator.

author: SeanB
author_rank: Super Contributor
timestamp: December 29, 2015, 07:23:30 am
content: PNP transistors source a current to ground, NPN transistors sink a current to ground. Input of comparator internally uses PNP transistors in the first differential pair.

author: Zero999
author_rank: Super Contributor
timestamp: December 29, 2015, 10:27:46 am
content: Quote from: nForce on December 28, 2015, 09:15:33 pmYes, it's because, in order to switch on a PNP transistor, a current needs to flow out of the base.In op-amps/comparators with an NPN stage, such as the uA741 and NE5532, the bias currents will flow into the inputs.741 schematichttp://www.sentex.ca/~mec1995/gadgets/741/741.htmlNote that this isn't always the case. In some op-amps, such as the OP07 and OP37, an NPN input stage is used and bias compensation circuitry is added to try to reduce the bias current to zero but it isn't perfect so the inputs may either source or sink a tiny current.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 29, 2015, 05:03:19 pm
content: And then of course there are op-amps that use FET input stages, like the TL08x series ....

author: Zero999
author_rank: Super Contributor
timestamp: December 29, 2015, 08:54:25 pm
content: Quote from: alsetalokin4017 on December 29, 2015, 05:03:19 pmWhich have tiny bias current, until the input voltages is taken too near the negative rail, then the gates on the input transistors become forward biased, phase reversal occurs and a the bias current shoots up.

author: nForce
author_rank: Frequent Contributor
timestamp: December 29, 2015, 10:48:11 pm
content: Quote from: alsetalokin4017 on December 28, 2015, 07:06:28 pmCan you attach a schematic of this final circuit that you build. How are capacitors helping with oscillation problem?Thank you.

author: Seekonk
author_rank: Super Contributor
timestamp: December 29, 2015, 11:14:35 pm
content: YOUR RESULTS MAY VARYOperation of this circuit are based solely on the operation of a comparator. The trip point of the comparator is totally uncontrolled due to variations in input current and offset voltage. No effort has been made to adjust for variations from chip to chip. Build five and you could easily get five different results. I haven't seen anything which constituted a design.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 30, 2015, 12:20:13 am
content: Quote from: nForce on December 29, 2015, 10:48:11 pmWhich "final circuit"? The LM339 and LM393 versions are Hero999's circuit shown in Reply #13 which is a modification of the original circuit you linked in the original post. I added 100nF capacitors from Pins 6 and 7 to ground, which stopped the oscillations for me. "MY" extremely sensitive version using the TL082 is shown at the end of the demonstration video I posted, and on the previous page (Reply # 20).The capacitors in the 339/393 versions work to kill the oscillations by bypassing AC noise/oscillation to ground so it doesn't affect the inputs. In my TL082 version the 200 nF capacitor is feeding back oscillations from the output to the inverting input in a negative feedback loop which tends to cancel them out. I think.@Seekonk: There may not be "anything which constitutes a design"... but I've built, and demonstrated, examples that work quite well nevertheless. I also determined the likely reason the OP's LED was staying on: the circuit was oscillating. I did this by applying my _practical knowledge_ and using an oscilloscope to confirm my educated guess, and I also applied this knowledge to fix that problem. Designs are nice, but they are only designs, until someone puts them into practice and shakes out the bugs.

author: nForce
author_rank: Frequent Contributor
timestamp: December 30, 2015, 11:17:54 am
content: The final circuit with LM339.So, the capacitors help reduce AC oscillations. Can you describe more detailed?

author: Seekonk
author_rank: Super Contributor
timestamp: December 30, 2015, 02:24:33 pm
content: The following schematic is one of many possible solutions. It reduces some of the problemsof input offset and bias current variations between chips. The first stage provides a smallgain for AC signals and no gain for the offset voltage. This reduces the effect of offsetuncertainty. Raising the input voltage to half of supply reduces the chance of IV damagedue to spikes and solves the problem of op amps that inputs are not rail to rail.The second stage has two comparators and detects positive and negative signals. Adjustingthe 1K pot changes the trip plus minus points from about 7 to 50 mv. High frequency roll offcan be achieved by placing a small cap across RG. A pair of diodes can be used to OR theoutputs if an op amp is used instead of a 339. Inputs are not designated. If it doesn'tjump out right away it is time to view one of Dave's op amp videos. You should learn somethingby building.

author: nForce
author_rank: Frequent Contributor
timestamp: December 30, 2015, 10:48:07 pm
content: @alsetalokin4017Can you attach the latest schematic of lm339 circuit with capacitors. I would like to know how does capacitors reduce AC oscillations.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 31, 2015, 05:40:03 am
content: @Seekonk:Can't you add a bit more complexity so that all 4 comparators in the 339 are used for something?@nForce:Here you go.

author: nForce
author_rank: Frequent Contributor
timestamp: December 31, 2015, 11:55:47 am
content: @alsetalokin4017Why did you choose 1n4148 diode? Isn't this diode for high power electronics? 1 A of a current.Can I replace that with some other diode for smaller current?

author: Audioguru
author_rank: Super Contributor
timestamp: December 31, 2015, 03:03:21 pm
content: Quote from: nForce on December 31, 2015, 11:55:47 amYou should read the datasheet for a 1N4148 low current silicon diode:1) Its maximum continuous DC current is 300mA.2) Its max peak current for 1 second is 1A.3) Its max peak surge current for 1 micro-second is 4A.5) Its datasheet shows a graph of its typical forward voltage at currents as low as 1uA.6) its reverse leakage current is very low.

author: nForce
author_rank: Frequent Contributor
timestamp: December 31, 2015, 05:54:52 pm
content: Oh, sorry my local supplier has a wrong picture. It's a small signal diode.@alsetalokin4017, Hero999Which program are you using for modifying and adding components on the schematics? These modified schematics look original.

author: Zero999
author_rank: Super Contributor
timestamp: December 31, 2015, 07:41:38 pm
content: I just use MS Paint and cut and paste the original symbols.

author: Seekonk
author_rank: Super Contributor
timestamp: December 31, 2015, 09:18:20 pm
content: I like that look, like it is copied out of an old manual.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: December 31, 2015, 11:28:07 pm
content: Quote from: Hero999 on December 31, 2015, 07:41:38 pmDitto, 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.

author: nForce
author_rank: Frequent Contributor
timestamp: January 04, 2016, 05:36:52 pm
content: 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?

author: nForce
author_rank: Frequent Contributor
timestamp: January 04, 2016, 06:17:48 pm
content: 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?

author: alsetalokin4017
author_rank: Super Contributor
timestamp: January 04, 2016, 08:19:54 pm
content: 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 saysQuoteIf 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.

author: nForce
author_rank: Frequent Contributor
timestamp: January 05, 2016, 06:15:40 pm
content: 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.

author: Seekonk
author_rank: Super Contributor
timestamp: January 05, 2016, 06:25:27 pm
content: 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.

author: nForce
author_rank: Frequent Contributor
timestamp: January 05, 2016, 06:55:32 pm
content: Is there any particular reason why the author choosed the comparator? Do you maybe know?

author: alsetalokin4017
author_rank: Super Contributor
timestamp: January 05, 2016, 07:15:15 pm
content: Quote from: nForce on January 05, 2016, 06:15:40 pmDidn'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.

author: nForce
author_rank: Frequent Contributor
timestamp: January 05, 2016, 08:00:15 pm
content: 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.

author: Zero999
author_rank: Super Contributor
timestamp: January 08, 2016, 08:52:53 pm
content: 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.Quote from: nForce on January 05, 2016, 08:00:15 pmNo 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.pdfThe 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.

author: nForce
author_rank: Frequent Contributor
timestamp: January 11, 2016, 08:48:22 pm
content: @Hero999When 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?

author: Zero999
author_rank: Super Contributor
timestamp: January 11, 2016, 11:15:41 pm
content: The electric current flows out of the input pin (conventional flow) through the 470k resistor which causes a voltage to be developed across it.

author: nForce
author_rank: Frequent Contributor
timestamp: January 12, 2016, 09:57:00 am
content: 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.

author: nForce
author_rank: Frequent Contributor
timestamp: January 13, 2016, 10:56:35 am
content: So no one knows, what happens with electrons in a wire?

author: Zero999
author_rank: Super Contributor
timestamp: January 13, 2016, 11:41:30 am
content: https://en.wikipedia.org/wiki/Electrical_resistance_and_conductance

author: nForce
author_rank: Frequent Contributor
timestamp: January 13, 2016, 04:40:34 pm
content: So, my explaination is correct. Electrons slow down, and because of that we have an increase of voltage.