The VCNL4020 is a handy two-in-one sensor, with a proximity sensor that works from 0 to 200mm (about 7.5 inches) and a light sensor with a range of 0.26 to 16,000 lux.

We've all been there. That thing is close but how close? When you need to measure a small distance with reasonable accuracy, such as the rough height of a particularly calm bumble bee, the VCNL4020 Proximity Sensor from Vishay can do that for you. If perchance you also needed to measure the amount of light at the same time, perhaps to let the bee to know if it's time for bed, you're in luck! The VCNL4020 can do that too (bumble bee not included, we tried putting it in the anti-static bag but it started buzzing in a threatening manner).

This sensor is similar to the VCNL4040 but with a wider light sensor range, up to 16000 lux!

As with all of our new I2C sensors, we've taken the VCNL4020 and put it onto a breakout PCB along with support circuitry to let you use this little wonder with 3.3V (Feather/Raspberry Pi) or 5V (Arduino/ Metro328) logic levels. Since it speaks I2C, you can easily connect it up with two wires (plus power and ground!). We've even included SparkFun qwiic compatible STEMMA QT connectors for the I2C bus so you don't even need to solder! Just wire up to your favorite micro and you can use our Arduino drivers to easily interface with the VCNL4020 and make approximate approximations of proximity in no time!

The VCNL4020 comes with a variety of knobs you can tweak such as how many samples per second (a.k.a the integration time between measurements) - more samples per second means faster results but not as good at measuring low level light. With 16-bit light level reports, and 0.25 lux per bit, you can measure from 0.25 to 16,000 lux! And various averaging filters can do your low-pass filtering for you so you get less spiky results. However, there are no other sensitivity/integration time controls.

This guide was first published on Nov 06, 2023. It was last updated on Jul 20, 2024.

This page (Overview) was last updated on Mar 08, 2024.

Text editor powered by tinymce.