How to Make a IR Proximity Sensor at Home

99,259

520

44

Introduction: How to Make a IR Proximity Sensor at Home

About: I am New Pew, I create electronic projects and share these creations on my YouTube channel. In every video I mainly show how you can make these innovative creations yourself! There is a description of each pro…

In this Instructable I show you how to make a simple infrared sensor for hobby projects and to learn how an infrared sensor works.

I used an infrared sensor with one of my previous Instructables (the automatic hand sanitizer dispenser) but I didn't know exactly how this sensor worked so I dived into it a little further.

Video tutorial:

An IR sensor is basically a device which consists of a pair of an IR LED and a photodiode which are collectively called a photo-coupler or an opto-coupler. The IR LED emits IR radiation. The IR radiation is emitted in a beam from the IR LED. When this beam is disturbed, it widens and "hits" the photodiode. The photodiode converts the IR light into an electrical current. Because the output of the photodiode is not constant, I opted for a circuit with BC547 transistors. I will explain how this works in step 1.

The appendices contain a simple diagram to keep the project clear.

Supplies

  • IR LED
  • Photodiode
  • Green LED
  • 2 BC547 transistors
  • 100 Ohms resistor
  • 47K resistor
  • 9V Battery
  • 9V Battery connector

Step 1: BC 547 Transistors

A transistor is a device mostly used for switching purposes. As one of the sizable semiconductor devices, the transistor has found use in great digital applications such as embedded systems, digital circuits, and control systems. In both digital and analog domains transistors are substantially used for exceptional utility usage like amplification, logic operations, switching and so on.

In this project we use the transistors as a switch. A transistor conducts current across the collector-emitter path only when a voltage is applied to the base. When no base voltage is present, the switch is off. When base voltage is present, the switch is on. To provide the LED with sufficient voltage, we use the first transistor, which is controlled with the signal from the photodiode, to control the second transistor. This gives the LED power directly from the battery.

Solder the emitter of transistor 1 to the base of transistor 2.

Step 2: IR Led

Solder the positive connection of the IR led to the collector connection of both transistors. Cut off the other connection a bit (we need space for the resistor here).

Step 3: Resistor 100 Ohm

The IR led needs a 100 Ohm resistor. Solder this to the IR LED.

It does not matter in which direction or on which side of the IR LED. A resistor works the same in both directions.

Step 4: Green LED

Bend the pins of the LED. Solder the green LED with the + side to the emitter of transistor 2.

Step 5: Resistor 47K

Connect the 47K resistor between the - terminal of the LED and the BASE terminal of transistor 1.

Step 6: Photodiode

Now the photodiode is connected across the collector and base of transistor 1. Bend the pins of the photodiode so that it fits properly. Solder the connections.

Step 7: Finish Off

Bend the pin of the 100 Ohm resistor. Connect it with a rest piece to the negative connection of the green LED.

Step 8: Connecting the Power Supply

Fit a 9V battery connector to the sensor. The red cable to the positive connection, the black to the negative.

Step 9: Ready!

The sensor is ready! Connect a 9V battery to the connector and the sensor will work.

Video tutorial:

If the LED stays on, the IR LED or the photodiode may have to be bent slightly so that the infrared beam does not hit the photodiode (if it is not disturbed).

Have fun with this project!

Anything Goes Contest

Participated in the
Anything Goes Contest

1 Person Made This Project!

Recommendations

  • Lamps Challenge

    Lamps Challenge
  • Puzzles Challenge

    Puzzles Challenge
  • Rice & Grains Challenge

    Rice & Grains Challenge

44 Comments

1
jonsops
jonsops

1 year ago

I have been an electronic tech for more than 45 years so assembling this is simplicity to me.
BUT, NEW PEW, you have not provided any pin connection diagrams, so how does a newby know which pins to connect?
jeff.verive I agree. A 330 ohm resistor is a good addition.
A table of voltages and currents would help a newby learn what's happening.

0
zuzarmp
zuzarmp

1 year ago on Introduction

Useless, does not show the positive negative of less, does not work

1
hugojtc
hugojtc

Question 1 year ago on Step 1

What can you turn on besides the green LED?

0
DennisM5
DennisM5

1 year ago on Introduction

looks very nice and small enough to fit inside my train engine. Hoping to take the LED on signal to trigger a Sound board to make chuff sounds and Puffs of smoke from a rotating gear with a white dot in the side. I need one pulse every time a white dot passes the IR sensor. I will order the transistors and build this up. I have a Volt Regulator to get 9V from track power. Instead of an LED on, I need to close the circuit for the sound and puff controller boards to their ground. Do I need a Relay here to do this? Nice little project, thank You. Dennis

0
jmhermel
jmhermel

Question 1 year ago

Hi This is great! Do you think there is a way this could work underwater to detect small fish?

1
fp.shed2
fp.shed2

Question 1 year ago on Introduction

What is the polarity of the photodiode? Also, where is the fritzing layout?
"The appendices contain a simple diagram to keep the project clear."
Where are the appendices?
Thanks!

1
lop098
lop098

Question 1 year ago on Step 9

where do I connect the + & - for the 3v pump. 80yr old just starting out, thanks folks

0
bgreen3
bgreen3

1 year ago

I love "dead bug" circuits! (for the uninitiated, bare wires with clean and careful bends) They are beautiful! They are art! Nicely done!!!

9
jeff.verive
jeff.verive

1 year ago

Very handy circuit that can also be used to check IR remote controls. Using two transistors in this way is known as a "Darlington" configuration, and it is a very good way to amplify tiny currents (like the current generated in the photodiode).

I'd like to recommend adding a 330 ohm resistor between the anode of the green LED and the emitter of Q2 in order to protect both devices from excessive (and destructive) current.

0
UserInstru
UserInstru

Reply 1 year ago

Your hint is a good hint, but this Darlington is in configuration "Emitter Follower" and so, is enough "self limiting" the current that cannot be destructive.

I don't understand how could be possible to use this continue IR emission to check IR R-C. What's your idea?

0
pcarew
pcarew

Reply 1 year ago

I believe that if Q2 was in full saturation, then there would be unrestrained current flow from the battery, through the collector / emitter junction and then through the Green LED

2
UserInstru
UserInstru

Reply 1 year ago

If Q2 could be saturated it can be dangerous for the LED and for the transistors, but (as already told with other words) in Emitter Follower configuration the transistor cannot be saturated. This means only that the danger of destruction is lower than we can suppose, but not totally absent. Very different conditions into a Darlington configured as usually, with the load (LED) connected from Collector to +9V, where there are less limit to the collector current, but it is not this case. I think (I suppose) that this project had used the Emitter Follower configuration really to obtain this self-limitation of the IC.

2
pcarew
pcarew

Reply 1 year ago

You are quite correct. Once I thought this through (and reviewed my dim and distant electronics past), I see that you are right.

This LED does not need a protection resistor as the Q2 VB can't get higher than VC and therefore is never saturated

1
jeff.verive
jeff.verive

Reply 1 year ago

Q2 doesn't have to saturate to exceed the LED's maximum forward current. Q1 *can* saturate, and its collector current (which is essentially equal to the emitter current) is amplified by Q2. Additionally, the Darlington configuration puts both base-emitter diodes in series with both the IR detector and LED with no current limiting in the string. While you can probably get away without a current limiting resistor somewhere in the string, good design practice really calls for some current limiting.

0
UserInstru
UserInstru

Reply 1 year ago

Also I would have added a resistor to limit the current, but only for my habit and not for the non-existent danger that the transistors can saturate and even less destroy themselves or the LED.

0
jeff.verive
jeff.verive

Reply 1 year ago

Why do you believe there is a nonexistent danger? Q1 can certainly saturate, and while Q2 cannot saturate its collector-emitter voltage can come close enough to saturation that there is ample opportunity for excessive current to flow through the LED. Most indicator LEDs are rated for a maximum of around 60mA, so with the gain multiplication of the two stages you need no more than 5 - 10 uA of base current at Q1. Do you believe the circuit will limit the base current to no more than this?

0
UserInstru
UserInstru

Reply 1 year ago

By "saturation" we mean a voltage Vce very close to zero.
To get to that point the phototransistor emitter should provide enough current so that Q1 (the first transistor) amplifying it and making it come out from its emitter, injects it in the Q2 base until it is saturated.
When Q2 base is in conduction, it is already at about 0.6V + the voltage falling on the LED (about 1.3V).
Consequently the base of Q1 when it starts to conduct will be at between 1.9 and 2.0 V.
Approximately 7.0 V are available at the phototransistor.
By increasing the IR intensity the phototransistor will decrease its impedance and its Vce, trying to decrease the voltage at its ends.
The three cascaded devices that follow the phototransistor (Q1, Q2 and LED) are basically diodes and offer a non-linear impedance to the current flowing through them.
This means that the more the phototransistor will try to supply current to the following circuit, the more the impedance of its "load" will decrease and it will be more and more difficult for the phototransistor to supply current.
Moreover, it should not be forgotten that also the Phototransistor configuration is "Emitter Follower" and I believe this is not a random choice.
I confess that I am not good at these calculations if not approximate, so it remains only to dust off my bradboard and perform some measurements, to clarify those doubts that I have too.

1
UserInstru
UserInstru

Reply 1 year ago

I'm older than your electronic past ! I was a young student when the electronics from tube was passing to Germanium Transistors and after some years more, to Silicon. My first 'semiconductor' professor was considered as a revolutionary man, so all we were loving him and his power to 'turn the page'. So, after studied the thermionic tubes I was happy to swim in the future, more early that the students of other schools. In my mind, I always represent the transistors as "physic lever" choosing the Emitter for his fulcrum. My best and friendly regards.

1
jeff.verive
jeff.verive

Reply 1 year ago

Q2 doesn't have to saturate for the LED current to exceed its maximum rating. Q2's emitter current is roughly equal to Q1's base current multiplied by the square of β. The IR detector is the main device limiting Q1's base current, and this may not be enough to protect the LED from excessive forward current.

1
pcarew
pcarew

Reply 1 year ago

This has been a good discussion about transistor basic principles.