0

CPX onboard IR-RX as basic proximity sensor
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

CPX onboard IR-RX as basic proximity sensor

by Tony_H on Sat Apr 10, 2021 5:20 pm

The following is stated RE the onboard IR-RX/TX devices :
There's also a secret capability, you can read the 'raw' analog value from the receiver LED diode to do basic IR proximity sensing. The direct analog value is available from pin A10

I couldn't find any examples, futzed around with it myself, but could not get the analog pin A10 to report anything resembling proximity. Can anyone give a hint as to how to make this work? Thanks!

Tony_H
 
Posts: 10
Joined: Wed Feb 12, 2020 7:30 pm

Re: CPX onboard IR-RX as basic proximity sensor

by Tony_H on Sat Apr 10, 2021 6:10 pm

I'll put this out there as something I have tried that has not worked to get the ball rolling,
Code: Select all | TOGGLE FULL SIZE
from adafruit_circuitplayground import cp
from analogio import AnalogIn
import board
import pulseio
import time

led = pulseio.PWMOut(board.IR_TX, frequency=38000, duty_cycle=100)
   
analog_in = AnalogIn(board.IR_PROXIMITY)

while True:
   time.sleep(0.1)
   cp.IR_TX = True
   print('[',analog_in.value,']')

pass

Tony_H
 
Posts: 10
Joined: Wed Feb 12, 2020 7:30 pm

Re: CPX onboard IR-RX as basic proximity sensor

by kevinjwalters on Sun Apr 11, 2021 2:11 pm

There's a previous discussion on this on Adafruit Forums: Documentation error: Using IR sensor for proximity (python).

Your choice of duty_cycle suggests you are aware of the issue but as a general reminder it's very important not to leave the IR LED on as there's no current limiting resistor and things will get very hot, very quickly. BTW, tour cp.IR_TX = True isn't doing anything. That willl just be adding an unused attribute to the cp object.

kevinjwalters
 
Posts: 963
Joined: Sun Oct 01, 2017 3:15 pm

Re: CPX onboard IR-RX as basic proximity sensor

by Tony_H on Sun Apr 11, 2021 3:34 pm

Ah. Thanks for that link - lots of good content there! I was looking for a circuitpython solution for this, and based on verbage from that link this is not possible.
This came up because I was looking to use (2) VCNL4010 (proximity sensors) with a CPX+CRICKIT combo, but later found that VCNL4010's do not have I2C address pin options [...and with CRICKIT consuming the native SCL/SDA I2C interface, only the A6/A7 pair remained for a secondary SCL/SDA I2C interface so it looks like only one VCNL4010 can be used].

All this is not a problem. I still like the products. : o ) I have an M4 feather board which has more I2c pin/pair options, so maybe I just need to get the CRICKIT board for that guy for this project.
Thanks for the help, y'all!

Tony_H
 
Posts: 10
Joined: Wed Feb 12, 2020 7:30 pm

Please be positive and constructive with your questions and comments.