<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Brian,<br>
         I assume you meant an IR phototransistor. The IR LED would be
      what puts the IR light out. The IR phototransistor is just a
      transistor with light instead of a base (simple transistors have
      base, emitter, and collector, but a phototransistor just has two
      leads for the latter two connections). So when light of the right
      frequency and intensity hits the phototransistor the resistance
      between collector and emitter goes from a very high value to a
      very low value. The easy-peasy way to tie an NPN phototransistor
      to a Raspberry Pi is like this:<br>
      <img src="cid:part1.07000009.07080805@soper.us" alt=""><br>
       <br>
      <br>
      I suggest 3 or 3.3 for Vcc (do NOT exceed 3.6v with a Raspberry
      Pi) and 4.7k ohms for Rc/Re. The circuit Vout is logic HIGH when
      the phototransistor is dark and very close to ground or LOW when
      it is lit. So Vout would go to one of the gpio pins of the
      Raspberry Pi and you'd sample that with your Python code to
      determine whether the light is shining on the detector (LOW), or
      something has interrupted the beam (HIGH). Using IR will help with
      false triggering from room light, sunlight, etc. You might need to
      put a rolled up piece of paper or something around the detector to
      block light coming in from the side. <br>
      <br>
      The top connection of both transistors is the collector and the
      bottom with the arrow pointing outward is the emitter. Pointing
      out indicates an NPN type transistor. If the schematic for your
      phototransistor points toward the vertical bar then it's a PNP and
      a different setup is needed. <br>
      <br>
      -Pete<br>
      <br>
      On 10/07/2013 03:55 PM, Grawburg wrote:<br>
    </div>
    <blockquote cite="mid:4905541f6e9e91a7a08d533657448165@myglnc.com"
      type="cite">
      <pre wrap="">I'm working on a project to demonstrate how a basic conveyor system can separate
different size objects by using some HO train cars and electric turn-out switches.

The intention is to have a detector, either a visible light photocell arrangment using
LEDs or an infrared LED emitter/receiver.  The turn-out switch will be isolated from
the Pi with a relay.

I know the photocell will give me a basic ON-OFF (high-low), but what does the IR
LED give?  I will have a timer loop in my Python code that instructs the switch to remain
in the diverted position for x-seconds and then return to the default position.


Brian Grawburg
Wilson 




_______________________________________________
Triangle, NC Embedded Computing mailing list
<a class="moz-txt-link-abbreviated" href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a>
<a class="moz-txt-link-freetext" href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a>
TriEmbed web site: <a class="moz-txt-link-freetext" href="http://TriEmbed.org">http://TriEmbed.org</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>