adafruit_vcnl4010

CircuitPython module for the VCNL4010 proximity and light sensor. See examples/vcnl4010_simpletest.py for an example of the usage.

  • Author(s): Tony DiCola

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_vcnl4010.VCNL4010(i2c, address=19)[source]

Vishay VCNL4010 proximity and ambient light sensor.

ambient

The detected ambient light in front of the sensor. This is a unit-less unsigned 16-bit value (0-65535) with higher values for more detected light. See the ambient_lux property for a value in lux.

ambient_lux

The detected ambient light in front of the sensor as a value in lux.

frequency

The frequency of proximity measurements. Must be a value of:

  • FREQUENCY_3M125: 3.125 Mhz
  • FREQUENCY_1M5625: 1.5625 Mhz
  • FREQUENCY_781K25: 781.25 Khz
  • FREQUENCY_390K625: 390.625 Khz (default)

See the datasheet for how frequency changes the proximity detection accuracy.

led_current

The current of the LED. The value is in units of 10mA and can only be set to 0 (0mA/off) to 20 (200mA). See the datasheet for how LED current impacts proximity measurements. The default is 200mA.

led_current_mA

The current of the LED in milli-amps. The value here is specified in a milliamps from 0-200. Note that this value will be quantized down to a smaller less-accurate value as the chip only supports current changes in 10mA increments, i.e. a value of 123 mA will actually use 120 mA. See the datasheet for how the LED current impacts proximity measurements, and the led_current property to explicitly set values without quanitization or unit conversion.

proximity

The detected proximity of an object in front of the sensor. This is a unit-less unsigned 16-bit value (0-65535) INVERSELY proportional to the distance of an object in front of the sensor (up to a max of ~200mm). For example a value of 10 is an object farther away than a value of 1000. Note there is no conversion from this value to absolute distance possible, you can only make relative comparisons.