Distance sensor, TMF8801

Hi

I’m aiming for making a distance measurement between approximately 25 mm to 175 mm (distance is varying). Intermeasure period/ODR of around 20-50 ms/ 20 – 50 Hz, depending on how stable the readings are.

I have been looking at and testing different STMicroelectronics sensors, the VL6180X being the best option for my job. I have also testet the AMS TMF8801.

The VL6180X is doing everything as wanted, but its readings are somewhat unstable eg. jumping around from 97 to 102 mm (for a correct actual distance of 100 mm).

I have testet other STMicroelectronics sensors, the VL53L4CD and VL53L5CX, but they seem to have the same problem with unstable readings.

I also tested the GP2Y0E03, which is very accurate, and stable, as long as the surface is 100 % perpendicular to the sensor, which it is not always for my case (but apart from that an impressive sensor).

Regarding the TMF8801. I think it is the best ToF sensor, as it is very stable (either it is reading out the same one value or jumping between two values). I have been testing the TMF8801 using the libraries from sparkfun and DFrobot.

Using the sparkfun library. The readings from the sensor makes a “jump” at 99 mm. Depending on if its calibrated or not, it the jumps from 99 to ~105 / ~131 mm. I have written this as an issue in the sparkfun library github. I cant figure out why this happens, maybe its because its missing this RAM patch download.

Using the DFrobot library. The “jumping” is eliminated OK. Maybe because this library has a RAM patch download function. The problem with this library is I cant change the intermeasure period/ODR, its say default 100 ms / 10 Hz (but it seems more like 180 ms).

Regarding RAM patch, the TMF 8801 AN000597 says that App0 Application (I²C Register 0 has the value 0xC0), outdated, so do not use without patching.

And yes, I did try to put my own library together with parts from both, but I think I overrated my abilities, it did not work : )

If anyone would any experiens with getting the TMF8801 running/ running without these problems, I would be very glad to hear about. (I did try the sparkfun forum without any luck).

Possibly even a complete other sensor, even though I have been looking for any.

Libraries:
https://github.com/sparkfun/SparkFun_TMF8801_Arduino_Library

https://github.com/DFRobot/DFRobot_TMF8x01

TMF8801 DS and AN:
https://ams.com/tmf8801

I had an application to measure water height in a container where the range was 1 to 20cm
I did test with Pololu TOF sensors VL53L1X, VL53L0X, VL6180X and found the VL6180X the most accurate and stable to within 1 mm
I used the Adafruit_VL6180X library

Hi horace,

I found my Vl6180X again (DFrobot, pololu), and tried the adafruit library. The simple example they have. Its still jumping around, with this libraries. In your application are using any averaging? or non standard setup of the VL6180X?
(first adafruit test, second an old test pololu lib)

Udklip

Have you verified neither grounds nor power supply are part of the issue?

run some test using a UNO and a Pololu VL6180X averaging over 10 samples

// Pololu VL6180X test - averaged over 10 samples

#include <Wire.h>
#include "Adafruit_VL6180X.h"

Adafruit_VL6180X vl = Adafruit_VL6180X();

void setup() {
  Serial.begin(115200);
  while (!Serial)  delay(1);
  Serial.println("Adafruit VL6180x average test!");
  if (!vl.begin()) {
    Serial.println("Failed to find sensor");
    while (1);
  }
  Serial.println("Sensor found!");
}

void loop() {
  static int data[10], average = 0, count = 0;
  uint8_t range = vl.readRange();
  uint8_t status = vl.readRangeStatus();
  if (status == VL6180X_ERROR_NONE) {
    data[count] = range;
    if (++count >= 10) {
      Serial.print("Range: ");
      for (int i = 0; i < 10; i++) {
        Serial.print(data[i]);
        Serial.print(' ');
        average += data[i];
      }
      Serial.print(" average ");
      Serial.println(average / 10);
      count = average = 0;
    }
  }
  // Some error occurred, print it out!

  if ((status >= VL6180X_ERROR_SYSERR_1) && (status <= VL6180X_ERROR_SYSERR_5)) {
    Serial.println("System error");
  } else if (status == VL6180X_ERROR_ECEFAIL) {
    Serial.println("ECE failure");
  } else if (status == VL6180X_ERROR_NOCONVERGE) {
    Serial.println("No convergence");
  } else if (status == VL6180X_ERROR_RANGEIGNORE) {
    Serial.println("Ignoring range");
  } else if (status == VL6180X_ERROR_SNR) {
    Serial.println("Signal/Noise error");
  } else if (status == VL6180X_ERROR_RAWUFLOW) {
    Serial.println("Raw reading underflow");
  } else if (status == VL6180X_ERROR_RAWOFLOW) {
    Serial.println("Raw reading overflow");
  } else if (status == VL6180X_ERROR_RANGEUFLOW) {
    Serial.println("Range reading underflow");
  } else if (status == VL6180X_ERROR_RANGEOFLOW) {
    Serial.println("Range reading overflow");
  }
  delay(50);
}

sample run shows the 10 samples and the average

Range: 17 18 17 17 17 18 16 17 18 16  average 17
Range: 17 17 17 17 17 16 17 18 17 17  average 17
Range: 18 18 17 16 18 17 17 17 17 17  average 17
Range: 19 16 18 18 18 17 16 17 18 16  average 17
Range: 16 17 16 17 16 18 19 18 19 18  average 17
Range: 16 19 16 17 17 17 17 18 17 18  average 17
Range: 19 17 18 18 16 17 16 17 17 17  average 17
Range: 18 18 16 17 16 18 17 17 18 16  average 17
Range: 16 17 18 16 15 17 17 17 16 18  average 16
Range: 18 18 17 17 18 16 17 16 16 16  average 16
Range: 18 17 18 18 18 19 17 16 18 17  average 17
Range: 18 17 17 18 17 17 19 17 18 17  average 17

aanother run

Range: 65 67 65 66 68 65 66 64 65 67  average 65
Range: 65 64 66 66 66 63 65 63 66 65  average 64
Range: 65 66 65 65 64 67 64 65 67 65  average 65
Range: 68 65 65 64 65 63 65 66 65 65  average 65
Range: 68 65 65 64 66 67 63 66 65 66  average 65
Range: 65 66 65 65 65 64 66 64 65 67  average 65
Range: 66 65 66 65 65 64 65 65 64 64  average 64
Range: 64 66 67 65 65 63 64 65 67 64  average 65
Range: 67 64 66 66 64 66 65 64 64 67  average 65
Range: 65 65 64 63 63 64 64 63 65 64  average 64
Range: 65 64 65 65 65 65 64 63 64 66  average 64
Range: 66 65 65 65 65 66 66 66 66 66  average 65
Range: 64 64 66 64 65 64 67 64 65 64  average 64
Range: 65 64 64 65 64 68 64 66 65 67  average 65
Range: 67 65 64 66 64 63 64 65 66 64  average 64
Range: 67 63 65 66 63 64 66 65 65 65  average 64
Range: 66 64 64 64 66 64 66 65 63 64  average 64
Range: 64 66 65 64 64 67 64 67 64 63  average 64
Range: 66 65 65 64 65 63 65 65 64 65  average 64
Range: 67 65 64 65 64 63 67 62 65 64  average 64
Range: 64 65 65 64 67 63 65 66 65 63  average 64
Range: 64 65 65 64 66 65 64 65 67 66  average 65
Range: 66 66 65 64 65 65 64 65 64 66  average 65
Range: 66 64 63 65 64 66 64 66 64 66  average 64
Range: 65 64 64 66 65 64 65 66 65 65  average 64
Range: 64 62 65 66 63 65 65 65 66 66  average 64
Range: 65 64 65 65 67 65 65 66 64 65  average 65
Range: 67 66 64 65 66 65 65 66 64 66  average 65
Range: 65 65 68 64 65 65 65 64 64 65  average 65
Range: 65 64 65 64 66 66 68 63 63 65  average 64
Range: 65 65 65 66 65 64 66 66 65 66  average 65
Range: 66 65 62 67 63 65 65 65 63 64  average 64
Range: 65 65 66 63 67 63 63 63 63 66  average 64
Range: 64 63 64 65 68 63 65 62 64 64  average 64
Range: 65 65 67 66 65 65 62 68 66 64  average 65

another run

Range: 154 158 156 156 155 153 154 153 154 156  average 154
Range: 157 156 158 154 152 156 152 153 155 154  average 154
Range: 152 156 159 154 155 156 155 153 154 156  average 155
Range: 155 157 154 155 159 154 157 158 155 156  average 156
Range: 153 154 152 156 154 156 157 156 156 154  average 154
Range: 156 151 155 155 158 159 156 158 153 156  average 155
Range: 157 154 156 156 156 153 156 157 154 155  average 155
Range: 157 154 154 154 155 155 157 156 154 153  average 154
Range: 159 155 155 155 153 155 157 155 156 155  average 155
Range: 155 156 158 157 155 158 155 157 157 156  average 156
Range: 158 154 154 155 157 156 156 154 155 157  average 155
Range: 156 155 152 156 155 151 154 155 152 157  average 154
Range: 153 152 153 156 157 156 156 157 154 155  average 154
Range: 154 153 155 155 156 155 154 158 157 156  average 155
Range: 157 154 158 156 154 153 159 155 154 158  average 155
Range: 153 153 153 155 155 159 150 155 153 153  average 153
Range: 158 157 152 156 156 157 158 155 156 158  average 156
Range: 154 153 153 155 155 152 152 152 154 155  average 153
Range: 158 155 156 155 155 156 156 154 155 156  average 155
Range: 157 155 155 156 154 154 154 158 155 154  average 155
Range: 155 158 156 157 157 154 154 158 154 154  average 155
Range: 156 157 153 157 157 156 158 155 153 154  average 155
Range: 156 155 157 155 154 158 155 159 155 153  average 155
Range: 156 155 155 157 159 156 154 156 153 157  average 155
Range: 153 154 154 158 155 155 157 154 158 154  average 155
Range: 154 156 154 155 149 157 151 157 156 156  average 154
Range: 156 151 156 156 153 157 156 153 156 155  average 154
Range: 151 156 152 154 157 153 155 155 153 156  average 154
Range: 157 156 156 155 155 156 153 156 158 156  average 155
Range: 156 152 155 155 151 156 156 157 157 154  average 154
Range: 153 152 155 158 153 154 155 154 155 155  average 154
Range: 155 154 155 155 153 156 154 156 157 155  average 155
Range: 153 154 154 155 154 156 152 155 154 156  average 154
Range: 153 152 154 154 155 156 155 156 156 154  average 154
Range: 155 157 157 155 153 151 157 153 155 154  average 154
Range: 157 156 153 154 153 157 151 157 152 155  average 154
Range: 153 153 155 157 152 154 155 157 154 152  average 154

one has to be careful not to angle the target away from the sensor

xfpd, not really, unfortunately I dont have an oscilloscope. But now I tested again putting a 100 uF close to the VL6180X Vcc Gnd. The test setup is a host MCU seeed XIAO nRF52840, delivering the 3V3 to the VL6180X. the host MCU is powered by USB. There a 2,2 uF on this output from host, and the VL6180X also has 10 uF and 100 nF on its power and pins. (TMF8801 testet same way, and only has 4,7 uF). Anyway this doesnt help. Also I tried with a LiPo power, same result.

horace, thanks for the effort, what you are showing here is exact the problem the single values jumping around, I see 62 to 68, 151 to 158. The TMF8801 has almost stable values, either giving the same value, or shifting between two (e.g. stable 65, or stable 64-65 in this case) and this is without averaging raw values (33 - 50 ms intermeasurements 30 - 20 Hz) forgot to mention, I dont "have the time" to make the averaging, I want the readings at this speed.

Just want to add these screendumps, first to show the TMF8801 "jumps" and then how stable this sensor is, running without any averaging, raw values:

image
image

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