The IR transmitter and receiver on breadboards for test
I made this circuit for a project that i am currently making (Instant Cold Coffee Machine). I needed of a circuit, that can detect a light beam cut. The first circuit i made was a light/dark detector with photoresistor. Although it could sense the light cut, it had a major disadvantage: extreme interferences from ambient light.
That is why i designed this simple circuit. I tried to keep it as simple as possible. The maximum distance of the IR LED pair that i used is up to about 2.5cm (close to 1 inch). That explains the title "Short Distance". It has a very good sensitivity. With a potentiometer you can adjust it to sense completely opaque objects, or it can sense semi-transparent films as well! It is also suitable for rotary encoders. It is not suitable for making security systems which require a beam that can go up to 3 or 4 meters long.
The transmitter circuit
The transmitter circuit
This is the first part of this IR pair. The transmitter circuit is a pulse generator that drives an infrared LED. I have use the good old 555 chip. The pulses are about 1.5KHz. You can use of course any kind of pulse generator like an Astable Multivibrator transistor circuit. That is up to you. Here is the schematic for the 555 connected as an astable multivibrator, oscillating at around 1.5KHz:
Bill Of Materials (Transmitter circuit only)
Resistor 330 Ohm 1/4 Watt 5% Carbon Film
Resistor 4.7 KOhm 1/4 Watt 5% Carbon Film
Resistor 47 Ohm 1/4 Watt 5% Carbon Film
0.1 uF Ceramic capacitor
TLN 100 3mm Infrared Diode
The receiver circuit
The receiver circuit
I began designing a complicated interference-proof circuit, with an active filter and other stages of filtering. Then, i realized that i was going the long way. There is no need for such filtering. This is an IR pair that will be most likely inside a housing, with the transmitter close to the receiver, away from parasitic lights. So, i start removing stages until i got down to minimum. The circuit that follows can be powered with a single 5 volts supply (unlike the other circuits that i designed that required double power supply). It has a simple capacitors filter that drops all constant and low frequency IR light sources such as the sun, the household lighting. The IR detector itself will reject any other source of light beyond the IR, such as other LEDs and the sun. So, the only thing that will interfere with the receiver is sources of high frequency modulated IR light, such as the TV remote controls. But i supposed that if you built a rotary encoder, you will not turn the TV remote control directly to the receiver LED do you? I might re-make the complicated filtered version and upload another circuit.
So, here is the schematic diagram of the receiver:
First of all, notice the IR Detector LED that is connected reverse! And that is how it should be! This receiver will reject all light sources except the infrared. Then, the capacitor C1 will only allow the modulated IR light to go through. Constant light sources such as the sun, or low frequency such as the household light will not be allowed to go through. Remember that both the sun and the household lamps, except the visible light, they emit also infrared light.
Next is the adjustable gain amplifier. The R3-R4 voltage divider biases the base of the transistor. The R5 will set the maximum gain, while the potentiometer R2 will adjust the current that flows to the base of the amplifier. The amplified signal will charge the capacitor C2. This capacitor also will smooth the signal into a constant straight line.
The final stage is the comparator. The R7-R8 voltage divider will set the voltage reference. The comparison of the voltage across the C2 and this reference voltage, will result into a HIGH or LOW output of the comparator. As long as the IR beam reaches the receiver LED1, the signal will be amplified (and inverted) from T1. The C2 will then generate a voltage across its leads. This voltage level can be adjusted by R2. It must be less than the voltage of the non-inverting input (R7-R8 voltage divider). The output of the comparator will then be HIGH. When the beam is cut, the output of the amplifier (T1) will be 5 volts, and that will also be the voltage across the C2. The inverting input of the comparator will be higher than the non-inverting, and thus the output (pin 6) will be LOW.
You can change the output state of the comparator easily, by swapping the inverting and non-inverting inputs. If you do so, the comparator output will be LOW when the pulses arrive at the IR diode, and will go to HIGH when the beam is cut - completely the opposite as before.
Bill Of Materials (Receiver circuit only)
Resistor 1 KOhm 1/4 Watt 5% Carbon Film
Resistor 4.7 KOhm 1/4 Watt 5% Carbon Film
Resistor 1 KOhm 1/4 Watt 5% Carbon Film
Resistor 47 KOhm 1/4 Watt 5% Carbon Film
Resistor 1 KOhm 1/4 Watt 5% Carbon Film
Resistor 22 KOhm 1/4 Watt 5% Carbon Film
Resistor 33 KOhm 1/4 Watt 5% Carbon Film
Resistor 330 Ohm 1/4 Watt 5% Carbon Film
0.1 uF Ceramic capacitor
47 uF 16V Electrolytic capacitor
IRD 300 3mm Infrared Detector Diode
LED 3mm green
BC547 Switching and Applications NPN Epitaxial Transistor
@Jack It should work both ways, normally open or normally closed. At 9V this is normal because the circuit is designed at 5V. You need to change the R7-R8 voltage divider output to have the LED off when the beam is not cut.
ok sir i got it but how about my question 2?
"2)when i swap the inverting & non-inverting input, i get some little voltage which cause my LED light up before i cut the beam, after i cut the beam the light just got much brighter, unlike there is no light up before i cut the IR beam.I try to find the reason but i still dunno so i decided to ask you."
@Jack I have not tried the circuit at 9V. What you can do is also use a 7805 as linear regulator and get 5v out of 9. This will work for sure. Otherwise you will have to change parts in the receiver to make it work.
sorry sir,today i just tried to construct your circuit, and i found that there is 2 problems...
1)The circuit cannot be work with 9v supply, only can work 5-6v only or else the LED did not light up ( even i adjust the sensitivity using the VR)...did sir face this problem before?
2)when i swap the inverting & non-inverting input, i get some little voltage which cause my LED light up before i cut the beam, after i cut the beam the light just got much brighter, unlike there is no light up before i cut the IR beam.I try to find the reason but i still dunno so i decided to ask you.
Sorry to bother sir,hope you can give me some help here.Thanks and much appreciate
Hello sir.I have tried to implement this circuit but the problem is that I dont't have those infrared LEDs (TLN 100 3mm Infrared Diode and IRD 300 3mm Infrared Detector Diode) what I have is this pair: (a gas plastic infrared emiting diode OP165D and its associated infrared selected NPN silicon photo transistor) (RS 585-983 with RS 585-977).I don't know if it works or not.
PS: I want to use this circuit to detect the floors in my elevator prototype.THanks in advance.
My problem that i m doing a test using switch.
when i m connecting a switch to controller , the controller is working means stepper is moving forward and reverse according to[b] switch ON and OFF[/b]. But when i am connecting out put of above circuit which i have post above (means out pin 6 of op-amp) it not detecting switching and moving only one direction.
the out put voltage at pin[b] 6 of is 1.46 [/b]even no signal receiving by IR LED(Receiver Led) from the transmitter Led.is problem this ,means at logic zero voltage is[b] 1.46[/b] .
how i can remove this voltage to zero. please help me.
Thanks for your replying. I have one last Question and I hope that you can help me in that. I want to interface these transmitter and receiver sensors with PIC microcontroller for the same purpose, detecting a cut. would I need to just take the output of timer and connecting it to the PIC? is there any way to use the PIC only without the timer?
Thanks for your useful and a V good explanation. I have one question regarding my project. can I use these IR sensor ( transmitter and receiver) for an application that the receiver will be fixed and i will put the transmitter in an object that is moving. whenever the object is near the receiver it will detect it ( distance is not critical because i will work in prototype and distance maybe 5 cm ). I mean does receiver can see transmitter from different direction ( angle ) or it requires a straight line only?
Please help me in figuring this confusion
@dspic c1 only allows pulsing current to cross, so filters out all DC current from the Vcc or from any other constant IR. R6 and C2 performs a low pass filter to smooth the high frequency pulses from the receiver into a dc voltage. the transistor amplifies these pulses.
The frequency is 1.5KHz you're right. I do not remember exactly what happened but obviousely i changed the bill of materials.
Do not try to measure voltage on c1, you will fail. You need to use the oscilloscope to watch the voltage. With the voltmeter you read the rms voltage, while you need the peak to peak
I m struggling with circuit since 1 week , i want to know somethings..
1. What should exact frequency at pin 3 of 555 .
(because with the help of equation F=1/[0.67(R1 2xR2)xC] with
C= 0.1uFd,R1=330ohm,R2=4700(4.7kohm ) and i found F =1533.95 Hz.
and you are saying 7 khz.How it is ?
2. what should be voltage before and after capacitor C1(means towards
LED1 and towards R3 ,R4 )
in my circuit
The voltage with the transmitter off
1)before C1 0
2)After C1 0.88
The voltage with the transmitter on
1)before C1 4.47
2)After C1 is 0.88
is it correct measurement?
Thanks for so fast reply.sir i have some confusion.
1. means we can use any frequency may be Mhz.
2. sir i have competed this circuit . but my teacher when ask why you have used C1, i give the answer-
"filter that drops all constant and low frequency IR light sources such as the sun, the household lighting"
but i m still confused how C1 filter ?.
3. you have explain that "capacitor C1 will only allow the modulated IR light to go through. Constant light sources such as the sun, or low frequency such as the household light will not be allowed to go through "
how? where is modulated IR? , is it coming from transmitter how it is modulated ?.
4. why you have used transistor and C2?
5. can we used this circuit to detect a object which moving between tran. and rec. with 15-20 Hz? , if no what we have to do?
sorry for so long question. thanks again sir.
@Islam Qabel actually this design is not well suited for long distances, because it has poor filtering and it is designed for not well-lighted places, for applications like digital encoders for example, which ambient light is not very intense. An extra amplifier will amplify also parasitic light. Light from lamps and the sun carry also IR waves so they will cause problems even on the transistor.
Check out this instead:
I use a TSOP1838 receiver and a high-brightness IR LED transmitter to achieve some 10 meters reception. The TSOP has built in several filters, including optical.
Thanks to circuit designer, the circuit is working good and i tested it by applying ambient light & IR..the voltage across C2 is decreasing as no beam-cut and be about 4.32 volt when beam-cut.
First of all, i installed photo-transistor (black window) its P/N: SFH-300FA (Manf: OSRAM) it rejects ambient visible light and pass only IR.anyway...The transistor gives more receiving sensitivity ....to increase the range, i added extra circuit as an input to your design....the photo-transistor output is connected to op-amp (inverting amplifier) via Capacitor and then connected to your design via C1. the result is the distance increased by about one feet but still the distance still short. i made simulation by Proteus and the result was very good. In realty, I used UA741 op-amp, Vcc=5V & -Vcc=GND, the problem is an DC output about 1.8 volt exist even if the input is zero. I overcome this by adding a capacitor to the output to remove the DC and output after capacitor is about 200 to 300 mV.....i think we you use good amplifier, the distance can be long.
Let me explain, your design is not sensitive well to slight changes across the DC value (DC: Other IR sources (lamps,.....) AC (7KHz IR led)) so the result is the output voltage across C2 change small because the AC signal is small and the amplification is not enough.
So if you get large amplified AC signal from good amplifier that amplify the small AC signal from photo-sensor (as you far from the sensor, the signal is weak but the amplifier can detect it) and make it as input to your circuit, the C2 voltage will decrease large and detect IR for long range. I hope that u can understand me and i know that it is long reply. I can send you the suggested design if you want to...
I need your help to design good amplifier
Hi.. I have already build exactly same as yours. But it still fail... my receiver part, the LED was light up. but after i try to detect the transmitter IR LED, the LED in receiver still light up.. may I know what is the reason..???
Thanks a lot for your design....actually i made the circuit but it does not work and the voltage across c2 remains at 5 volts, i have black color photo-diode with two pins and i connected it as shown the maximum current through R1 is about 200 uA when the IR transmitter with very close to the photo-diode...i noticed the current through the branch R5 & R2 is very small around 1 or 2 uA .........during not-beam cut ..the voltage is still 5 volts across C2 so what is the source of problem???
Kevin, you go for the long range for sure. not only because of the distance, but because of the modulation of the signal. the short range is supposed to be inside a housing without external interferences. the long range has much better filters to drop out ambient light
Could this or your long range detector circuit be used for a distance of between 2 and a6 inches.
I am trying to put together a box that will be in a wall and from one side of the wall there will be a slit that paperwork will be in and a door on the other side of the wall. When a piece of paper is droped into the slot a beam will be broken and a light will light up indicating to someone on the door side of the box that it is full and can come and get the paper out of it. I have been trying to find something pre-made but if I cant I would like to make it. I will need to work with 12 or 24 ac or dc as a supply.
you can hack a mouse and interface its left button to this circuit for example. each time the beam is cut, the mouse will send a mouse button. or hack a cheap keyboard and send an enter key, or whatever.
I would like to use the beam break signal to trigger a counter. I will be counting in the range of 150 beam breaks in 30 seconds. My first try was connecting a dollar store pedometer and an LCD kitchen timer, but the pedometer wasn't picking up every beam break. My second idea is to output the signal to USB or a mic input and have a software program count the number of beam breaks in a 30 second period. Does a program like this exist? Is there a more simple solution to my project?
The equation F=1/[0.67(R1+2xR2)xC] that I have used to calculate the frequency of output.
I have calculated the frequency for the resistances of R1 and R2 that you recommended by using the equation above, the value of F was not about to equal to 40k, but 7.77k only. Have I used a wrong equation?
Since the current may be too large for small resistance of R1 and R2, the power also increases that the battery would get flat easily, I hope that I can use larger resistance of R1 and R2 and smaller capacitance for C to save power. If I have capacitor which is smaller than 103, what value will be the most suitable?
-> yes, there is a frequency present, it is 7KHz coming from pin 3 of the 555.
-> to climb up to 40KHz, you need a selection of parts like R1+R2=10K and C1=0.01uF (check this page: http://pcbheaven.com/wikipages/555_Theory/) but you need to test it out to have exactly 40KHz. Better use a 10K potentiometer (R1) and a 4.7K resistor.(R2)
-> You can use 100K potentiometer and put another 100K resistor parallel with it, it is absolutely the same as a 50K. But 1M is too big.
-> The distance depends on the diodes (IR LED IR receiver) only. To increase distance you need to select other parts.
Since I do not know too much on this circuit, and the receiver circuit is not made and tested yet due to the absence of the IR receiver (I have seen but did not bought it), so do you mind to tell me is there a frequency present when the receiver circuit is in operation? Or just constant?
In the transmitter circuit, in order to increase the frequency to 40kHz, what resistance of R1 and R2 should change to under the voltage of 6V?* And what modifications should I take in the receiver circuit? And what its vaild distance?
The potentiometer controls the sensitivity, is it okay to use other values such as 100k (104) or even 1M (105)?
When it is operated in 40kHz, what is the maximum distance as it works?
*The capacitor is limited to use as small as 103, I have no capacitors which have a lower capacitance than this temporary.
It is not equal to phototransistor, is looks like a normal LED.
Regarding the resistors, this is something that you have to test. You can use the resistors you said with no problem. i am not sure about the results though.
To increase the distance, you need to change the IR transmitter LED, run at 40KHz and use an integrated IR receiver at 40KHz as well. The parts that i have chosen are for close distances with high sensitivity.
I would like to know that about the infrared detector diode, is it equal to a phototransistor (its appearance is similar to this diode)?
I use 6V for Vcc, so for R8, I have no 33k resistors, is it okay to use 40k (1%) instead? And should I change the resistance of R7 to balance?
This circuit is okay when the distance is used to be in a few centimeters, this is the limit, can it be solved by increasing the frequency of the transmitter? Or the Vcc? Or using more powerful IR LED and receiver?
I changed the 555 and it worked perfectly!!!.Thanks a lot for your patience and your concern.Also i noticed that if an object with small diameter ex 5mm passes the beam very very fast the circuit don\'t respond.For the job i want to use it is perfect but just for knowing if it can be done anything for it.Also as hassan said is it possible to change the distance???
the resistor value is ok (56 instead of 47). No problem. Frequency can vary widely because the filter i use is not narrow pass. So There is no problem at all with frequencies.
Let me give you a way to test if 555 oscillates. Replace the R3 with a 0.1uF capacitor and the IR LED with a normal LED. If 555 oscillates, then the LED should light because the capacitor would act as a resistor (at 7KHz around 220 ohms), otherwise the 555 is wrong connected or toasted because the cap acts as cut-off in DC circuits.
Its not the capacitor so i am going to change the 555.I would like to tell me because i don't have an oscilloscope where i shall put a trimmer to play with the frequency to see where the led turns off???.Does the tolerance of the resistors affect frequency?Also i forgot to mention you tha the R3 of the transmitter is 56Ω instead of 47Ω Does it really matters?
Ok, these numbers makes more sense. 0.88 comes form the R3-R4 divider. Which means that either your capacitor is dead, or the transmitter is oscillating at all. Change the capacitor. If this does not work, then check what is wrong with the transmitter. It should generate a frequency around 7KHz. If this frequency is not applied to the transmitter LED, then the capacitor will cut-off any DC signal.
Oh, that is weird! First of all, C1 is 0.1uF ceramic, which should not have polarity. Second, it MUST have some voltage on both ends. Check the net R3-R4-R5-C1. The error must be there somewhere. It cannot have 0 volts! Impossible. You should find something like 0.6, to 1 volt.
You need to make 4 measurements for me. First, turnoff the transmitter circuit completely, only the receiver circuit should have power. Measure the voltage on both pins of the C1. To do this, put the red wire of the voltmeter on the first wire of C1 and the black to circuit ground. Then, move the red wire to the other wire of C1. These are the 2 first measurements.
Then, turn on the transmitter circuit and approach the 2 LEDs as close as possible, 5mm maximum distance. Repeat the 2 measurements on the C1 and send me the results.
Could you be more sprsific?
you said 'measure the voltage BEFORE and AFTER C1, with the transmitter turned on and off.'you mean to put a voltemeter to + of the C1 and the Ground and then???I can't understand.And what do you mean by saying and the transmmitter on and off.My distance is no longer than 2-3cm
Frankly i do not remember the voltages. But the R7-R8 divider should provide around 3 volts to the non-inverting input (+). I think that the current of your receiver diode is very different from mine. Having always 5v on the inverting input means that the transistor base never gets enough current. First of all, change r5 with a 2.2K resistor. That will extremely increase the tr base current. If it works, you may need to change R2 to get better scale over range.
If that does not work, then put back the original r5, and start increasing r4, which will increase th tr base voltage. Don't go above 10K, it would have no sense.
Finally, if this also does not work, then you need to change R1. Restore all other components. Replace R1 with a 220 Ohms resistor in series with a 10K potentiometer. Changing the potentiometer should 100% find the correct size somewhere. Measure with a multimeter and put the proper amount of resistor.
Do me another favor. Before you start doing the above, measure the voltage BEFORE and AFTER C1, with the transmitter turned on and off. Also, how long is the transmitter LED form the receiver LED? The pair i use has limited range within about 2.5cm.
Hello its me again.Well i did the experiment you told me and i saw that the pair is working.Yeasterday i also built it in a pcb but i have the same results not functioning properly.I changed the inverting and the non inverting because that would help me to my application and now i always get +5 to the output no matter if i put my finger between the ir beam.Could you please tell me what voltages are appropriate to particular points to measure???
-This resistor is to convert my 100K pot into 50K, because i did not have a 50K by that time. Notice that it parallel to the potentiometer wires.
-You can mount both circuits on one breadboard and that would cause no problem at all
-According to your description, i suppose that you have connect the IR reciever wrong (it should light on never). Notice that the receiver is reverse-biased, the cathode (short long lead) goes to the positive of the power supply.
Make an experiment. Put a 1K resistor form positive to the cathode of the IR receiver and then the anode of the receiver to the negative power supply (5 volts). Then, put a multimeter across the resistor. When the transmitter circuit is close to the receiver LED, the voltage across the resistor must change. This means that the pair works.
Well hello my friend i have sent you a message in Greek but as i can see the page doesn't support Greek so i am going to write it in English...I have built the circuit above but i can't make it work for the last 2 days. I don't know what the problem would be.I noticed that you have a resistor that it's not included in the schematic (100k)Please have a look to your drawing-photo and if there is any mistake please let me know.Also i would like to tell you that i built both circuits to the same breadboard and i don't know if there is such problem of not working.Also i couldn't find the particular ir but the seller told me that the ir transmitter-receiver is a pair so i used the without knowing the specifications of them only that their brand is kingbright.I saw using a camera that the ir led is lit but the led on the receiver is just lights on and then lights off when i power the circuits....
3 feet are not too long. Nevertheless this IR pair is not too powerful. You will need different IR LED diode and receiver, which should have also hardware IF filter. like the TSOP4840 (series) to avoid interferences
This is something that you need to test with trial and error. You need to measure the voltage on the C2 capacitor when the beam is cut and when it is not cut, and if the difference is not too high (for example is less than 2 volts) then increase the capacitor. You can also play with the R7-R8 voltage divider to adjust the triggering voltage.