# Proximity-Sensing LEDs

This project of mine started because I wanted to learn how to layout my own printed circuit board (PCB). I needed a simple and easy-to-solder circuit, so I chose this one because who doesn't love interactive LEDs?

In this Instructable I will only be showing the implementation of my circuit on a breadboard. In my next Instructable (now available here), I will demonstrate my process of designing and laying out the PCB.

As I mentioned I wanted a simple project and this one is just that! Students, hobbyists, and anyone else of all skill levels will be able to easily put this together. Let's get started!

I entered this Instructable in the site's Tech Contest, so if you like it please vote by clicking the button in the top right. Thank you!

Remove these ads by Signing Up

## Step 1: Introduction to the Circuit

This step is the "How it Works" section. If you prefer to get right into making the circuit, skip to the next step.

If you're still with me, I'm going to start with a brief introduction of some of the components I used in this circuit. (An exact list of materials is in the next step.)

• The component that looks like a black LED is not actually an LED at all. It is a photo-transistor. How does a photo-transistor work? When the photo-transistor receives a certain wavelength of light, it "turns on" and allows current to flow through it. When the photo-transistor is not receiving that wavelength of light, it is "off". That being said, the photo-transistor is essentially acting as a switch in our circuit. Note: The photo-transistor I used is made to respond best to light with a wavelength of 880nm.
• The pink LED in the image above is an infrared (IR) LED which does exactly what it sounds like it would do. Rather than emitting light that our eyes can see, it emits light in the infrared range of the electromagnetic spectrum. It is in series with a 220Ω current-limiting resistor to protect it from burning out. Note: The IR LED I used is made to emit light at a wavelength of 880nm. Sound familiar? I'll get back to this in a bit.
• The blue LED is just that, a blue LED. It is also connected to a 220Ω current-limiting resistor.
• The only other components I used were resistors and wires.

So how does this all work? What makes it proximity-sensing? Remember in the explanation above that the photo-transistor acts like a switch. So when the photo-transistor is off, no current is flowing across it to our blue LED and the LED is off as well. Now look at the other side of our circuit. That's where the IR LED is connected, and it is connected such that it is always on and emitting 880nm infrared waves. Remember that I also mentioned the photo-transistor is set to respond best to wavelengths of 880nm? That's how the proximity-sensing works! When an object (such as your hand) goes over this little "cluster", IR light of 880nm is emitted from the IR LED. This light reflects off of your hand and back to the circuit. When the photo-transistor picks it up, it turns on allowing current to flow through from the source to our blue LED lighting it up!

Note: The light we're dealing with doesn't have to specifically be 880nm to for this to work. The important thing is just that the photo-transistor responds best to the wavelength of light that the IR LED emits.

 1-40 of 45 Next »
alexis.carlsen1 month ago

Alright, I deffinately want to put this on my next textile-intergrated project, but the problem is, i'm going to need a LOT of the transistors & IR's. What/where is the most affordable place you've been able to purchase them. I'm looking at buiying up to 100 of each.

yesterday

ebay by far has the cheapest components. Order from a seller in China/Thailand that has a good rating/Best Seller rating. It will take longer to arrive but will be far cheaper than any US based store.

Will_W_76 (author)  alexis.carlsen1 month ago

I used Digi-Key for all of the parts in this project. They have the most variety and they give you a discount for buying in bulk. For example, the photo-transistor I used goes for 51 cents a piece, but if you buy 100 of them they go down to 28 cents a piece.

1 month ago

Do not use the below.... been waiting for 3 weeks for these parts, plus they charge shipping by the total cost, not weight.

http://www.futurlec.com/index.shtml

I would love to have them by now,,, just a great project for someone that can only use breadboards, Love it.

I am having troubles with your project as easy as it is i don't know what i am doing wrong, I am building the same thing as your schematic and my led doesn't want to turn on, the only difference is that I am using an ac to dc converter and a L7808CV so instead of 9 volts, I am using 8 volts, I'vr tried to connect 3 47k redistors instead of the resistor of 47 k and nothing, and I mafe sure that my IR led is on, can you guide me on what am I doing wrong?
9 days ago

Hey! Thanks for the comment. Sorry it has taken me a while to get back to you, I've been super busy lately. Let's see if we can get this figured out though!

First, maybe it's just hard to tell in the picture, but the resistor on the top right of the picture that should be 47kΩ looks like it might actually be a 470Ω resistor. Like I said, it may just be hard for me to tell in the picture, but double check that.

Also, double check that your LED works. Connect it to a simple circuit to see if you can get it to turn on at all.

If all that works, grab a voltmeter. The first thing we're going to want to check is that there is the correct voltage at the power rails. In this case that is 8V, which is plenty. (I've operated this circuit with 6V.) Use your voltmeter to check that there is a voltage of 8V at each of the power rails. If there is not, check your power source and the connections at your L7808CV voltage regulator. (Here's a datasheet for that family of regulators if you need it.)

If the power is correct at the rails, we want to check the voltage at the anode of the LED next. (This is the junction where the photo-transistor, LED, and 47kΩ resistor come together.) When there is no object near the circuit, we want this voltage to be under about 2V, so the LED is off. As an object moves nearer to the circuit, this voltage should increase (above at least 2V) to begin to turn the LED on. In my configuration, I was reading 0.8V when nothing was near, and this increased to just above 8V when my hand got closer to the circuit. Connect a voltmeter here and observe the voltage range you get as your hand approaches the circuit. If you're not getting any change in the voltage at all, your photo-transistor could be defective (or it might not be configured to the same wavelength as your IR LED. Double check this. Both of mine were configured for 880nm.) If you are getting a range of voltages though, then everything is probably working correctly and you just need to increase the value of the 47kΩ resistor. I know you said you already tried using 3 (in series I'm assuming) 47kΩ, so maybe try 200kΩ. With each new resistor value that you use, check the range of voltages that you're getting at the anode of the LED.

Hopefully, one of these suggestions leads you to a solution. Let me know if you have any more questions!

nväyliö19 days ago
Just got my components. It's absolutely easy and fun project to do. I put a piece of cardboard between the clusters so the IR doesn't leak to the phototransistors. Many thanks!
Will_W_76 (author)  nväyliö17 days ago

Awesome! Thanks for sharing!

Hi. Can you tell me which ir led did you used (the part number)? cause there are plenty ir leds in the wavelength of 880nm.

thanks.

Will_W_76 (author)  nikos.paschalidis.161 month ago

The IR LED part number is 475-1469-ND on DigiKey.

bergerab2 months ago

Wow this is awesome! The applications this can be used in are huge. I'm definitely going to add this to future projects. Thanks for sharing!

nejo00172 months ago

Thanks for sharing! I love the simplicity.

This is amazing, I'm mezmerized by the gif at the beginning! Awesome job!

jeroen.linden.13 months ago

Hi,

Really cool project! I'm trying to build one myself but it seems i'm stuck on something..

I'm using 3mm IR led emitters and receivers both at a range of 940nm. I'm trying to turn on a 3mm green led with his own 100Ohm resistor.. But its not working properly.. When i just turn on the green led, its much brighter then when i try to switch it on using the IR leds.. I've changed the resistors to different values but its still very weakly litt...

I'm hoping that you have a solution for this 'odd' problem..

Thanks!

Will_W_76 (author)  jeroen.linden.13 months ago

Thanks for the question! If it's very weakly lit, it's probably because more current is flowing through the photo-transistor (IR receiver) to ground rather than to the LED. You mentioned that you changed the resistor values. What values are you using? The resistor that we want to adjust to fix this is the 47kΩ resistor. If your LED is only barely lighting, try increasing this value. Another time when I made the circuit with some different parts, I was actually using a 10MΩ resistor here! So there's a big range of acceptable values that depend on the specific qualities of your LEDs.

If you are still having trouble, check you're IR LEDs by looking at them through a camera to make sure they're lighting up. If you need more assistance don't hesitate to ask. Good luck!

carlos66ba3 months ago

Nicely done.

Hello!

I'm wondering what P/N have you used as 880nm IR photo-transistor?

Will_W_76 (author)  bohdan.kovalchuk.943 months ago

Hi! The part number of the photo-transistor I used was QSD124-ND. If you click on it, I included a link to it's page on DigiKey where I bought it.

3 months ago

Got it, thanks!

rockyt3 months ago

One more question, any idea on why my version lights up and stays lit when power is supplied? What other resistor values might I use?

Will_W_76 (author)  rockyt3 months ago

To answer your first question: The photo-transistor and IR LED I used mostly emit and receive through the top. It is likely there is some light going through the sides of both, but it's mostly insignificant.

The likely reason that your LED is always on is because of the value of your pull-down resistor (the 47kΩ resistor in my design). Reducing this value should solve that problem. I would reduce this value in steps and see how your circuit performs with each different resistor value. (A voltmeter would be helpful and precise here, but is not essential.) If you want more specific details on how pull-down resistors work and how to select the right values, read some of my responses to other user's comments below. I go into quite a bit more detail.

scottinnh3 months ago

This is a nice project, made simple and approachable by newbies. Starting out on a breadboard is a user-friendly touch.

This is similar to (though probably not copied from) Evil Mad science "Octolively", and I place the link here for those who may want to read another writeup on how to do this: http://www.evilmadscientist.com/2011/octolively-digital-interactive-led-surfaces/

Will_W_76 (author)  scottinnh3 months ago

I actually included a link to Evil Mad Science's video of their OctoLively in response to another user's comment on this Instructable! They have a really cool board.

Thanks for the comment!

rockyt3 months ago

Greetings Will,

I tried, for sometime last night, to create this circuit.

From Radio Shack I purchased an emitter and detector, they were in the same packaging so I assume they are made for each other. When I assembled the circuit, as soon as I supplied current the led lights up and stays lit.

at first I thought maybe the detector was too close to the emitter and it was

detecting and lighting the led. So, I disconnected the emitter and there was no change. That is, the led remained lit up. I used the same resistors as outlined in your instructable.

Question: Does the detectors used in your circuit only detect from the top of the detector? What prevents your detector from receiving ir light from the emitter while you are NOT moving your hand or ruler over it?

Thanks Will

PiotrS3 months ago

dose it work if you put sanded glass on it ?

Will_W_76 (author)  PiotrS3 months ago

I don't have any sanded glass to test this myself, but I would guess that it will work. Just make sure the LEDs are right up against the glass. This minimizes reflection from the glass to the photo-transistor. The only other setback you might have is a reduced range of sensing.

Jooks3 months ago

Will this method of proximity-sensing work under glass? I'm wonder if the glass would reflect back too much of the light and leave the LEDs powered on the whole time.

Will_W_76 (author)  Jooks3 months ago

Yes! I just tested it through glass and it worked the perfectly! I did notice a potential issue though. Make sure that the LEDs are completely against the back of the glass. This positioning seems to make sure that most of the light gets through the glass rather than being reflected back right away. If I held the LEDs a few inches back from the glass, the blue LED would faintly light up even if there were no objects on the other side of the glass.

Also, I tested this with completely clear glass. I don't know what you had in mind, but the opacity of whatever glass you are planning to use may or may not have an effect on it. But I would guess it would still work at least to some extent. Let me know how this works out for you!

alcurb3 months ago
I love your project. I love anything to do with LEDs.

I haven't tried this myself but wouldn't it be cool if you wave your hand leaving a lighted trail that dims to dark in about a second? I think that the effect could be achieved by adding a capacitor to delay when the circuit turns off rather than turning off instantaneously. Cheers.
Will_W_76 (author)  alcurb3 months ago

Yeah, absolutely! Capacitors would work well for that. You could use a variety of ICs to do different patterns as well, like on this board.

OhYeahThatGuy813 months ago
Very nice! I second ukhan14's question: what is the effective range of each cluster?
Will_W_76 (author)  OhYeahThatGuy813 months ago

For my design above, the LEDs started to turn on when my hand was about 7-8 inches away. If you're interested in trying to increase this range, read my response to ukhan14's comment below. Thanks!

ukhan143 months ago

what about the distance of motion which it can sense ? what is the max range of sensing? and how can we increase the sensing distance?

Will_W_76 (author)  ukhan143 months ago

In the design I used for this Instructable, the LEDs would begin to turn on when my hand was 7-8 inches away. As my hand moved closer, the LEDs would get brighter. This range will vary depending on the specifications of each of the components you're using.

The best option for increasing this range would be to adjust the 47kΩ pull-down resistor. With a 47kΩ resistor, the blue LED in my circuit would see 0.817V when the photo-transistor was completely off (no object is nearby). As an object, like my hand, got closer, my hand got closer, the voltage at the anode of the LED would begin to increase eventually reaching a maximum value of 8.25V when my hand was only a few millimeters above the circuit.

So how would changing this resistor value increase the range? Well the blue LEDs I used don't begin to turn on until they see a voltage of about 2.2V. Again, with a 47kΩ resistor, the blue LED in my circuit would see 0.817V when the photo-transistor was completely off. So I have to move my hand close enough to the circuit that the voltage increases from 0.817 to 2.2V (by 1.4V) before my hand is "sensed" by the circuit. If the voltage at the anode of the LED is already at 2.0V when nothing is nearby and the photo-transistor is off, I would only need to move my hand close enough to cause a 0.2V increase before the LED turns on. Because less of a voltage increase is needed, the object will be "sensed" from farther away.

To get the voltage at the anode of the LED higher while the photo-transistor is off, increase the resistance of the 47kΩ resistor. Maybe try 68kΩ.

SuperPollo3 months ago

Nice, simple and cool, will definitely make it one day. There's one thing I don't understand, it's the 47k Ohm resistor. If you could explain to me, how does it help to direct the current ¿? And what's a pull-down resistor?

Will_W_76 (author)  SuperPollo3 months ago

That's a good question! To be able to give you a good explanation, I grabbed my voltmeter and did some trials with different resistance values. I included the schematics of these trials below. Check those out. It will help my explanation make more sense.

Before I get started with my explanation, I should mention that for simplicity I only included the photo-transistor and resistor in each of my schematics (the rest of the circuit is actually still there though, just not pictured).

Basically, larger resistors have larger voltage drops across them and smaller resistors have smaller voltage drops across them.

So look at the schematic on the left. Instead of the 47kΩ resistor, it has a 10Ω resistor. 10Ω is obviously significantly smaller than 47kΩ. Notice that when the photo-transistor is off, the voltage at node A (which is the voltage drop across the 10Ω resistor) is only 0.0006V, basically nothing. Even when the photo-transistor turns on, the voltage only increases to 0.0045V, still basically nothing. This is because the 10Ω resistor is so small, it will hardly have any voltage drop across it.

Look at the center schematic now. This one has the original 47kΩ resistor. Notice now that the voltage at node B is 0.817V when the photo-transistor is off and 8.24V when the photo-transistor is on. This is a great range! If you looked at the original schematic in the Instructable, remember that the LEDs anode is connected at what is labeled node B. So the LED "sees" this voltage too. The LED remains off at 0.817V, but would definitely turn on by 8.24V. So by having this voltage range, the LED is off when the photo-transistor is off. Then when an object moves over and turns on the photo-transistor, the LED turns on too.

Just to further explain how pull-down resistors work, look at the schematic on the right. This one has a 10MΩ resistor (this is a huge resistance). Since this resistor is so big, almost all of the voltage applied to the circuit drops across the 10MΩ resistor. You can see that the voltage at node C is 8.24V when the photo-transistor is off and 8.32V when the photo-transistor is on. Since the LED sees this voltage too, the LED would always be on regardless of if the photo-transistor is on or off.

So that's why I chose 47kΩ. If it were too small, the LED would never receive enough voltage to turn on. If it were too large, the LED would get too much voltage and always be on.

Finally, why are these referred to as pull-down resistors? Notice at the top of each schematic there is 9V from the battery. In the schematic on the left, the 10Ω resistor is very small and so there's not much voltage at our node of interest. But as we increase the resistance (to 47kΩ or 10MΩ) the voltage at our node of interest increases. So you can think of the larger resistors as "pulling" the voltage "down" to the node of interest.

I hope that makes sense! Please feel free to ask any other questions and thank you for your interest.

Ben Finio3 months ago

This is really cool! One question on wording: technically these are "proximity sensing" and not "motion sensing", correct? Meaning, if you hold an object directly in front of one "cluster", the LED will stay on - the object doesn't have to be moving. This is different from a passive infrared (PIR) sensor, also referred to as a "motion sensor", which will only detect movement.

Will_W_76 (author)  Ben Finio3 months ago

You're absolutely correct! Thanks for catching that. I'll fix it right now.

kenyer3 months ago

I tried to create this effect by using just LED's and an Arduino. But I didn't succeed. (http://www.instructables.com/id/Better-LED-as-light-sensor/) So I really like your Ible!!!

sjowett3 months ago

A nice instructable. The instructions are concise and clear. I think I will have to give it a go sometime.!

 1-40 of 45 Next »