VL53L0x naive usage

123 views
Skip to first unread message

Jean-Daniel Nicoud

unread,
Sep 8, 2017, 9:06:45 AM9/8/17
to diyrovers
Thanks for the messages found here.
I made The VL53L0x work using the Dave Meyer Arduino program. I then selected bunch of registers in a loop and looked at the data given by the registers. Several depends on the distance, the best is at address 30,31.
The program that seems to be usable, I just tested with a new module I got from china is
  7bit I2C address is 0x29
  As set.up, register 0 must receive value 1
  In the loop, read word from register 30 and 31 (decimal). Th'at' all!
  Distance given is ~1 per mm, 525 for 50cm, 2000 for ~2 meters
Min value is 20. That value is more or less frequent depending on the reflecting surface.
Jitter is 1-5%
When will a simple doc be available? STS is really strange with this circuit.

Jon Watte

unread,
Sep 8, 2017, 12:46:29 PM9/8/17
to diyrovers
Sounds like fun!

I imagine your goal is to use less code than the full library?


Sincerely,

jw






Sincerely,

Jon Watte


--
"I find that the harder I work, the more luck I seem to have." -- Thomas Jefferson

--
You received this message because you are subscribed to the Google Groups "diyrovers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diyrovers+unsubscribe@googlegroups.com.
To post to this group, send email to diyr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diyrovers/54ace25f-a0c2-41df-a917-6650a67e6a40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

RP6conrad

unread,
Sep 11, 2017, 2:26:50 AM9/11/17
to diyrovers
I translated the Arduino C++ lib to a simple C-lib for this sensor. You still need to adapt the I2C and the millis() functions to your µ. I use this with the STM32 F100 discovery board. The sensor seems to work OK, indoor with the standard settings the range is 1200 mm on a White wall. There is a setting "Long Range", which would give you a 2000 mm range.
Initialisation (VL53_0 is the choosen I2C-adress, B0/B2 are the XShutdown-pins of the VL53) : 
 B0_OFF;B2_OFF;delay(10); //VL53_2 actief XSDN hoog maken !!!
   VL53L0X_setAddress(VL53_0); //VL53_0 adres veranderen naar 0Xterwijl VL53_1/2 in reset zijn
   B0_ON;delay(10);//VL53_1 adres VL53_1 veranderen en daarna init
   VL53L0X_setAddress(VL53_1);//VL53_1 nieuw adres geven
   B2_ON;delay(10);//VL53_2 inschakelen, deze houdt 0X52 als adres !!
   //VL53_0  init
   VL53L0X_Active_slave(VL53_0);
   VL53L0X_init(true);
   VL53L0X_setTimeout(250);
   VL53L0X_startContinuous(0);
   //VL53_1  init
   VL53L0X_Active_slave(VL53_1);
   VL53L0X_init(true);
   VL53L0X_setTimeout(250);
   VL53L0X_startContinuous(0);
   //VL53_2  init
   VL53L0X_Active_slave(VL53_2);
   VL53L0X_init(true);
   VL53L0X_setTimeout(250);
   VL53L0X_startContinuous(0);
Read out in the loop : 
void Task_VL53L0X(void){
if(VL53_timer>=VL53_timing_budget){
VL53_timer=0;
VL53L0X_Active_slave(VL53_0);
vl53_2=VL53L0X_readRangeContinuousMillimeters();//opgelet, blocking indien meting niet klaar !!!
VL53L0X_Active_slave(VL53_1);
vl53_1=VL53L0X_readRangeContinuousMillimeters();//opgelet, blocking indien meting niet klaar !!!
VL53L0X_Active_slave(VL53_2);
vl53_0=VL53L0X_readRangeContinuousMillimeters();//opgelet, blocking indien meting niet klaar !!!
}

Op vrijdag 8 september 2017 15:06:45 UTC+2 schreef Jean-Daniel Nicoud:
VL53L0X.c
VL53L0X.h
Reply all
Reply to author
Forward
0 new messages