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!

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.


<p>When i built the circut I got the opposite effect... the led would be on then turn off when the sensor was covered...</p>
<p>Depending on the specific photo-transistor you are using, the LED can turn on because of the photo-transistors response to light in your environment (sunlight or even fluorescent or incandescent light). What is likely happening is that these other light sources are &quot;turning on&quot; your circuit. Then when you cover it, the photo-transistor no longer sees the external light and turns off. Additionally, it appears that the light emitted from your IR LED is not the proper wavelength (or your IR LED is not on). Otherwise, the LED would remain on when covering the sensor. Verify your IR LED is actually on, and also make sure it emits the wavelength of light that the photo-transistor is best set to receive. Lastly, eliminate the source of external light that is currently turning the circuit on. If it's something else, you can let me know.</p>
Hi thanks for the response! Turns out I was using a photo cell not a transistor so it was looking for all light. From what you were saying that seems like it could have effected the out come.<br>Thanks again!
<p>Using a 12V battery should be fine. You will just want to double-check that each of your components can withstand the voltage and current they will experience. You can find this information in the datasheet for each component. If it looks like there may be an issue, you can increase the 220&Omega; resistors (the current-limiting resistors) to a value that will ensure a safe level of operation.</p>
Oh also I was wondering if there was a way to modify this circuit so it could use a 12v battery as a power source<br>
<p>If i do this larger scale, say for a 2' x 3' table. Is it possible to solder each individual &quot;part&quot; together according to your circuit diagram (with the &quot;part&quot; being one complete iteration of the diagram itself)? From here connect all of the ground ends together and then running it as a single unit into the ground of an arduino, and the same for the power ends. the only thing i can't wrap my head around is how the resistors would still work the same</p>
<p>Yes, that can be done. The main thing you would want to verify is how much current you are using though. With each &quot;cluster&quot; you are adding additional current to your circuit. Soldering together individual clusters that share a ground and power line is fine, there would be no reason the resistors wouldn't work the same way (as long as they were wired properly in their individual portion).</p>
This is your scratch right? <br>If yes then can I use 12v or 5v instate of 9v. If I can what OHM or Kohm resister I need. Thanks
<p>Since the &quot;clusters&quot; are all connected in parallel, you only need enough voltage to get across one LED, usually around 2V. The concern would be whether or not your battery can supply enough current for the number of clusters you include. To answer your question, yes, 5V and 12V will both work.</p><p>In regards to your question about resistors, this is more dependent on the other components of the circuit (the LED, photo-transistor, IR LED) than it is on the power supply. I would suggest choosing your power supply and components, then experimenting with a variety of resistance values.</p><p>Also, just want to give you a heads up, the way you drew the blue LED in your picture is backwards. The anode (positive side) of the LED should be connected to the junction of the 47k&Omega; and the emitter of the photo-transistor. This is because the LED receives power from the emitter of the photo-transistor. </p>
Hello <br>I really like your projact and I would like to make one for myself. I tryed to make one but it wasn't work!! Can you clear me the connection that you did. I saw your picture but it's not clear to me . If you help me then I can make one like your. Thanks
<p>Which connection are you having trouble with? </p><p>Without knowing more specifically, I can only suggest that you verify your LEDs have the correct orientation. Also, verify that your IR LED is functioning by looking at it through a camera, and make sure it outputs the same wavelength of light as your photo-transistor is set to receive.</p>
<p>Hi, thanks for posting a fun project. I built my first cluster and it works in the dark, but my detector seems to be picking up visible light waves too, so LED stays lit with the lights on. I used a 940 nm detector and receiver (it was what I had). Is this common, or is just a bad part. Thanks, Jayne</p>
<p>Sorry for the late response. This can be a common issue. It of course depends on the wavelength of light that you could be getting from various sources (sunlight through a widow, incandescent bulbs, fluorescent bulbs, etc.) I would recommend determining what wavelength of light is in your environment and then finding a phototransistor configured for a different wavelength so the light for the environment won't turn it on. (You will also need to get a different valued IR LED to match this new phototransistor. </p>
<p>Hello, I would like to firstly say that that this project looks really awesome however I'm at the very start of it... I was thinking of doing a simulation of it on a computer based software such as Yenka or Proteus to get a feel of how it works and so that I can mess about with it a bit before I order the required components, unfortunately I don't think Its possible to carry this out on a PC based simulation software because I cant make a link between the photo-transistor and the IR LED.</p><p>Have you got any suggestions or do you know of a way to do this / a work around from using the link between the photo-transistor and the IR LED just for simulation purposes ? </p><p>Thanks in advance! :)</p>
<p>I figured it out, you need to use a switch acting as the IR LED and then use a NPN transistor for the photo-transistor. Connect the output of the switch to the base of the NPN transistor. When the switch is pressed the current will flow to the base of the transistor and so making the LED light up.</p>
<p>Yup! That's what I would have suggested. I apologize that I took a couple days to respond. I haven't had much time for Instructables lately. I'm glad you found the solution though! Let me know if you have any other questions.</p>
<p>Haha no problem pal, however unfortunately for you I've got another question which I'm hoping you'll be able to assist me with ... I'm thinking of adding a 555 timer to the circuit so that the LED would flash (I will be putting this at the emitter of the photo-transistor and so replacing the position of the LED which is in your circuit) but I also need to make a timing delay circuit of some sort so that the LED will remain on for a few seconds after the object has been removed from the IR LED. I was first considering using a capacitor however when I've looked into it the capacitor needs time to charge up and so wont allow enough time for the LED to stay on for a longer duration... </p><p>Basically, Is there another way of making the LED stay on for longer ? </p><p>And am I right in saying that the capacitor wont work because it needs enough time to store the power ? </p>
<p>Actually, a capacitor would work. You should configure the circuit such that when an object is nearby (so the LEDs are on), that the LED can be on while the capacitor is charging. Then when the objects &quot;leaves&quot; and the photo-transistor is no longer gated, the LED will get its power from the capacitor. <br><br>You are right that the capacitor needs some time to charge. This is determined by what's called the &quot;time constant&quot;. A shorter time constant means faster charging. Such that, in a circuit with a low time constant, the capacitor will charge quickly. Keep in mind, this means it also will discharge quickly. So play around with different capacitor values and you should be able to find one that charges quick enough, but keeps the LED on for a decent time. <br><br>As far as using a 555 timer to make it flash, you want to implement an oscillator. The output of this oscillator will go to the LED. The &quot;enable&quot; pin of the 555 timer should be connected to the emitter of the photo-transistor so the oscillator only operates when an object is nearby. Off the top of my head, I think a &quot;relaxation oscillator&quot; would probably be a good implementation for this application. If you need some more specific details or any help with this part, let me know. </p>
<p>Sorry to be a bother but I've been playing around with the circuit for quite some time now and I cant get it to work. I have attached 2 photos of different configurations to the circuit. The aim is still to make the LED slowly discharge ... The circuit with the variable resistor in works fine however it has a silly amount of current flowing through the transistor (about 1 Amp!!) and when I've had a look to see photo-transistor maximum current rating they are about 20mA, meaning it will blow. </p><p>The second diagram with the square rectangle shape to it doesn't seem to work either as the LED is very dim and it doesn't discharge. </p><p>I would really appreciate any advice on what alterations / ways I could make this work. </p><p>Many Thanks</p>
<p>Just a bit of an update to this issue is that I've changed the circuit a bit and it partially works however to make it work even better I need the phototransistor to have a higher max current rating (when looking at the datasheet the max collector current isn't available however 16mA is an average, I've had a look around for other phototransistors with a higher collector current rating however most of them are 3 pin and some are side on detectors). <br><br>I need the phototransistor to have a higher max current rating so that the capacitor can quickly charge up and then slowly discharge (so I need a high current to flow through the phototransistor to allow faster charging). I'll try to attach a photo of the circuit if you need it. But can you advise what components I should use ? or give any type of support to make it better ?<br><br>Thanks </p>
<p>WOW! Thanks for your quick reply, I'll have a look into this later on and let you know of any other queries and questions! </p>
<p>I'm really new to electronics and I mean REALLY NEW so be gentle. I would like to make a circuit that shows when there is mail in my mailbox and think this would be good. The detector can show when anything has been put in the box by lighting the led but I would then also like it to stay on until reset. Do you have any ideas or am I taking on too big a task for a newbie?</p><p>Thanks</p>
<p>I think a circuit using phototransistors etc is probably overkill for what you want, a simple circuit whereby the weight of the mail closes a contact which then completes the circuit to light an LED would be best for what you want</p>
<p>Thanks Wimboosh... while I think you're right I am also a gadget fanatic so would like some thing special. I have a circuit that turns an led on when the circuit is made and off again when is made again but wanted to keep it on until re-set and turned on when anything is put into the box and thought the ir would be the bees knees. If you or anyone could tell me what I need and how to put it together I would be extremely grateful.</p>
<p>I never say any task is too big. At the very least, you'll learn something new. But I think the lighting mailbox would be quite simple actually, and this circuit would work for such a thing. You could use this circuit exactly as explained in this Instructable, but I think the hardest part will just be sizing it and laying it out in the mailbox, the construction of the whole thing. Off the top of my head, I'm thinking that somehow mounting the IR LED/phototransistor to the top of the inside of the mailbox. The LEDs that would turn on would come out of the back of the mailbox, so you could see them from your house. I would place the power source just in the mailbox towards the back. But of course there are a thousand different ways you could do it. Hopefully this helps you get started. If you have anymore questions, particularly about the circuitry, go right ahead!</p>
<p>Would you be so kind as to share the photo transistor code/number/spec...My electronics shop would like to know since they not sure the one they have will work on this circuit. Also please advise (as I percive these to be individual circuits linked together) If I wanted to connect 4 LEDs per circuit what would I need to change as each LED would introduce some resistance...</p>
<p>The part number for the photo-transistor is <a href="http://www.digikey.com/product-detail/en/QSD124/QSD124-ND/187446" rel="nofollow">QSD124-ND</a>.<br><br>Since the &quot;clusters&quot; of LEDs, IR LEDs, and photo-transistors are in parallel, adding more clusters actually <em>decreases</em> the overall resistance of the circuit. You don't so much need to worry about the resistance added by each LED/cluster. Your concern would be current. The more clusters you have, the more current that will draw from the battery. So just make sure your battery has the capability to supply enough current for the number of LEDs you want. This shouldn't be a problem with just 4. That's a very small current demand.</p>
<p>Unless, perhaps, you meant 4 LEDs per cluster? As in 4 LEDs turn on when a single photo-transistor is triggered. In that case, you need to ensure that you have enough voltage to power on all 4 of the LEDs (which I'm assuming would be connected in series for such a setup). Generally each LED would require about a 2V drop. That being said, for 4 LEDs, you would need to have about 8V elivered to the LEDs when the photo-transistor is triggered. The configuration I show in my Instructable would just barely be able to do this with the 9V battery I used.</p>
<p>Thanks for your timely response. I was thinking of using a power supply for this project(trying to avoid having to charge the battery). What voltage would you recommend should be using approximately 150 regular LEDs. Just to confim, the resistors used do not change per cluster,correct? I need to get my figures in order.</p>
<p>5V would be sufficient. Remember, these clusters are connected in <em>parallel</em>. So each cluster has the same voltage drop across it. If you have a 5V power supply, each cluster has 5V across it. If you have a 9V power supply (like I used), each cluster has 9V across it. The big thing to keep in mind is current. 150 clusters could quickly add up to a lot of current. <br><br>Check the data sheets for each of your parts, especially the IR LEDs and regular LEDs. Determine how much current each cluster draws and then multiple that by 150. <br><br>Safety becomes <em>very</em> important when you are dealing with high current projects. Make sure to do the research and calculations before putting it together and plugging it in. And make sure you have the right kind of equipment to handle the current, like a surge protector and a proper power supply. <br><br>This much current is possible to handle and handle safely. Another project that some other interns made where I used to work was an array of 900 LEDs that required 45A of current. Like I said, just make sure you have the right equipment.<br></p><p>If you are unable to safely power all 150 LEDs from one power supply, you could divide the circuit into smaller groups. For example, you could put together 5 groups of 30 clusters and use 5 different power supplies. And then tile them all together (depending on what your circuit is mounted to).</p>
my transistor has 3 pins how am I supposed to connect it <br>I left the base pin out and connected both the emitter and collector as shown but its not working
also the resistor connected to the IR led gets really hot
<p>Do you have a part number for the photo-transistor you are using? Generally photo-transistors only have 2 pins (a collector and emitter) because the photodiode acts as the base. If you have a part number, I could take a look at the datasheet and determine the best way to connect your specific transistor for this circuit. My first guess is that the base pin may need to be grounded through a resistor. </p><p>In regards to your resistor getting hot, I am guessing it might be from your battery. I also used a 9V battery for this project, but it was a common household one. Yours is listed as &quot;hi-watt&quot;. While our batteries are the same voltage, yours may be outputting more current (and power). More power, of course, means more heat. I would suggest using a lower power household battery. My project even worked successfully with four standard 1.5V AA batteries</p>
The phototransitor that I'm using is l14f1 also I tried your suggestion of grounding the base through a resistor but its not working either.<br>I tried searching for the phototransitor with two pins in different shops but all of them give me the same one that I'm using. Could you give me the part number of the one that you are using??<br><br>also about the resistor heating can I just increase the resistor value rather than replacing the battery?<br><br>I'm new to this field plzz help with it, I need to submit this as a project on 9th September.
<p>In regards to the resistor heating, yes, you can increase the resistor value. In accordance with Ohm's law, this would decrease current. Thus, the resistor would be less likely to overheat. HOWEVER, if you increase the resistance too much, you will not get a high enough voltage at the IR LED for it to turn on. Depending on the characteristics of your LED, you should be able to find an ideal resistance value that limits the current without dimming your LED. Using a voltmeter would be helpful here. If you increase the resistance and still have the same problem, you will need to use a different battery.</p><p>The part number of the photo-transistor I used was <a href="http://www.digikey.com/product-detail/en/QSD124/QSD124-ND/187446" rel="nofollow">QSD124-ND</a>. The datasheet you provided for the transistor you are using did not explicitly say how to connect the best pin. A schematic for a test circuit though shows that the base should be receiving light (as is the standard with photo-transistors). If I had this part myself, I could try some things myself. Since I don't have this specific part, I can try to help you run the proper diagnostics to figure out how we need to get it connected. First, do you have a voltmeter?</p>
<p>I have a multimeter </p>
<p>I apologize for such a long delay in getting back to you. If you still require assistance with the project, please let me know where you're at right now. I would be happy to help and I should have time or the next week or so to continue replying.</p>
<p>Hi, i love this project, this is something i wanted to do badly but didn't know how to. I'm new to electronics. i made the circuit as you explained. but its not working. i tried to troubleshoot as you have explained. my ir led is not working at all. i tried changing ir-led and photo transistors but can't get this done. i removed my ir-led and put a normal led and it light up, but ir-led does not work. can you please help me. i have attached a photo of my cluster. </p>
<p>Hello, <br><br>It appears that you got your IR LED and photo-transistor mixed up. The IR LED should be on its own side with the 220&Omega; resistor. The photo-transistor should be connected to the LED. Refer to Step 1 again. Hopefully this helps. Let me know if you have anymore questions!</p>
<p>Hi,</p><p>thank you so much for the fast respond and also sharing knowledge, i got these IR LED's and PHOTO-TRANSISTORS from a electronic shop. it is the dark blue one is the correct IR LED, today i found that i can't see it from my phone, but i could see it from another phone. so my IR LED is working fine. but still i can get the LED on. i changed the pulldown transistor to 68K but still not working. can you please help with this.</p>
<p>Do you know the wavelength of light that your photo-transistor is designed to receive? And is it the same as the wavelength your IR LED emits?<br>For determining a resistor values, please refer to my response to SuperPollo's question below. I provide a very detailed explanation there on how to choose a proper resistance value.</p>
<p>Hi! I love your design, it's awesome! I've made it for an engineering project for college. I just have a couple of questions. Could I use capacitors to extend the amount of time that the LED remains on for once I remove my hand from near the circuit? And if so, how could I integrate this into the circuit itself (i.e. where could I attach the capacitors)? Great tutorial, thanks for posting it!</p>
<p>Yes, that would work! The capacitor should be connected at the anode of the LED in that scenario.</p>
<p>Thank you very much for sharing this, im new in instrucables :D</p><p>i have trouble here, why my led dim when i put my hand close to the clusters ?</p>
<p>That could be caused by a variety of things. First, what are you using as a power source? If you are using batteries, what batteries and what voltage are you using?</p><p>Second, it could be that your photo-transistor is not configured for the same wavelength of light that your IR LEDs emit. Make sure those are the same. My IR LED emits 880nm light, which is what my photo-transistor is configured to receive. </p><p>Another possible issue could arise from the resistor values you are using. Are you using the same values I am? Maybe check some of my responses to other users below about how to pick the right resistor values.</p><p>If none of these are helpful, post a picture or schematic of your circuit. I'll check it out and see if I can find the problem.</p>
Thank you for your fast respond :D<br><br>Since im new in electronic i dont know what kind of wavelengh of my ir or phototransistor, my phototransistor is transparent colour, unlike your black<br><br>Im using 9v batt, im planning to use 12vbatt<br><br>My resistor are 47k and 220
<p>Could you show me a picture of your circuit?</p>
<p>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 &iquest;? And what's a pull-down resistor?</p>
<p>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.</p><p>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).</p><p>Basically, larger resistors have larger voltage drops across them and smaller resistors have smaller voltage drops across them.</p><p>So look at the schematic on the left. Instead of the 47k&Omega; resistor, it has a 10&Omega; resistor. 10&Omega; is obviously significantly smaller than 47k&Omega;. Notice that when the photo-transistor is off, the voltage at node A (which is the voltage drop across the 10&Omega; 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&Omega; resistor is so small, it will hardly have any voltage drop across it.</p><p>Look at the center schematic now. This one has the original 47k&Omega; 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 &quot;sees&quot; 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.</p><p>Just to further explain how pull-down resistors work, look at the schematic on the right. This one has a 10M&Omega; 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&Omega; 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.</p><p>So that's why I chose 47k&Omega;. 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.</p><p>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&Omega; resistor is very small and so there's not much voltage at our node of interest. But as we increase the resistance (to 47k&Omega; or 10M&Omega;) the voltage at our node of interest increases. So you can think of the larger resistors as &quot;pulling&quot; the voltage &quot;down&quot; to the node of interest.</p><p>I hope that makes sense! Please feel free to ask any other questions and thank you for your interest.</p>

About This Instructable




More by Will_W_76:Pumpkin Power! - Battery Made From Pumpkins 3D Printed Microcontroller Dice Roller PCB Design in EAGLE 
Add instructable to: