Introduction: Proximity-Sensing LEDs

Picture of 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!

Step 1: Introduction to the Circuit

Picture of 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.

Step 2: Gather the Materials

Picture of Gather the Materials

This circuit consists of "clusters" that are in parallel. Since the clusters are in parallel, this means you can add as many as you want without the LEDs getting any dimmer! You could have 1000 clusters if you wanted to and every LED would be just as bright! (Your battery wouldn't last very long though.) For my implementation I used 24.

For each cluster you will need:

  • Photo-transistor
  • IR LED
  • LED of any color
  • 2 x 220Ω resistors
  • 47kΩ resistor
  • A couple small wires

Note: Photo-transistors and IR LEDs are available at different wavelengths. You don't have to use 880nm as I mentioned in the previous step. For best results though, use photo-transistors that are made to respond best to the wavelength that your IR LEDs emit.

For the rest of the circuit you will also need:

  • A breadboard (I'm using 3. Use as many as you like!)
  • A power source and connector (not pictured)

For a power source I'm using a 9V battery because I had one at my desk already. You have a lot of other options here though such as a 6V lantern battery or 4 AA batteries.

Step 3: Connect Power Rails

Picture of Connect Power Rails

I like to start by getting all of my power and ground rails connected. Just as you can see in the picture above I connected all of my positive (red) rails and negative (blue) rails. I also plugged in my battery connector, but I'm leaving the battery out until the end so there's no current through the circuit while I'm building it.

Step 4: Build the First Cluster!

Picture of Build the First Cluster!

I prefer to start with building one cluster to test my design.

Note: Remember that the photo-transistor is not an LED. However, since it looks like an LED I will refer to its pins as anode (+) and cathode (-) for simplicity. I also included an image above that shows how to determine which pin is the anode and which is the cathode. I also included the circuit schematic, an animated breadboard image, and a photo of my circuit for reference.

  1. Connect the "anode" of the photo-transistor to the positive power rail.
  2. Connect the 47kΩ resistor from the cathode of the photo-transistor to ground. This resistor acts as what's called a pull-down resistor. It helps direct the current to where we want it to go.
  3. Also connect the cathode of the photo-transistor to the anode of the blue LED.
  4. Connect the cathode of the blue LED to ground with a 220Ω resistor.
  5. On the other side of the "valley" of the breadboard, connect the anode of the IR LED to the positive rail.
  6. Connect the cathode of the IR LED to ground with a 220Ω resistor.

If you would like, go ahead and connect your power source and test it out!

(If it's not working, see the final step for troubleshooting procedures.)

Step 5: Finish the Other Clusters

Picture of Finish the Other Clusters

Now that you (hopefully) have a working cluster, add as many more as you would like! For me personally, I go faster if I go one component at a time e.g. add all the IR LEDs, then add all the photo-transistors etc. That's just my personal preference. Do what works best for you though. The design for each cluster is the same as how it was covered in the previous step.

I included some pictures of my progress above.

Step 6: Try It Out!

Picture of Try It Out!

Here's a GIF of my circuit in action. Try yours out! You can use just about any object: hands, rulers, books, etc.

Hopefully yours is working at this point, but if not I included some troubleshooting procedures in the next step.

If yours is working though, awesome! Post a GIF of it in the comments below! And feel free to post any comments/questions/suggestions.

One last thing, I mentioned that I originally built this circuit to eventually move it to a PCB so I could learn PCB design/layout. The PCB I made was a success and I'll be making the Instructable documenting my design process very soon! Thanks for checking this out!

Step 7: Troubleshooting

Picture of Troubleshooting

Hopefully you won't need this step, but here it is just in case!

  • If your circuit isn't working, one thing you can check is if the IR LEDs are actually on. Because if we can't see light in the infrared range, how do we know the IR LEDs are actually on? There's a simple way to check this. Simply just connect power and then look at the IR LEDs through a camera (phone cameras work fine). Through a camera they'll look like regular LEDs lighting up. You can see in the picture above that it looks like a regular pink LED, but that's one of my IR LEDs.
  • It's also possible that you're not getting enough voltage at the anode of the LED. This would result from there being too high of a voltage drop across the photo-transistor. To minimize the voltage drop across the photo-transistor, increase the value of the pull-down resistor. By increasing the value of the pull-down resistor, the voltage-drop across the photo-transistor decreases because the internal resistance of the photo-transistor is smaller relative to the larger pull-down resistor. Increase it gradually though because if you put in too large of a resistor, the LED will always be on.

These are the most common issues you would run into with this circuit. If you come across other obstacles though, please comment and I'll get back to you quickly with a solution.


TB20 (author)2016-06-18

When i built the circut I got the opposite effect... the led would be on then turn off when the sensor was covered...

Will_W_76 (author)TB202016-06-19

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 "turning on" 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.

TB20 (author)Will_W_762016-06-19

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.
Thanks again!

Will_W_76 (author)TB202016-06-22

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Ω resistors (the current-limiting resistors) to a value that will ensure a safe level of operation.

TB20 (author)Will_W_762016-06-19

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

DanS214 (author)2016-05-25

If i do this larger scale, say for a 2' x 3' table. Is it possible to solder each individual "part" together according to your circuit diagram (with the "part" 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

Will_W_76 (author)DanS2142016-05-31

Yes, that can be done. The main thing you would want to verify is how much current you are using though. With each "cluster" 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).

IllU1 (author)2016-04-15

This is your scratch right?
If yes then can I use 12v or 5v instate of 9v. If I can what OHM or Kohm resister I need. Thanks

Will_W_76 (author)IllU12016-04-17

Since the "clusters" 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.

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.

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Ω and the emitter of the photo-transistor. This is because the LED receives power from the emitter of the photo-transistor.

IllU1 (author)2016-04-14

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

Will_W_76 (author)IllU12016-04-14

Which connection are you having trouble with?

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.

jkneejones (author)2015-12-31

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

Will_W_76 (author)jkneejones2016-02-02

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.

benojacko98 (author)2015-10-02

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.

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 ?

Thanks in advance! :)

benojacko98 (author)benojacko982015-10-04

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.

Will_W_76 (author)benojacko982015-10-05

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.

benojacko98 (author)Will_W_762015-10-19

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...

Basically, Is there another way of making the LED stay on for longer ?

And am I right in saying that the capacitor wont work because it needs enough time to store the power ?

Will_W_76 (author)benojacko982015-10-20

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 "leaves" and the photo-transistor is no longer gated, the LED will get its power from the capacitor.

You are right that the capacitor needs some time to charge. This is determined by what's called the "time constant". 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.

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 "enable" 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 "relaxation oscillator" 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.

benojacko98 (author)Will_W_762015-10-26

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.

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.

I would really appreciate any advice on what alterations / ways I could make this work.

Many Thanks

benojacko98 (author)benojacko982015-10-28

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).

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 ?


benojacko98 (author)Will_W_762015-10-20

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!

paulmiddlet (author)2015-10-23

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?


wimboosh (author)paulmiddlet2015-10-27

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

paulmiddlet (author)wimboosh2015-10-27

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.

Will_W_76 (author)paulmiddlet2015-10-27

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!

tsietsir (author)2015-10-02

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...

Will_W_76 (author)tsietsir2015-10-04

The part number for the photo-transistor is QSD124-ND.

Since the "clusters" of LEDs, IR LEDs, and photo-transistors are in parallel, adding more clusters actually decreases 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.

Will_W_76 (author)Will_W_762015-10-04

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.

tsietsir (author)Will_W_762015-10-05

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.

Will_W_76 (author)tsietsir2015-10-05

5V would be sufficient. Remember, these clusters are connected in parallel. 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.

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.

Safety becomes very 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.

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.

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).

mjihan96 made it! (author)2015-09-04

my transistor has 3 pins how am I supposed to connect it
I left the base pin out and connected both the emitter and collector as shown but its not working

mjihan96 (author)mjihan962015-09-04

also the resistor connected to the IR led gets really hot

Will_W_76 (author)mjihan962015-09-04

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.

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 "hi-watt". 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

mjihan96 (author)Will_W_762015-09-05

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.
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??

also about the resistor heating can I just increase the resistor value rather than replacing the battery?

I'm new to this field plzz help with it, I need to submit this as a project on 9th September.

mjihan96 (author)mjihan962015-09-05,%20L14F2.pdf

Will_W_76 (author)mjihan962015-09-05

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.

The part number of the photo-transistor I used was QSD124-ND. 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?

mjihan96 (author)Will_W_762015-09-06

I have a multimeter

Will_W_76 (author)mjihan962015-10-05

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.

AmilaR1 (author)2015-08-29

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.

Will_W_76 (author)AmilaR12015-08-29


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Ω 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!

AmilaR1 (author)Will_W_762015-08-30


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.

Will_W_76 (author)AmilaR12015-09-04

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?
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.

Charlottehf98 (author)2015-06-18

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!

Will_W_76 (author)Charlottehf982015-06-23

Yes, that would work! The capacitor should be connected at the anode of the LED in that scenario.

AndreyG1 (author)2015-06-17

Thank you very much for sharing this, im new in instrucables :D

i have trouble here, why my led dim when i put my hand close to the clusters ?

Will_W_76 (author)AndreyG12015-06-17

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?

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.

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.

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.

AndreyG1 (author)Will_W_762015-06-17

Thank you for your fast respond :D

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

Im using 9v batt, im planning to use 12vbatt

My resistor are 47k and 220

Will_W_76 (author)AndreyG12015-06-18

Could you show me a picture of your circuit?

SuperPollo (author)2014-08-22

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)SuperPollo2014-08-22

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.

About This Instructable




More by Will_W_76:Pumpkin Power! - Battery Made From Pumpkins3D Printed Microcontroller Dice RollerPCB Design in EAGLE
Add instructable to: