Rohm Sensor RPR-0521RS: Meaning of "Proximity"

I am dealing with the Rohm RPR-0521RS sensor. The value for "Proximity" is not clear to me. In the examples "count far" or "count near" is used as the unit, what does that mean?
I have 3 measurements as an example:

----- No object in front of sensor --------
Proximity = 3 [count] Far
Ambient Light = 874.99 [ix]

----- Object with appr. 20 mm distance ----
Proximity = 402 [count] Far
Ambient Light = 341.59 [ix]

----- Object with appr. 4 mm distance ----
Proximity = 3409 [count] Near
Ambient Light = 31.23 [ix]

Presumably it has something to do with the library you are using rather than the hardware.

Of course I use the library

  RPR-0521RS.cpp
 Copyright (c) 2016 ROHM Co.,Ltd.

There is no (!) comment in this library, as is unfortunately the case with many Arduino libraries. So my question remains open.

Give us a link to the library.

OK
https://github.com/RohmSemiconductor/Arduino/tree/master/RPR-0521RS

Edit - any clues here? The test sketch fetches the PR and ALS, I'm sure that must be Proximity Sensor and Ambient Light Sensor.

https://fscdn.rohm.com/en/products/databook/datasheet/opto/optical_sensor/opto_module/rpr-0521rs-e.pdf

This should be the reference for answers, I think you must know it well in order to understand the test code.

from the source -

byte RPR0521RS::check_near_far(unsigned short data)
{
  if (data >= RPR0521RS_NEAR_THRESH) {
    return (RPR0521RS_NEAR_VAL);
  } else {
    return (RPR0521RS_FAR_VAL);
  }
}

that is - all values above the threshold is "Near", and below is "Far"

Threshold value is

#define RPR0521RS_NEAR_THRESH                      (1000) // example value

I guess the function and value is given as an example and can be configured by the user in his code

Why does nobody understand my question?
I ask for the meaning of the value!
I know all the answers content here.

Are you asking, what is the relation between distance and the PS_DATA register contents that the library returns?

The data sheet does not specify that, you either need to find additional information from ROHM, or calibrate it yourself.

From the absolutely minimal data sheet, the sensor reports a number proportional to the amount of IR light reflected from the object in its detection field.

That amount would obviously depend on the distance to the object as well as the size and IR reflectivity of the object.

Why did you pick this part for your project, if you did not already understand what it does?

To jremington: Your question is valid, but there are many ways how to get a sensor. I got a "Festo Bionic Flower" from a friend to play with. This sensor is installed there and of course you get curious. But I can live with it if the value of "proximity" remains unknown.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.