0

I was looking for wiring the VCNL 4000 Proximity Sensor.

I found this one http://bildr.org/2012/11/vcnl4000-arduino/

but there is used a sensor on a red board, which has other pins like mine (which has a blue board) see http://www.adafruit.com/products/466?&main_page=product_info&products_id=466

as I see SCL,DSA,GRND on both

the red has IR+ which is connected to the 5V . mine (blue one) has VIN. Is this meant to be the same and should it be connected to the 5V ?

Any hints?

I tried the following wiring but the following call does not finish.

3,3V TO 3,3V POWER

SCL TO SCL (Last pin on the digital side)

SDA to SDA (Beside SCL)

GND TO GND on the Analog side

Vin to 5V

 readVCNLByte(0x81); is called

i used the example code from adafruiut

1

There seems to be a big difference between the Sparkfun and the Adafruit breakouts:

  • Sparkfun breadkout needs 3.3V and 5V power as inputs as shown in their wiring circuit (in the first link you mentioned)
  • Adafruit breakout needs only 5V as input but has a 3.3V regulator on it that provides the 3.3V to all its internal circuits that need it; it also has a 3.3V pin which is an output not an input as for the Sparkfun

Hence your wiring is wrong. The expected wiring is described in Adafruit sample sketch:

// Example sketch for talking to the VCNL4000 i2c proximity/light sensor
// Written by Adafruit! Public domain.
// To use: Connect VCC to 3.3-5V (5V is best if it is available), GND to
//         ground, SCL to i2c clock (on classic arduinos, Analog 5), SDA
//         to i2c data (on classic arduinos Analog 4). The 3.3v pin is
//         an ouptut if you need 3.3V
// This sensor is 5V compliant so you can use it with 3.3 or 5V micros

In comments, VCC should read as Vin on the breakout.

Note that the comments mention SDA and SCL pins on A4 and A5 respectively, this is correct on Arduino UNO, but your wiring on the 2 leftmost pins of the digital pin header is also correct, as these pins are now replicated there on UNO and Leonardo. On Leonardo, the real pins for SDA/SCL are pins 2 and 3. If you don't have a UNO or Leonardo though, you should check where SDA and SCL can be found (that's generally described on Arduino Product page for your board).

Although wiring SDA/SCL on these 2 replicate pins is correct, I would rather recommend using A4 and A5 instead, so that you don't get the illusion that you can both use SDA/SCL and A4/A5 for something else at the same time.

This circuit uses I2C which means you should normally add pullup resistors to SDA and SCL wires; however, it seems that the Adafruit breakout already integrates them, so no problem here.

To sum up, and provided that you have a UNO or Leonardo, your wiring is correct except that you should remove the wire between both 3.3V pins.

This is shown below for UNO (I used the real pins for SDA and SCL so that you don't use them for something else later):

  • Arduino UNO 5V ---> Breakout Vin
  • Arduino UNO GND ---> Breakout GND
  • Arduino UNO A4 ---> Breakout SDA
  • Arduino UNO A5 ---> Breakout SCL
  • Breakout 3.3V left unconnected

For Leonardo it would be:

  • Arduino Leonardo 5V ---> Breakout Vin
  • Arduino Leonardo GND ---> Breakout GND
  • Arduino Leonardo D2 ---> Breakout SDA
  • Arduino Leonardo D3 ---> Breakout SCL
  • Breakout 3.3V left unconnected

I show you both UNO and Leonardo since you did not mention which board you use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.