Mikroe Proximity 3 click - Proximity and Light Sensor - VCNL4200

Proximity 3 click is an intelligent proximity and light sensing device, which features the VCNL4200 sensor from Vishay - high sensitivity long distance proximity sensor (PS), ambient light sensor (ALS) and 940 nm IRED, all in one small package.

With its smart sensing and light conditioning properties, the Proximity 3 click can be used in a wide range of applications: adjusting the brightness of the TFT screen depending on ambient light, turning off the TFT background light if it is covered, very accurate lux meters, reliable security sensors and so on.

How the Proximity 3 click works

Proximity 3 click uses the VCNL4200 sensor, which combines matched 940 nm IR emitter and a photodiode for proximity measurement and ambient light sensing. VCNL4200 offers programmable measurement by utilizing the advanced signal processing techniques, allowing the sensor to operate in various conditions. Communication with the microcontroller is done via the I2C interface so that the host controller can set the measurement parameters and request results back from the sensor.

Both low and high threshold values for the measured property can also be set via the I2C so that the interrupts can be generated every time the threshold value is exceeded. This allows for the reduced need of the sensor polling, which can result in better power management. With MikroElektronika library functions, setting up the registers is really easy and the tedious task of initializing the sensor is taken care of with a few simple function calls. More information about the sensor's registers and addresses can be found in the VCNL4200 datasheet.

The Filtron™ technology used in the ALS, allows the sensor to match the ambient light spectral sensitivity to human eye response and it's immune to fluorescent light flicker. This ensures the accuracy of the measurements. The maximum detection range is selectable (197 / 393 / 786 / 1573 lux) with highest sensitivity 0.003 lux / step.

The proximity sensor uses advanced ambient and background light cancellation schemes, so it is fairly immune to interferences that might occur in this case. This allows for a quite precise proximity detection. The sensor can work either in 12-bit or 16-bit mode, selectable by I2C command. The click's range is up to 1.5m.

VCNL4200 input voltage is 3V3, while the separate 5V supply rail is used to supply power for the IR emitter pulses, generated by the small external P-channel MOSFET (Q1). This way, the power dissipation of the IRED drive is displaced from the chip, and the high-current IRED drive pulses are isolated from the sensitive integrated circuit sections, connected to the 3V3 rail.

Specifications

Type

Proximity

Applications

Adjusting the brightness of the TFT screen depending on ambient light, turning off the TFT background light if it is covered, very accurate lux meters, reliable security sensors, etc.

Pinout diagram

This table shows how the pinout on Proximity 3 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).

Notes

Pin

Pin

Notes

NC

1

AN

PWM

16

NC

NC

2

RST

INT

15

INT

Interrupt output

NC

3

CS

TX

14

NC

NC

4

SCK

RX

13

NC

NC

5

MISO

SCL

12

SCL

I2C clock

NC

6

MOSI

SDA

11

SDA

I2C data

Power supply

+3.3V

7

3.3V

5V

10

+5V

Power supply

Ground

GND

8

GND

GND

9

GND

Ground

Proximity 3 click maximum ratings

Description

Min

Typ

Max

Unit

Supply voltage

2.5

3.3

3.6

V

Supply voltage for IRED

3.8

5.0

5.5

V

Operation temperature range

-40

+85

°C

Supply current

350

µA

IRED driving current

800

mA

Full ALS counts

65535

steps

Full PS counts

4095/65535

steps

I2C clock (std mode / fast mode)

10/10

100/400

kHz

Measurement distance

0

1.5

m

Onboard settings and indicators

Label

Name

Default

Description

PWR

Power LED

-

Power LED indicates that the click is powered on

Software Support

We provide a demo application for the Proximity 3 click on our LibStock page, developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards with minimal change to the code depending on the microcontroller used.

Library Description

This library contains a set of functions, necessary to work with the Proximity 3 click.

Key functions

uint16_t prox3_readALS() - Reads value from ALS register

uint16_t prox3_readPS() - Reads value from PS register

uint16_t prox3_getDistance() - Calculating distance

uint16_t prox3_getIlluminance() - Calculating illuminance

Examples Description

This is a simple demonstration of sensor functionality, where the user can read the distance and illuminance data from Proximity 3 click. Distance and illuminance values are sent via UART.

The full application code, and ready to use projects can be found on our LibStock page.

Other mikroE Libraries used in the example:

I2C

UART

Conversions

Additional notes and information

Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.