VCNL4000

Breakout boards, sensors, Drawdio, Game of Life, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Re: VCNL4000

Postby amateurasu » Fri Feb 10, 2012 1:11 am

Seems to be working so far. Thanks for the fix, tangiertigers! :)
amateurasu
 
Posts: 28
Joined: Tue Jan 17, 2012 5:38 pm

Re: VCNL4000

Postby amateurasu » Fri Feb 10, 2012 7:10 am

I turned Adafruit's sample code and tangiertigers's tweak into a library for the VCNL4000. I've included a sample program with a commented list of commands and usage notes. I've never made a library before, so I don't know if this one is all that "proper", but hopefully someone will find it useful.
Attachments
VCNL4000.zip
VCNL4000 Library
(2.62 KiB) Downloaded 72 times
amateurasu
 
Posts: 28
Joined: Tue Jan 17, 2012 5:38 pm

Re: VCNL4000

Postby lab » Sun Feb 19, 2012 4:33 pm

I am using the github code. Despite inserting the fix offered by tangiertigers on Feb 08 (170 microsec delay in the read8()), my serial output freezes after the first line when it prints "VCNL". My hookup is the same as reported by amateurasu on Feb. 3. I am using the Uno model board. I tried some of the earlier forum suggestions like changing the LED power (no result) and I tried a longer delay (270 microsec) also with no result. What am I missing, I wonder? Thanks in advance.
lab
 
Posts: 14
Joined: Mon Jan 23, 2012 2:05 pm

Re: VCNL4000

Postby amateurasu » Mon Feb 20, 2012 12:09 am

Looks like in my Feb 3 post, I had both the 5V and 3.3V lines hooked up. Shortly after posting that, I found another topic on this issue that recommended to only have the 5V or 3.3V line hooked up, but not both. So I removed the 3.3V connection and let the whole thing run from the 5V and its own 3.3V regulator. Trying that did not immediately fix the issue (this was prior to tangiertigers's post), but I left it that way through my subsequent testing, and later applying tangiertigers's fix, at which point it did work. I didn't mention removing the 3.3V line in my earlier posts, but give that a shot combined with the fix and see if it works out.

When I get some time, I'd also like to try the code without the delay in read8, but while on a better power supply than USB or a 9V battery. Just to verify that weak power is indeed the issue. If and when I do that, I'll post results here.
amateurasu
 
Posts: 28
Joined: Tue Jan 17, 2012 5:38 pm

Re: VCNL4000

Postby lab » Mon Feb 20, 2012 4:42 pm

Thanks very much. I tried with and without 3.3V and it looks like my problem is something different. To track why the output fails after printing "VCNL" I edited the setup as follows:
void setup() {
Serial.begin(9600);

Serial.println("VCNL");
Serial.println("test another line1");//added to test
Wire.begin();
Serial.println("test another line2");//added to test

uint8_t rev = read8(VCNL4000_PRODUCTID);
Serial.println("test another line3");//added to test

if ((rev & 0xF0) != 0x10) {
Serial.println("Sensor not found :(");
while (1);
}

My output is
VCNL
test another line1
test another line2
...and then it stops. No error message, and the serial port is still up.
So it is held up at this line:
uint8_t rev = read8(VCNL4000_PRODUCTID);

Is this the kind of hangup I can expect to get if in fact I don't have the sensor wired up correctly? (even though I think I do). I am guessing it is something basic. Any suggestions would be appreciated.
lab
 
Posts: 14
Joined: Mon Jan 23, 2012 2:05 pm

Re: VCNL4000

Postby amateurasu » Mon Feb 20, 2012 7:26 pm

Sorry if this seems like a dumb question, but just to verify, are you sure you're on Analog 4 and 5, not Digital 4 and 5?
amateurasu
 
Posts: 28
Joined: Tue Jan 17, 2012 5:38 pm

Re: VCNL4000

Postby lab » Mon Feb 20, 2012 11:47 pm

Not a dumb question at all. (The more spelled-out, the better!) I have the VCNL SDA going to A4 (that's analog, in the row running from A0 to A5) and SDC connected to A5 (next to it). For power I am drawing off the USB connection to my computer. I have the VCNL ground going to my Arduino ground and VCNL Vin to my Arduino 5V.
As long as we're talking connections, I don't know if this is kosher but I used a 5-pin header and laid the VCNL4000 connections across the pins, then put my connecting wires in the same row as each pin (i.e., the pins corresponding to Vin, Grd, SDA, etc. on the sensor).
Thanks again.
lab
 
Posts: 14
Joined: Mon Jan 23, 2012 2:05 pm

Re: VCNL4000

Postby amateurasu » Tue Feb 21, 2012 7:39 am

Hmm... Sounds like you should be good to go, then. I'm not sure why it's not working. You might want to get in touch with Adafruit at this point. It could be a bum chip.
amateurasu
 
Posts: 28
Joined: Tue Jan 17, 2012 5:38 pm

Re: VCNL4000

Postby adafruit » Tue Feb 21, 2012 10:26 am

lab, start a new thread and post a photo of your setup please :)
User avatar
adafruit
 
Posts: 10483
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: VCNL4000

Postby lab » Tue Feb 21, 2012 6:03 pm

So sorry -- I can't see how to start a new thread, only how to post a reply. Could you clue me in? (I have the picture of my setup ready.)
lab
 
Posts: 14
Joined: Mon Jan 23, 2012 2:05 pm

Re: VCNL4000

Postby adafruit » Tue Feb 21, 2012 7:47 pm

click on the new topic button in the main forum
User avatar
adafruit
 
Posts: 10483
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Previous

Return to Other Adafruit products

Who is online

Users browsing this forum: mibignistinly and 2 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [105]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]