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.

LM324N IR black and white line detector

Status
Not open for further replies.

ApacheTB

New Member
Good day everybody,

Im currently building a set of line detection sensors using infrared sensors and a comparators which output are connected to a PIC microcontroller for a line following robot. The figure below is a schematic I found online which uses a LM358 OP AMP, however I thought of using 2 LM324N OP AMPs instead of 3 LM358 as its more cost effective.
IR-Sensor-Circuit.jpg


The figure below shows a schematic of 4 sets of IR sensors connected to a LM324N which operating principle is based on the schematic above.
LM324N infrared sensor need help.JPG


+5V = from LM7805 voltage regulator
Tx = IR transmitter
Rx = IR receiver
R = resistors
RV = 25 multiturn 10k trimmer (3296)
D = LEDs to indicate output high or low
U = LM324N OP AMP
J = single female pin header to connect to input ports of PIC microcontroller

I have built this configuration on a breadboard and generally there are no problems.
However, when I fine tune the circuit to detect the black and white surface at a close distance (2cm) by adjusting the 25 multiturn trimmers, I will encounter a problem. Adjusting 1 or 2 trimmers will not give me any problems but adjusting the 3rd or 4th trimmers will cause the output of the previous 2 sensors to become either LOW or HIGH (opposite value from previous adjustment).

Therefore now Im stuck in a never ending cycle of adjusting the exact value of the trimmer every time I power it and this is not a practical way. I have run out of ideas on how to solve it as I do not know what is the problem.

Any suggestion/ improvements are welcomed
 
The resistance of the 10 k resistors and pots is too low at only 10k ohms. Try 100k ohms.
 
The resistance of the 10 k resistors and pots is too low at only 10k ohms. Try 100k ohms.
I am not so sure that is the problem.
AG is usually spot on with is diagnoses of electronic problems, but in this case there are a few things that I would look at before changing the pots.

The 7805 voltage regulator:
Is it on a heat sink?
Is it getting hot?
Does it have decoupling capacitors on the input and output to prevent oscillation?
What supply is feeding the 7805, is the voltage always above the minimum drop out voltage of the 7805? (Including any ripple if the supply is badly smoothed DC).

There are other things, but these are a good start.

JimB
 
I was also thinking that the output of the 7805 is unregulated and is less than 5V because its input voltage is less than about +7V.
 
im not sure I understand the situation with 4 sensors. Are you trying to detect a range of "grays" as the sensor passes across the black/white threshold or just on/off (black or white).

the sensor should be a pretty quick and definite change if you are just looking for black to white.
1) you should measure the voltage when black is in front of the sensor
2) measure the sensor voltage when white is in front of the sensor
3) set the threshold voltage to the midpoint of the two voltages above. it shouldn't need a 25-turn resistor to find that midpoint. If your sensor is not making much voltage difference, then you need to change the resistor in series with your sensor to 100k as AudioGuru suggested. That will give a larger voltage response between black and white.

your current problem is likely because of power supply fluctuations when various LEDs are on vs off which will screw up your voltage divider "reference" voltage.

a big voltage response is desirable for these robots because eventually you'll add a motor and that will cause your power supply to fluctuate even more.
 
The resistance of the 10 k resistors and pots is too low at only 10k ohms. Try 100k ohms.
audioguru Thank you for the accurate analysis and suggestion, I borrowed a better multimeter from a friend and found the IR Rx resistance was 2M+ ohms therefore the voltage divider for R6, R7, R8 & R9 were easily affected when the trimpots were adjusted slightly, I changed their values now to 1M ohm and they functioned properly. However, I did not change the trimpot values as it is just a voltage divider.

The 7805 voltage regulator:
Is it on a heat sink?
Is it getting hot?
Does it have decoupling capacitors on the input and output to prevent oscillation?
What supply is feeding the 7805, is the voltage always above the minimum drop out voltage of the 7805? (Including any ripple if the supply is badly smoothed DC).
JimB and audioguru the LM7805 has no heat sink as its not hot, I supply it with 2 18650 li-po batteries in series which can achieve 8.4V DC max.
JimB i did not attach a decoupling capacitor to it due to: not understanding what oscillating of op omp means (hysterisis?) and I read the datasheet the they are internally compensated (saw a schematic in datasheet which had a capacitor linking to the output and negative input).

your current problem is likely because of power supply fluctuations when various LEDs are on vs off which will screw up your voltage divider "reference" voltage.

a big voltage response is desirable for these robots because eventually you'll add a motor and that will cause your power supply to fluctuate even more.
gophert no, I am not trying to detect any grays, just black and white. I have solved this problem after replacing R6, R7, R8 & R9 with a 1M ohm resistor. Thank you for the advice about motors, I will take that into account power fluctuations when linking the whole system together.
 
i did not attach a decoupling capacitor to it due to: not understanding what oscillating of op omp means (hysterisis?) and I read the datasheet the they are internally compensated (saw a schematic in datasheet which had a capacitor linking to the output and negative input).
I did not mean the op-amp.
I was referring to the input and output of the 7805, under some conditions they can oscillate at high frequencies if their input and output are not decoupled. Look at the 7805 datasheet.

JimB
 
I borrowed a better multimeter from a friend and found the IR Rx resistance was 2M+ ohms therefore the voltage divider for R6, R7, R8 & R9 were easily affected when the trimpots were adjusted slightly, I changed their values now to 1M ohm and they functioned properly. However, I did not change the trimpot values as it is just a voltage divider.
actually your schematic showed them as 10k
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top