VL53L0X Sensor and STM32F407

Hi, I am trying to use VL53L0X sensor with STM32F407 and GitHub - SeverSpa/STM32F4_LIDAR: STM32F4 Discovery coupled with the Lidar sensor VL53L0X, using a small API library ported by Adam Halliwell library. I can measure with this library I use, but my measurement results are very noisy and constantly return 8190. I don’t know if I need to calibrate. Can you help me?

Hello.

Just to clarify, are you using our VL53L0X time-of-flight distance sensor carrier? Could you post some pictures of your setup clearly showing all of your connections, and do you have an Arduino-compatible board that you can use to run the examples from our VL53L0X library to verify that the sensor works? Beyond that, it sounds like it could be a software problem, so you might try contacting the author of the software you are using.

Brandon

1 Like

Hi Brandon, I am using your VL53L0X time-of-flight distance sensor carrier. Unfortunately I don’t have any other card than STM32F407. I’ve included the code parts that I’m running below.

/* USER CODE BEGIN PV */
VL53L0X sensor;
uint8_t id;
uint16_t dist;
/* USER CODE END PV */

  /* USER CODE BEGIN 2 */
setAddress(&sensor, 0x29);
HAL_Delay(200);
init(&sensor,true);
setVcselPulsePeriod(&sensor,VcselPeriodPreRange, 16);
setTimeout(&sensor,200);
setAddress(&sensor, 0x04);
startContinuous(&sensor,0);
id=getWhoAmI(&sensor);
  /* USER CODE END 2 */

 while (1)
  {
    dist=readRangeContinuousMillimeters(&sensor);
    dist=dist/10;
    HAL_Delay(500);
  
    if(dist >=10 && dist <= 100){
      HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, GPIO_PIN_SET);
    }
    else if(dist < 10 || dist > 100){
      HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, GPIO_PIN_RESET);
    }
 }

Unfortunately, the code does not give us any additional insight to the problem since we did not write the software you are using. However, if you could post the picture of your setup that shows all of your connections, I would be happy to look those over.

Brandon

thanks for the awesome information.

1 Like

thanks my issue has been fixed.

1 Like