Skip to content

Incorrect implementation of proximity measurement frequency #21

Closed
@stonehippo

Description

@stonehippo

After a comparison of the CP version of this module with the data sheet, and the Arduino version of the Adafruit VCNL4010 library, I think that this module is not correctly setting the proximity measurement read rate on the chip.

The documentation for this module says that setting the frequency property is supposed to set the proximity read 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.

However, the data sheet states that there are 8 modes for the proximity rate register:

000 - 1.95 measurements/s (DEFAULT)
001 - 3.90625 measurements/s
010 - 7.8125 measurements/s
011 - 16.625 measurements/s
100 - 31.25 measurements/s
101 - 62.5 measurements/s
110 - 125 measurements/s
111 - 250 measurements/s

In addition, this module is setting the PROXIMITY MODULATOR TIMING ADJUSTMENT (register 15) register at address 0x8f, not the PROXIMITY RATE REGISTER (register 2) at 0x82 (as described in the data sheet and implemented in the Arduino library). Based on this information, I’m pretty sure this is not what was intended, as the register being used changes the frequency of the square wave of the IR signal, not the number of measurements made by the sensor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions