Shop OBEX P1 Docs P2 Docs Learn Events
Fun with IR Sensors — Parallax Forums

Fun with IR Sensors

ercoerco Posts: 20,257
edited 2020-05-16 01:21 in General Discussion
(Didn't there used to be a sensor forum...?)

I just ordered some I2C hand gesture sensors to play with, 3 cost $7.58. China... yeah, I know...
https://www.ebay.com/itm/183447396095 says:

"This is the RGB and Gesture Sensor, a small breakout board with a built in APDS-9960 sensor that offers ambient light and color measuring, proximity detection, and touchless gesture sensing. With this RGB and Gesture Sensor you will be able to control a computer , Microcontroller, and more with a simple swipe of your hand! This is, in fact, the same sensor that the Samsung Galaxy S5 uses and is probably one of the best gesture sensors on the market for the price."

db36d6e3a8a250fa9e6e28243c025f.jpg

Much less high-tech are these simple IR reflective sensors, just an LED and phototransistor in a housing, model TCRT5000. https://www.ebay.com/itm/20Pcs-TCRT5000-Reflective-Photoelectric-Switch-Infrared-nw/254476633129 20 pcs for $4 shipped. I've had some for a while, never used 'em until now. I needed a simple cliff sensor so a robot hopefully won't fall off a table. As always, I want the simplest, minimum part solution, so some experimentation with analog circuitry was in order. I came up with the hastily-scribbled two-resistor circuit, saved here for future reference and anyone who might want it. Those are 1K and a 100K resistors. This 5V circuit is adjusted to output logic-level signals that can be read directly by an input pin, transitioning from low to high at ~1.4 (BASIC Stamp!). Sensor positioned ~3/16 to 1/4" above the floor, looking downward. LED draws 7mA. Nothing sensed (looking over the table edge) gives ~0.5V output (LOW). Anything sensed gives much higher voltage (HIGH). White surface=5V, black plastic or electrical tape =1.65V. Simple 2-resistor circuit works for me.

2a79192bb0d906ce3bee2c0a85395d.jpg

a1136d2698af0b14587091a3edbdea.jpg
1224 x 1632 - 478K
500 x 500 - 15K
500 x 500 - 24K

Comments

  • ercoerco Posts: 20,257
    edited 2020-05-16 01:27
    Related, I just switched to a tiny iPhone 5 from a huge Android. Mainly because my kids have iPhones and I needed one to facetime with them. While I was breadboarding the simple sensor, I wasn't sure which of the two components was the IR LED or what the polarity was. I reached for the phone to use the camera to check if & when the IR LED lit up... (You know, phones can see IR... point your TV remote at your phone camera and voila...)

    But nothing was happening. Went crazy for a bit until I reached for my old Android phone, which saw the IR straightaway.

    Turns out my iphone 5 CAN'T see IR. A bit of Googling confirms that Apple adds an IR filter. https://www.instructables.com/id/See-Infrared-LED-Light-with-an-iPhone-4/

    Live & learn.
  • Found this fun fact last year. Working on a system using IR laser slip rings. Service guys camera could not see the ring initialize but my note8 could. His company phone was an iphone. Also the same time determined my laser goggles were not blocking the correct IR wavelengths. Could see lot of laser through them into camera. Got different set and saw minimal shadow. Good way to go-nogo test IR laser goggles before use. (Got very lucky)
  • erco wrote: »
    Related, I just switched to a tiny iPhone 5 from a huge Android. Mainly because my kids have iPhones and I needed one to facetime with them. While I was breadboarding the simple sensor, I wasn't sure which of the two components was the IR LED or what the polarity was. I reached for the phone to use the camera to check if & when the IR LED lit up... (You know, phones can see IR... point your TV remote at your phone camera and voila...)

    But nothing was happening. Went crazy for a bit until I reached for my old Android phone, which saw the IR straightaway.

    Turns out my iphone 5 CAN'T see IR. A bit of Googling confirms that Apple adds an IR filter. https://www.instructables.com/id/See-Infrared-LED-Light-with-an-iPhone-4/

    Live & learn.

    Ban IR filters and power only USB cables!
  • xanadu wrote: »
    erco wrote: »
    Related, I just switched to a tiny iPhone 5 from a huge Android. Mainly because my kids have iPhones and I needed one to facetime with them. While I was breadboarding the simple sensor, I wasn't sure which of the two components was the IR LED or what the polarity was. I reached for the phone to use the camera to check if & when the IR LED lit up... (You know, phones can see IR... point your TV remote at your phone camera and voila...)

    But nothing was happening. Went crazy for a bit until I reached for my old Android phone, which saw the IR straightaway.

    Turns out my iphone 5 CAN'T see IR. A bit of Googling confirms that Apple adds an IR filter. https://www.instructables.com/id/See-Infrared-LED-Light-with-an-iPhone-4/

    Live & learn.

    Ban IR filters and power only USB cables!

    Or just ban iPhones with such useless "features" (and proprietary cables).
  • ercoerco Posts: 20,257
    Or just ban iPhones with such useless "features" (and proprietary cables).

    Having been exclusively an Android user until recently, I am loath to admit that iPhones are actually superior in many ways. Photo quality, security, GUI, etc, even on an old iphone 5.

    My biggest surprise is that when used with various Wifi video cameras, there is almost zero lag even on iphone 5/6, compared to nearly a second on my newer Androids. A second of delay makes it nearly impossible to fly an FPV drone. OK for a slow-moving robot though.

    It could be that my Android phones ((LG Aristo 2) are low-end units, the freebies that phone companies give with contracts.

    My daughter got an iphone 11 for Christmas, that is a whole different animal with a ridiculous amount of processing power.

  • Erco, I have a Pixel 2...no comparison to the cheapo freebie phone you were using. Excellent pics, fast, smart, etc etc.
  • I use both. iOS for one personal app that won't run on Android. The Android is a work phone, because our MDM won't run on iOS. I would love to switch back to a 'dumb' phone when I retire.
  • ercoerco Posts: 20,257
    xanadu wrote: »
    I would love to switch back to a 'dumb' phone when I retire.


    candlephone.jpg
    1280 x 960 - 268K
  • Perfect!
  • ercoerco Posts: 20,257
    These IR cliff sensors are working great. Here's a worst case scenario, a flat black tabletop surface.
Sign In or Register to comment.