IR phototransistor how to?
Crosswinds
Posts: 182
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!
·
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
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
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
·
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]
Not so usefulfor the racing cars, but ok for the racing trains.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Style and grace : Nil point