Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

opamp or comparator

Status
Not open for further replies.

aruna1

Member
hello guys I'm working on a line follower robot and i built following circuit as line sensor.
circuit

it uses LM324 opamp as a comparator and RED LED as a sensor.
Circuit does what is built to do-identifying difference between black-white surface but it still has little problem.if i touch the circuit while its working it changes its readings.-its like op amp responds to static charge(or something like that) in my body.

So i was thinking if I replace LM324 opamp with LM339 comparator IC will this help to solve the problem?

replace

and is there any quad comparator IC with same pinout as LM324? (LM339 has different pinout so i will have to built circuit all again :( )

thank you
 

Attachments

  • line sensor.pdf
    75.8 KB · Views: 476
  • line sensor-comparator.pdf
    76.2 KB · Views: 316
Last edited:
Here's an idea; don't touch it. Electronics don't like to be touched while operating. Changing to a comparator won't help.
 
The biggest problem stems from the way you are using the LED as a light detector. As drawn, the current that flows through the LED is the LM324's input bias current, which happens to flow out of the input on an LM324. (Bias current flows into the inputs of most other opamps). The forward drop of the LED is modulated by how much light falls on it, creating an extremely high-impedance node on the inverting input of the opamp. This will be extremely sensitive to capacitive-coupled AC signals such as from the AC power line, which will be rectified by the LED and contaminate the signal that comes from the LED illumination. To correct this, put a resistor from the inverting input to the positive supply rail. You will have to experiment with the value; make the circuit less sensitive, but still respond to the illumination change...

Using a comparator vs the opamp wont make any difference. The problems you are having is that you are using both open-loop, and the circuit is sensitive to uV of noise induced into either input causing the output to switch back and forth.

You need to add a slight amount of positive feedback to create hysteresis. Connect a several megOhm resistor from the opamp/comparator output pin to the non-inverting input. This will add enough positive feedback to prevent the continuous switching between the two states.

Putting a 10uF or so low-inductance bypass cap across the supply pins of the 324 or 339 might help.
 
I'm kind a getting tired of this circuit.because in this semester I have lot of acedemic work.so do you think i should forget LEDs and go for LDR? (or IR tx rx pair)
i was thinking that LDR and photodiode gives large difference for evan small light so it will greatly affected by ambient light than using a LED as sensor
thanks
 
As drawn, the current that flows through the LED is the LM324's input bias current, which happens to flow out of the input on an LM324.
The Rx LED1 (photodiode?) is being used in photovoltaic mode, in which it generates a small current from light. If this current is fed to an (almost) open circuit like the LM324 input, the high impedance makes it really sensitive to interference.

If you place a resistor of 470 kohm across the photodiode, the LM324 bias current will no longer be a factor, the impedance will be lower. It will still react to being touched; the circuit simply has no safeguard against that.

(If 470k ohm kills the circuit, try 2.2 Meg.)

[edit]The LM339 circuit would need the same resistor, since its bias current is similar. But note that the LM339 is open collector. It cannot drive the indicator LED unless it is connected between the output and V+.[/edit]
 
Last edited:
i also bulit a line follower robot, i used lm324 only its act as a good comparator.
can u plz tell me which type of paint or material to use make a line path?
 

Attachments

  • This is the basic circuit.doc
    28.5 KB · Views: 245
i also bulit a line follower robot, i used lm324 only its act as a good comparator.
can u plz tell me which type of paint or material to use make a line path?

it can detect difference between two rough materials i guess,but should work with almost all materials.all it needs is fine tuning
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top