0
\$\begingroup\$

Edit, answer: I managed to figure it out with help from passerby's answer. I needed a pull down resistor for the PNP transistor. Here's the final schematic:

final schematic

When the beam of the photo interrupter is unbroken, the LEDs are off, and when you break the beam the LEDs come on.


Original question:

I'm making a money checker, to check for the existence of a security strip in US bills. My project will use UV LEDs, but for the sake of brevity here I'll just call them lights.

Basically, I'd like to build a circuit, without a microcontroller, that turns on the lights when the beam from the photo interrupter is broken. My understanding of them is that the IR detector is a phototransistor which allows current to flow when exposed to IR light, and blocks it when not. Could I use the output of the phototransistor into the base of a PNP transistor to turn on the lights? Again, my understanding is that with a PNP transistor, current at the base blocks current through the connector-emitter, so I could put my lights in series with C-E of the PNP, and the base of the PNP to the C-E of the phototransistor, right? The idea is that when I place a bill in the slot of the photo interrupter, the lights will turn on, and when I remove it they'll turn off. If I've figured this right in my head I shouldn't need much more than what I've mentioned plus a few resistors, right?

I'm on a phone right now, and I don't have internet at home, so I can't make a schematic.

Edit: I'm not sure how I could make what I'm asking any clearer. I want to turn on some LEDs when the beam of a photo interrupter is broken, without using a microcontroller, all of which I stated in my original text... Here's a picture of a hand-drawn schematic...

schematic

I've calculated that with a 3.2Vf drop across the UV LEDs, and 12 in parallel (I know I messed that up in my schematic), I'd need a 5.416 ohm resistor to get 20mA each. If I up the resistance to 10 ohms, I'd get a bit over 10mA each and have 169mW dissipated in the resistor. The 180 ohm resistor is to limit the current of the 1.2Vf IR LED in the photo interrupter to a little less than 20mA. The only thing I'm unsure about is the pull up resistor.

\$\endgroup\$

closed as unclear what you're asking by Olin Lathrop, Enric Blanco, laptop2d, Dave Tweed May 2 '17 at 21:53

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ Show a schematic. If you're not able to post one, then you shouldn't have posted the question in the first place. You being on a phone is not our problem, and doesn't make the hand waving any easier to understand. \$\endgroup\$ – Olin Lathrop May 2 '17 at 19:53
  • 1
    \$\begingroup\$ That's kinda rude. I don't have internet at home, where my computer is, I'm forced to go to public wifi to research and ask questions, and I'm pretty sure I explained everything in pretty good detail to get a picture of what I'm planning. \$\endgroup\$ – HaLo2FrEeEk May 2 '17 at 19:55
  • 1
    \$\begingroup\$ Also I'm in the planning and learning stage, not the actual building stage. I'm clarifying theory, not asking anyone to proofread any type of existing schematic. I don't have a schematic yet, and I can't until I confirm the theory. I don't have hundreds of components lying around that I can risk ruining by actual tests, so I'd like to make sure my idea is right before I actually build anything. \$\endgroup\$ – HaLo2FrEeEk May 2 '17 at 19:58
  • \$\begingroup\$ None of that changes that your hand waving is difficult to understand. Also, we don't know what internet access you really have or not have. Remember, the world judges results, not stated intentions. \$\endgroup\$ – Olin Lathrop May 2 '17 at 19:58
  • 1
    \$\begingroup\$ You only know what I tell you, and my question to you is why would I say that I don't have the ability to make a schematic right now if I did? You're basically saying that my desire to learn about something by asking questions is invalid because you couldn't understand words instead of pictures. A nicer way to say it might have been "it would be a lot easier to understand what you're trying to accomplish if you could post a basic schematic." Obviously the other people who answered had little issue understanding my "hand waving." \$\endgroup\$ – HaLo2FrEeEk May 2 '17 at 20:02
1
\$\begingroup\$

Basically yes. An opto sensor like an IR encoder works exactly like you think, but your wiring may change. Also, a dollar bill is fairly see through so it may not work.

enter image description here

\$\endgroup\$
  • 1
    \$\begingroup\$ I was thinking while typing this up that I was going to need a pull up resistor on the output of the phototransistor, that's fine. Since it will all be driven off of 4.5 volts (3 AAA's) that issue of the PNP won't exist. Other than that it looks like my theory at least is right. I'll do some tests once I get home. I can simulate high and low signals into a PNP base and test how it responds. \$\endgroup\$ – HaLo2FrEeEk May 2 '17 at 19:50
  • \$\begingroup\$ Am I correct in assuming that I'll need both the pull up resistor, and a base resistor? \$\endgroup\$ – HaLo2FrEeEk May 2 '17 at 19:52
  • 1
    \$\begingroup\$ I've updated my question with a (hand drawn) schematic and some additional details. I'm unsure about the pull up resistor, could you tell me if I've got this right? \$\endgroup\$ – HaLo2FrEeEk May 3 '17 at 0:08
  • \$\begingroup\$ @halo2freeek I'm glad you got it working. Your layout is perfect. \$\endgroup\$ – Passerby May 4 '17 at 0:36
0
\$\begingroup\$

What it seems you want to do is possible, although it's not clear how exactly you proposed to hook things up.

Keep in mind that the phototransistor in the opto-interruptor will go off when the light is blocked. You need to invert that if you want to turn something on when the beam is interrupted.

Updated to schematic

Here is the schematic you have now finally shown:

No, that won't work. This also illustrates why it's essential to show a schematic instead of a vague verbal description.

As I warned you above, the phototransistor in the opto will be off when the beam is interrupted. That means it's effectively not there, and the base of the PNP (next time draw the schematic right, including component designators) will be held high by the pullup resistor. That means the PNP will be off, and the LEDs will be off.

You can fix this problem by replacing the PNP with a NPN. Emitter to ground, collector to the LEDs, and base connected as you have now. Now this transistor will turn on when just the pullup resistor is applied to its base. When the opto is on, the phototransistor will hold the base low, preventing the transistor from turning on despite the pullup resistor.

Another problem is that 12 LEDs in series need a lot more than 4.5 V. The lowest voltage visible LEDs are red, with about 1.8 V drop when lit. 12 of those require nearly 22 V to light.

To fix this, you can use fewer LEDs or connect them in parallel. If you connect them in parallel, each should have their own current-limiting resistor.

For example, let's say you want to light 12 green LEDs. Those usually have a drop of about 2.1 V when lit. Figure the (now NPN) transistor will drop about 200 mV when on. That leaves 4.3 V for the LEDs and resistors.

You could put two LEDs and a resistor in series, then six of those assemblies in parallel. At 2.1 V per LED, two drop 4.2. That leaves only 100 mV for the resistor. Let's say you are aiming at 20 mA LED current. That means the resistor would need to be (100 mV)/(20 mA) = 5 Ω. However, that leaves very little slop for part variation and to ensure no maximum is exceeded. Start with 10 Ω and see what you get. If you use a LED color with lower drop, then there is more voltage left for the resistor to regulate the current better.

Yet another problem is the current required by the LEDs. With six strings of LEDs, and let's say 20 mA per string, that means the transistor has to be able to pass 120 mA. A small signal transistor can do that, but you need to feed it enough base current. Let's say you use a transistor with a guaranteed minimum gain of 50 at this operating point. That's not hard to find. That means it needs at least (120 mA)/50 = 2.4 mA base current. Figure the B-E drop is 700 mV. You are starting with a 4.5 V supply, so that leaves 3.8 V across the pullup resistor when the LEDs are supposed to be on. (3.8 V)/(2.4 mA) = 1.6 kΩ. That's the absolute maximum pullup resistor you can use given these example values. You want to make sure the transistor is really in saturation, so a 1 kΩ pullup would be a good value.

Now you have yet another problem, which is to make sure that the opto output can sink the pullup current when on. With a 1 kΩ pullup and figure 200 mV saturation drop for the optotransistor, it must sink (4.3 V)/(1 kΩ) = 4.3 mA. Check the datasheet to make sure the opto can drive that. If not, you need a different overall circuit topology, or relax some of the other constraints. One obvious constraint to relax is the number of LEDs you have to drive.

Revised schematic

You have now revised the schematic to:

This won't work as you intend. This version does not fix several problems pointed out with the previous version, both the circuit and the schematic. See above.

\$\endgroup\$
  • \$\begingroup\$ That's what the PNP transistor will be for. The phototransistor output will go to the base of a PNP transistor. When the light is blocked the phototransistor will effectively bring that base current lower than the emitter of the PNP, allowing current to flow through to the LEDs. \$\endgroup\$ – HaLo2FrEeEk May 2 '17 at 19:54
  • \$\begingroup\$ I've updated the question with a schematic. \$\endgroup\$ – HaLo2FrEeEk May 3 '17 at 0:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.