SparkFun VCNL4040 Proximity Sensor Library


Library for the SparkFun Qwiic Proximity Sensor 20cm - VCNL4040
The VCNL4040 is a simple IR presence and ambient light sensor. This sensor is excellent for detecting if something has appeared in front of the sensor. We often see this type of sensor on automatic towel dispensers, automatic faucets, etc. You can detect objects qualitatively up to 20cm away. This means you can detect if something is there, and if it is closer or further away since the last reading, but it's difficult to say it is 7.2cm away. If you need quantitative distance readings (for example sensing that an object is 177mm away) check out the SparkFun Time of Flight (ToF) sensors with mm accuracy.

Author: SparkFun Electronics

Maintainer: SparkFun Electronics

Read the documentation


This library is compatible with all architectures so you should be able to use it on all the Arduino boards.


To use this library, open the Library Manager in the Arduino IDE and install it from there.