- Order number: MIKROE-2801
- Manufacturer product ID: MIKROE-2801
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. |
On-board modules | VCNL4200 sensor - high sensitivity long distance proximity sensor (PS), ambient light sensor (ALS) and 940 nm IRED, intelligent background light cancellation |
Key Features | Proximity distance up to 1.5 m, immunity to the red glow (940 nm IRED) and fluorescent light flickering, selectable maximum detection range (197 / 393 / 786 / 1573) lux with highest sensitivity 0.003 lux/step |
Interface | I2C |
Input Voltage | 3.3V,5V |
Click board size | S (28.6 x 25.4 mm) |
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).
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 | 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 application is composed of three sections:
- System Initialization - I2C and UART module initialization
- Application Initialization - Sends HAL pointers, and initializes the VCNL4200
- Application Task - Sequential reading of the distance, proximity and ambient light data from the sensor and logging it to UART, every second
void applicationTask() { // DISTANCE READ AND CONVERT VALUE TO STRING resultPS = prox3_getDistance(); IntToStr( resultPS, txt1 ); // WRITES INFORMATION TO UART UART1_Write_Text( "Proximity: ~ " ); UART1_Write_Text( txt1 ); UART1_Write_Text( " cmrn" ); // AMBIENT LIGHT READ AND CONVERT VALUE TO STRING resultALS = prox3_getIlluminance(); IntToStr( resultALS, txt2 ); // WRITES INFORMATION TO UART UART1_Write_Text( "Ambient Light: " ); UART1_Write_Text( txt2 ); UART1_Write_Text( " luxrn" ); Delay_ms(1000); }
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.