Skip to main content
DNg.1
Visitor II
December 10, 2020
Solved

When do I set the ROI on the VL53L1X?

  • December 10, 2020
  • 2 replies
  • 1518 views

If I want to take multiple readings on a VL53L1X at different ROI's, I need to set the optical centers for each ROI sequentially, one for each measurement.

But when exactly do I do that, and what are the pitfalls?

e.g. I have a timing budget of 20ms, and an inter-measurement period of 25ms (so 5ms gap between measurements).

Then I start ranging on the sensor.

  1. Is the first sample wasted? Can I set the ROI before I start ranging?
  2. Can I only set the ROI after ranging has started, in the time-budget (actually measurement) phase?
  3. Can I only set the ROI after ranging, but in the same inter-measurement period? (the 5ms window in my example)?
  4. If I can set the ROI in either phase, what are the safety time budgets? (i.e. how close can I get to the ends of the time-window)

Thanks!

This topic has been closed for replies.
Best answer by John E KVAM

  1. Is the first sample wasted? Can I set the ROI before I start ranging?
  • NO Set the initial ROI, and then start. You now have Timing-budget milliseconds to set the ROI for the next range. It has to be done after the current ranging starts, but before the next one. The ROI registers are read only at the start of the ranging period.

  1. Can I only set the ROI after ranging has started, in the time-budget (actually measurement) phase?
  • Yes - exactly
  1. Can I only set the ROI after ranging, but in the same inter-measurement period? (the 5ms window in my example)?
  • To be safe I'd do it while you are ranging. The sensor takes some 20ms to take a range. Your MCU is much faster than that.
  • But you might get away with doing during the IM period, the ROI registers get read a the start of ranging. But do check that. Don't take it as gospel.
  1. If I can set the ROI in either phase, what are the safety time budgets? (i.e. how close can I get to the ends of the time-window)
  • I wait a full ms after the start command before setting the next ROI, After I get the data and processes - which is at least a couple of ms, I then update the next ROI.

2 replies

John E KVAM
John E KVAMBest answer
ST Employee
December 10, 2020

  1. Is the first sample wasted? Can I set the ROI before I start ranging?
  • NO Set the initial ROI, and then start. You now have Timing-budget milliseconds to set the ROI for the next range. It has to be done after the current ranging starts, but before the next one. The ROI registers are read only at the start of the ranging period.

  1. Can I only set the ROI after ranging has started, in the time-budget (actually measurement) phase?
  • Yes - exactly
  1. Can I only set the ROI after ranging, but in the same inter-measurement period? (the 5ms window in my example)?
  • To be safe I'd do it while you are ranging. The sensor takes some 20ms to take a range. Your MCU is much faster than that.
  • But you might get away with doing during the IM period, the ROI registers get read a the start of ranging. But do check that. Don't take it as gospel.
  1. If I can set the ROI in either phase, what are the safety time budgets? (i.e. how close can I get to the ends of the time-window)
  • I wait a full ms after the start command before setting the next ROI, After I get the data and processes - which is at least a couple of ms, I then update the next ROI.
John E KVAM
ST Employee
December 10, 2020

You might also consider not setting an IM period and using a 25ms timing budget. It gives you a more accurate answer at the same timing. Does use a bit more power though. Not settting an IM period just means a new one will start immediately after the prior one finishes.