0

Reading VCNL4010 Data after Reconnecting?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Reading VCNL4010 Data after Reconnecting?

by Lemonade on Tue Feb 16, 2021 7:19 pm

Hello! On the project I am working on, I have a VCNL4010 sensor being used to read ambient light. What I would like to do is be able to detect when an open circuit is created by removing the Sensor, and have the Sensor resume working when reconnecting to the circuit. I do not have much experience with circuits, beyond knowing how to make very basic things from high school physics classes.

My issue right now is that whenever data is being requested from the sensor, removing/reconnecting it breaks its functionality. In this instance data is being requested when the Zanduino function setAmbientContinuous(true) is being used, or when I make calls to get readings from the sensor explicitly. Since ambient data is always being checked in the background, I need to know why this is breaking in the first place and how to fix it.

My first assumption was that any writes to the sensor when the class gets constructed are being flushed from memory, disabling it from being used until the program starts anew. However this cannot be the case, when I tested it by turning off backround checking and reconnected the sensor it worked fine, as long as I was not asking for data at the time of disconnect. So this leads me to believe that the issue is a voltage gain from the circuit maybe? Since I do not know enough about this type of thing or how to research it, I don't know how plausable this actually is.

This does lead into my second issue though, is that I need a way to tell when the circuit is opened and closed. I learned that I could use weak resistors to create a system that could check for disconneted pins as seen here (https://arduino.stackexchange.com/a/14649), but I am going to need to know exactly when the circuit opens so that won't be an option. Are there any PCB based solutions that I could use, that would trigger a high/low for my Arduino board to use as an interrupt? I found this (https://www.adafruit.com/product/4226) on the adafruit store, but I'm not quite sure what it does.

I am using a Teensy 3.2 and the Teensy Prop Shield. The library I am using is the Zanduino VCNL4010 library found here (https://github.com/Zanduino/VCNL4010/wiki). I have also tried using the Adafruit library, however I do not quite understand how to set up an ambient interrupt on it.

Thanks in advance!

Lemonade
 
Posts: 1
Joined: Tue Feb 16, 2021 2:47 pm

Re: Reading VCNL4010 Data after Reconnecting?

by SV_Zanshin on Tue Feb 23, 2021 1:40 am

Are you removing power from the VCNL4010 or just disconnecting the I2C? Doing the former will make it lose its settings and necessitate calling all the set{xxxx] functions you have again, while doing the latter should not make a difference.

SV_Zanshin
 
Posts: 14
Joined: Wed Aug 30, 2017 11:47 am

Please be positive and constructive with your questions and comments.