Home Code VCNL4010 proximity and ambient light sensor Arduino example

VCNL4010 proximity and ambient light sensor Arduino example

by shedboy71

In this article we look at another acceleration sensor – this time its the VCNL4010 and we will connect it to an Arduino Uno

First lets look at the sensor

The VCNL4010 is a fully integrated proximity and ambient light sensor. Fully integrated means that the infrared emitter is included in the package. It has 16 bit resolution. It includes a signal processing IC and features standard I2C communication interface. It features an interrupt function.

• Built-in infrared emitter and photo-pin-diode for proximity
• 16 bit effective resolution for proximity detection range
ensures excellent cross talk immunity
• Programmable LED drive current from 10 mA to 200 mA in
10 mA steps
• Excellent ambient light suppression by modulating the
infrared signal
• Proximity distance up to 200 mm

• Built-in ambient light photo-pin-diode with close-tohuman-eye sensitivity
• 16 bit dynamic range from 0.25 lx to 16 klx
• 100 Hz and 120 Hz flicker noise rejection


• Integrated modules: infrared emitter (IRED), ambient light sensor (ALS-PD), proximity sensor (PD), and signal conditioning IC
• Interrupt function
• Supply voltage range VDD: 2.5 V to 3.6 V
• Supply voltage range IR anode: 2.5 V to 5 V
• Communication via I2C interface
• I2C Bus H-level range: 1.7 V to 5 V
• Low stand by current consumption: 1.5 μA


Parts Required


Name Link
Arduino Uno UNO R3 CH340G/ATmega328P, compatible for Arduino UNO
VCNL4010 Multiple Function Sensor Development Tools Proximity/Light Sensor VCNL4000 (1 piece)
Connecting wire Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire
sensor shield Expansion IO Board Sensor Shield



arduino and vcnl4010

arduino and vcnl4010


Code Example

This uses the library from https://github.com/adafruit/Adafruit_VCNL4010

This is the default example

#include <Wire.h>
#include "Adafruit_VCNL4010.h"
Adafruit_VCNL4010 vcnl;
void setup()
Serial.println("VCNL4010 test");
if (! vcnl.begin())
Serial.println("Sensor not found :(");
while (1);
Serial.println("Found VCNL4010");
void loop()
Serial.print("Ambient: ");
Serial.print("Proximity: ");



Open the serial monitor and you should see something like this

Proximity: 3628
Ambient: 76
Proximity: 5509
Ambient: 66
Proximity: 6417
Ambient: 63
Proximity: 7181
Ambient: 54
Proximity: 8347
Ambient: 53
Proximity: 9443
Ambient: 52







You may also like

Leave a Comment