[TriEmbed] Raspberry Pi & Object Detection
Pete Soper
pete at soper.us
Mon Oct 7 15:42:26 CDT 2013
Hi Brian,
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:
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.
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.
-Pete
On 10/07/2013 03:55 PM, Grawburg wrote:
> 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
> TriEmbed at triembed.org
> http://mail.triembed.org/mailman/listinfo/triembed_triembed.org
> TriEmbed web site: http://TriEmbed.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20131007/99a0df1b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: igiafagc.jpeg
Type: image/jpeg
Size: 2423 bytes
Desc: not available
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20131007/99a0df1b/attachment.jpeg>
More information about the TriEmbed
mailing list