Shop OBEX P1 Docs P2 Docs Learn Events
IR phototransistor how to? — Parallax Forums

IR phototransistor how to?

CrosswindsCrosswinds Posts: 182
edited 2010-01-07 23:37 in Propeller 1
Hello guys!

Maybe some of you have seen my thread about the slotcar laptimer.

I think i want to use IR sender and reciever instead. it seems much more reliable.


My question is just, since im not very familliar with transistors, how do i use this with the propeller? What components is needed besides a reciever and sender?


and· maybe some codeexamples would be nice and helpful to get me started [noparse]:)[/noparse]

It will be no advanced code for this, since im not decoding a "message" i just want to know if it sees any beam or not! its almost like a 1 and 0 thing!

And i guess its another approach to this than with a photoresistor, that i need to use a capacitor, charge it and measure the time it takes for it to drain.

I was hoping that this would be more "fool-proof" with the lighting and all.

Thank you!



·

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2010-01-07 00:26
    Why do you need a capacitor for a photoresistor? Just use another resistor to make it a voltage divider. Put the photoresistor in a small black tube and use a laser pointer LED to light the photoresistor and you will get a reliable 1 and 0 thing [noparse]:o[/noparse])
  • w8anw8an Posts: 176
    edited 2010-01-07 01:35
    Something as simple as this should do, Crosswinds.

    When there is light showing on the phototransistor, the pin will be pulled low. When a car interrupts the beam of light, the transistor will stop conducting and the pin will be pulled HIGH.

    Steve
    256 x 199 - 4K
  • SamMishalSamMishal Posts: 468
    edited 2010-01-07 03:01
    Crosswinds,

    Just a simple IR LED with an IR-transistor can work but it is not a very good system
    since you will get different responses under different lighting conditions (e.g. well lit,
    sunlight, dark, shade, incandescent light, fluorescent light etc. etc.). Also stray IR
    can affect it.

    A better way is to use a MODULATED IR-LED with a Filtered IR-Receiver.

    In the Propeller Education Kit manual (page 148) there is an experiment that uses these two
    components and shows how to do all this...is does distance measurement...but you can adapt
    it EASILY to just on/off.

    I have included links to all the stuff you need in the above paragraphs...just click on them
    to see all the equipment you need....of course in addition to the Propeller and some board for
    experimenting and programming...I suggest the Propeller Professional Development Board (PPDB),
    but also the Propeller Demo Board (PDB)·would do just fine....I have both and use BOTH all the time.






    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Samuel

    www.RobotBASIC.com
    ·
  • CrosswindsCrosswinds Posts: 182
    edited 2010-01-07 23:24
    SamMishal;

    Thank you very much for your effort in that great response [noparse]:)[/noparse] That solved my whole problem!

    I should be able to just use is as object detection, just as in the first code example in the book!

    The components are really cheap also.

    The reciever will be mounted underneat the table with a 5mm hole straight up, and over the lanes there will be 4 separate IR-LEDs on a bridge.

    I think this will be a good setup, and they should not be able to disturb eachother, since they are mounted so low in the table!

    Thanks again, it helped me alot!


    and w8an &magIO2·thanks for your schematics and information! [noparse]:)[/noparse]
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-01-07 23:37
    There seemsto be some ambiguitity about the Photo(transistor) and Photo(resistor) the (transistor) is quick and as shown operational, the (resistor) option will work but the response time of cadmium sulphide is extreeeeeeeeeeeeemly slow.

    Not so usefulfor the racing cars, but ok for the racing trains.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
Sign In or Register to comment.