I am trying to use the VCNL4000 that I got from Adafruit. It is awesome that there is sample code, and that is where I have started.
When I click the serial monitor in the Arduino software, I do get readings that scroll down for both Ambient and Proximity,
but I have two Questions:
1. Any idea as to why the scrolling readings stop after a couple seconds... It seems to vary how long it takes from attempt to attempt. If I close the Serial monitor and reopen it, it feeds me new sensor data.
I have read through the code a couple times and nothing is jumping out at me a the obvious cause. My guess involves the delays.
2. Does anybody have tips/advice for converting the numbers to mm or decimal inches (for example is Proximity = 9106 the same as 9.106mm?)
This is how I have it wired in case I have made a mistake:
Using and UNO and Arduion 022... haven't updated to 1.0 yet.
Vin= 5V from Arduino
Gnd= Arduino Ground
SDA= Analog pin 4
SCL= Analog pin 5
3.3V= 3.3V from Arduino (unsure about this connection)
Thanks for any advice. I will go back and re-read datasheets
Question about VCNL4000
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 19
- Joined: Tue Dec 06, 2011 6:40 pm
Question about VCNL4000
- Attachments
-
- vcnl4000Adafruit Question3.tiff (113.78 KiB) Viewed 2618 times
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: Question about VCNL4000
dont connect the 3.3V pin, just use the 5V pin
#1 we're not sure but will check it out
#2 there isnt a direct correlation, it depends on ambient light levels
#1 we're not sure but will check it out
#2 there isnt a direct correlation, it depends on ambient light levels
-
- Posts: 19
- Joined: Tue Dec 06, 2011 6:40 pm
Re: Question about VCNL4000
thanks for the reply.
noted about leaving the 3.3v alone.
the problem persists, but I found another post on the forum from a month ago with the same essential question.
Why does the serial print just stop?
http://forums.adafruit.com/viewtopic.php?f=25&t=24263
Xslayer writes:
Re: VCNL4000
Postby XSlayer » Sun Nov 20, 2011 1:25 am
"I changed the amount of power going to the irled and that seemed to help.
write8(VCNL4000_IRLED, 10); // set to 20 * 10mA = 200mA
It was originally set to 20 but after i changed it to 10 it seemed to fix the problem. Just figured i would post that in case someone has the same issue as me. There may still be something else wrong but it is seems to work ok. Kinda sucks though id prolly get a little more distance out of it if i could run full power."
Tried Xslayers advice and it helped, setting it to 100mA, but I had to lower it even further to 70mA to get it to continue with the serial print for mulitple minutes at a time.
I don't know what if anything is bad about this fix. Any ideas or concerns.
the range of detection is pretty small ...1 inch from the sensor and less... anything beyond that only the ambient light value changes much.
I think the sample code should probably be changed if this is a good fix for others as it doesn't seem to be a problem with loose connections (triple checked )
Problems withstanding... thanks for selling great things.
and helping to get them working.
noted about leaving the 3.3v alone.
the problem persists, but I found another post on the forum from a month ago with the same essential question.
Why does the serial print just stop?
http://forums.adafruit.com/viewtopic.php?f=25&t=24263
Xslayer writes:
Re: VCNL4000
Postby XSlayer » Sun Nov 20, 2011 1:25 am
"I changed the amount of power going to the irled and that seemed to help.
write8(VCNL4000_IRLED, 10); // set to 20 * 10mA = 200mA
It was originally set to 20 but after i changed it to 10 it seemed to fix the problem. Just figured i would post that in case someone has the same issue as me. There may still be something else wrong but it is seems to work ok. Kinda sucks though id prolly get a little more distance out of it if i could run full power."
Tried Xslayers advice and it helped, setting it to 100mA, but I had to lower it even further to 70mA to get it to continue with the serial print for mulitple minutes at a time.
I don't know what if anything is bad about this fix. Any ideas or concerns.
the range of detection is pretty small ...1 inch from the sensor and less... anything beyond that only the ambient light value changes much.
I think the sample code should probably be changed if this is a good fix for others as it doesn't seem to be a problem with loose connections (triple checked )
Problems withstanding... thanks for selling great things.
and helping to get them working.
-
- Posts: 19
- Joined: Tue Dec 06, 2011 6:40 pm
Re: Question about VCNL4000
thanks for the reply.
noted about leaving the 3.3v alone.
the problem persists, but I found another post on the forum from a month ago with the same essential question.
Why does the serial print just stop?
http://forums.adafruit.com/viewtopic.php?f=25&t=24263
Xslayer writes:
Re: VCNL4000
Postby XSlayer » Sun Nov 20, 2011 1:25 am
"I changed the amount of power going to the irled and that seemed to help.
write8(VCNL4000_IRLED, 10); // set to 20 * 10mA = 200mA
It was originally set to 20 but after i changed it to 10 it seemed to fix the problem. Just figured i would post that in case someone has the same issue as me. There may still be something else wrong but it is seems to work ok. Kinda sucks though id prolly get a little more distance out of it if i could run full power."
Tried Xslayers advice and it helped, setting it to 100mA, but I had to lower it even further to 70mA to get it to continue with the serial print for mulitple minutes at a time.
I don't know what if anything is bad about this fix. Any ideas or concerns.
the range of detection is pretty small ...1 inch from the sensor and less... anything beyond that only the ambient light value changes much.
I think the sample code should probably be changed if this is a good fix for others as it doesn't seem to be a problem with loose connections (triple checked )
Problems withstanding... thanks for selling great things.
and helping to get them working.
noted about leaving the 3.3v alone.
the problem persists, but I found another post on the forum from a month ago with the same essential question.
Why does the serial print just stop?
http://forums.adafruit.com/viewtopic.php?f=25&t=24263
Xslayer writes:
Re: VCNL4000
Postby XSlayer » Sun Nov 20, 2011 1:25 am
"I changed the amount of power going to the irled and that seemed to help.
write8(VCNL4000_IRLED, 10); // set to 20 * 10mA = 200mA
It was originally set to 20 but after i changed it to 10 it seemed to fix the problem. Just figured i would post that in case someone has the same issue as me. There may still be something else wrong but it is seems to work ok. Kinda sucks though id prolly get a little more distance out of it if i could run full power."
Tried Xslayers advice and it helped, setting it to 100mA, but I had to lower it even further to 70mA to get it to continue with the serial print for mulitple minutes at a time.
I don't know what if anything is bad about this fix. Any ideas or concerns.
the range of detection is pretty small ...1 inch from the sensor and less... anything beyond that only the ambient light value changes much.
I think the sample code should probably be changed if this is a good fix for others as it doesn't seem to be a problem with loose connections (triple checked )
Problems withstanding... thanks for selling great things.
and helping to get them working.
- tedrobotbuilder
- Posts: 9
- Joined: Tue Dec 27, 2011 1:35 am
Re: Question about VCNL4000
According to the datasheet you can’t set the I2C address:
“The VCNL4000 has a fix slave address for the host programming and accessing selection. The predefined 7 bit I2C bus address is set to 0010 011 = 13h.”
This means there is no way to have more then one on your I2C bus, correct? You might want to post that in the “Features” section before someone orders a bunch of them to create a sensor array (like I did). Would be nice if there were some way to build an array of these things so that you could have a non-contact bumper on the front of your robot like I wanted to do.
Also, people will be lucky to get much more then 10 cm range. There is just too much noise after 10cm compared to the signal. Averaging/filtering might get you to 15cm.
I had to use between 40mA and 7mA to get the thing stable. I don't think this effects the power to output LED, it is just the processing and input because range didn't seem to be affected until I got below 20mA.
“The VCNL4000 has a fix slave address for the host programming and accessing selection. The predefined 7 bit I2C bus address is set to 0010 011 = 13h.”
This means there is no way to have more then one on your I2C bus, correct? You might want to post that in the “Features” section before someone orders a bunch of them to create a sensor array (like I did). Would be nice if there were some way to build an array of these things so that you could have a non-contact bumper on the front of your robot like I wanted to do.
Also, people will be lucky to get much more then 10 cm range. There is just too much noise after 10cm compared to the signal. Averaging/filtering might get you to 15cm.
I had to use between 40mA and 7mA to get the thing stable. I don't think this effects the power to output LED, it is just the processing and input because range didn't seem to be affected until I got below 20mA.
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: Question about VCNL4000
That is correct, you can only use one per i2c bus. If you want 2 you can have one on a 'softi2c' bus (google for more information on softi2c)
- tedrobotbuilder
- Posts: 9
- Joined: Tue Dec 27, 2011 1:35 am
Re: Question about VCNL4000
*between 40mA and 70mA
- tedrobotbuilder
- Posts: 9
- Joined: Tue Dec 27, 2011 1:35 am
Re: Question about VCNL4000
@adafruit:
Thanks for the reply! I assume the softi2c you are referring to is this one?
http://forums.adafruit.com/viewtopic.php?f=25&t=13722
Do you know how many I2C lines you can have at one time with this library?
Thanks for the reply! I assume the softi2c you are referring to is this one?
http://forums.adafruit.com/viewtopic.php?f=25&t=13722
Do you know how many I2C lines you can have at one time with this library?
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: Question about VCNL4000
oneTedRobotBuilder wrote:@adafruit:
Thanks for the reply! I assume the softi2c you are referring to is this one?
http://forums.adafruit.com/viewtopic.php?f=25&t=13722
Do you know how many I2C lines you can have at one time with this library?
- whampus
- Posts: 1
- Joined: Mon Dec 03, 2012 6:17 pm
Re: Question about VCNL4000
Did you have any luck setting up two or more VCNL4000 sensors TedRobot? I'm trying to do this with two via the SoftwareSerial in Arduino 1.0 but I'm not having much luck.
Please be positive and constructive with your questions and comments.