Qwiic Proximity Sensor (VCNL4040) Hookup Guide

Pages
Contributors: santaimpersonator, Englandsaurus
Favorited Favorite 2

Hardware Overview

Note: If you want to do anything outside of what is covered in this tutorial or the example code, please refer to the VCNL4040 datasheet for exact details on the sensor functionality.

Power LED

There is a power status LED to help make sure that your Qwiic Joystick is getting power. You can power the board either through the polarized Qwiic connector system or the breakout pins (PWR and GND) provided. This Qwiic system is meant to use 3.3V, be sure that you are NOT using another voltage when using the Qwiic system.

Power LED

VCNL4040 Sensor

The VCNL4040 is a proximity sensor (PS), ambient light sensor (ALS), and a high power IR emitter (IRED) integrated into a single package. The ambient light sensor and proximity sensor operate in a parallel structure. The combination of the two sensors along with the IR emitter form the proximity detector.

VCNL4040 Sensor

The sensor has an operating voltage range from 2.5V to 3.6V. It is recommended that you use this board with the intended 3.3V of the Qwiic connect system. The VCNL4040 also includes excellent temperature compensation. For any details not covered in this guide, please refer to the datasheet.

Note: This sensor is excellent for detecting qualitative changes (if an object is there or moved since the last reading). If you need quantitative distance readings, like exact distances, check out the SparkFun 2 meter and 4 meter Time of Flight (ToF) sensors with mm accuracy.

IR Emitter

The IR emmiter is immune to red glow with a 940 nm wavelength (for those discrete applications) and the sink current is programmable (200 mA default). For more details on the IR emitter, please refer to the datasheet.

Ambient Light Sensor (ALS)

The VCNL4040 offers a 16-bit high resolution ALS with ±10 % accuracy and is immune to fluorescent light flicker. With an ambient light sensing capability down to 0.01 lux/step, the VCNL4040 works well under a low transmittance lens design (dark lens). In addition, the patented FiltronTM technology offers great background light cancellation capability (including sunlight) without utilizing microcontroller resources.

Proximity Sensor (PS)

The proximity sensor features smart persistence, which prevents the misjudgment of proximity sensing but also keeps a fast response time. In active force mode, a single measurement can be requested for more design flexibility and/or power saving.

Qwiic or I2C

I2C Address

The sensor has a single slave address 0x60 (HEX) of 7-bit addressing, following I2C protocol.

Connections

The simplest way to use the Qwiic Proximity Sensor is through the Qwiic connect system. The connectors are polarized for the I2C connection and power. (*They are tied to their corresponding breakout pins.)

Qwiic Connectors

However, the board also provides five labeled breakout pins. You can connect these lines to the I2C bus of your microcontroller and power pins (3.3V and GND), if it doesn't have a Qwiic connector. The interrupt pin is broken out to use for triggered events.

Breakout Pins

Interrupt Pin

High and low interrupt thresholds can be programmed for both the ambient light sensor and proximity sensor, allowing the component to use a minimal amount of the microcontrollers resources. Adjustable persistence sets up the amount of consecutive hits required before an interrupt event occurs, to prevent false triggers.

The VCNL4040 also supports an easy to use proximity detection logic mode, that triggers when the PS high threshold is exceeded and automatically resets the interrupt pin when the proximity reading falls beneath the PS low threshold.

An interrupt can be cleared by reading data out from the INT_Flag register (resetting it to "0") and the INT pin is then reset to high. For more details on the interrupt, please refer to the datasheet.
Interrupt Jumper
Cutting the INT jumper will remove the 10 kΩ pull-up resistor from the INT pin.
Interrupt Jumper

I2C Pull-up Jumper

Cutting the I2C jumper will remove the 2.2 kΩ pull-up resistors from the I2C bus. If you have many devices on your I2C bus you may want to remove these jumpers. Not sure how to cut a jumper? Read here!

Pull-up Jumper