• Take a look at Photomicrosensor (Transmissive) - Omron EE-SJ5 conversation.

    The difference is 'reflect' vs. 'not interrupt'. the Photomicrosensor (Transmissive) - Omron EE-SJ5 has the receiving phototransistor opposite of the infrared emitting diode. Something (blocking) in between stops the phototransistor from 'conducting' / to switch off, where - in your case - something reflecting will make it to conduct / to switch on.

    Using the analog read is a good idea to measure the amount of reflection... most phototransistors have though a more switching behavior than (linear) amplifying one. I used the analog read to figure out what is going on, because I had some strange behavior with a material I expected to block the infrared light. The material looked very blocking to my naked eye, but it was not blockin infrared. Weird... that's all what I can say, since did not do more research on that particular material.

    As @Gordon mentioned - with the digital ready, you could eliminate the external resistor that I use in my circuitry: pinMode(pin,"input_pulldown");. Unfortunately, with the analog read, internal pull up/down is not possible. So you need an external resistor.

    To drive the infrared LED, you still need an external resistor to limit the current (and give the LED a life) - if the LED has not a built-in resistor.

About

Avatar for allObjects @allObjects started