I tried to find VL530lox sensor library to work for bluepill board. So far I could not get one. There are few working well with Arduino, but when I tried it gives some error in Wire.write command.
I don’t have enough knowledge in C++ and limited knowledge for C.
Any help or guideline will be appreciated.
Thanks
raufjay

Which library are you using?
Where did you download it from?
*Exactly* what is/are the error or errors you get?
Do you have a link for the datasheet for the VL530lox module?
https://github.com/pololu/vl53l0x-arduino
VL53L0X library for Arduino
This is a library for the Arduino IDE that helps interface with ST’s VL53L0X time-of-flight distance sensor. The library makes it simple to configure the sensor and read range data from it via I²C.
https://www.pololu.com/product/2490 @ $13.95
datasheet https://www.pololu.com/file/download/VL … _id=0J1187
that’s not the lidar i expected, mine revolves
stephen
http://www.st.com/en/imaging-and-photon … 53l0x.html
http://www.st.com/content/ccc/resource/ … 279086.pdf
but no, i don’t think it works as a scanning lidar, more as a laser range detector
https://github.com/adafruit/Adafruit_VL53L0X
and loaded the only one example: it compiles.
I used a core that has some months, 8 April 2017.
So if I have time I will confirm if the adafruit library works
Note. Adafruit often deliberately wire the config pins on I2C devices to the alternative ( non default ) slave address, which means their library’s only work “out if the box ” on their hardware, because the Chinese made boards tend to use the default address.
In the past I needed to modify their Libs to make them work with some Chinese made modules.
Maybe this library too accept an address as argument in begin.
https://github.com/adafruit/Adafruit_VL53L0X
and
https://github.com/pololu/vl53l0x-arduino
Both seem to run OK, however both examples have problems which would make the example unusable.
The Adafruit library reports a “Range Status” and the example checks this is != 4
However, when I turned on the debugging in the Adafruit lib, it reports Range Status 2 as “Signal Fail”
And only values with Range Status == 0 are show as “Valid”
Range only seems to be valid when the distance being measure is < 20 cm
This value is much less than ST’s datasheet, which status
It can measure absolute distances up to 2m
http://www.st.com/content/ccc/resource/ … 279086.pdf
I’m pretty sure the problem is in the library config, but its a shame that the library appears to report values when the library is reporting that the range status is “Signal Fail”
The Pololu library gives very similar results to the Adafruit, but the Pololu library had an example of a “single” reading, which has options for long range, and this seems to be the best mode, because the Pololu library reports a range of 8190 if the distance its measuring goes of range.
But ultimately, I’m not that happy with either library.
I thought ST has written their own “driver” for this device, but I can’t find it yet, and looking on ST’s community forum, people didnt seem happy with the lack of documentation on this device
e.g.
https://community.st.com/thread/7504
It looks like the Adafruit library contains source code written by ST and published via mbed.
The Polulu library seems to have been written by them from scratch, and contains big blocks of code writing arbitrary values to registers in the VL53lox e.g.
writeReg(0xFF, 0x01);
writeReg(0x00, 0x00);
writeReg(0xFF, 0x00);
writeReg(0x09, 0x00);
writeReg(0x10, 0x00);
writeReg(0x11, 0x00);
writeReg(0x24, 0x01);
writeReg(0x25, 0xFF);
writeReg(0x75, 0x00);
[RogerClark – Sun Aug 06, 2017 12:05 pm] –
I thought ST has written their own “driver” for this device, but I can’t find it yet, and looking on ST’s community forum, people didnt seem happy with the lack of documentation on this device
ST software is here
http://www.st.com/en/embedded-software/stsw-img005.html
but free registration is required.
I used this sensor with an Arduino and Pololu library only one time. I thought to use this sensor with the cheap robotic car sinche the ultrasonic cheap sensor work worse at 3.3v.
Thanks for the link. I am already register with ST so that won’t be a problem.
I am interested in its uses for a variety things, and for testing I was going to try it in a robotic car.
I also need to port it to use on the Nordic nRF51 series MCU, but that looks more complicated than I imagined, as setting up the myriad of registers takes a lot of code.
I may just port the Pololu version as there is less code to modify, and it seems to run ok, especially in single shot long range mode in their library.
Ideally, I would like to see if I can test at longer ranges, for operation at night !
The Adafruit compiles and works out of the box, the only problem is that sometimes the sensor will not work without switching cycling the power off/on. A bit frustrating sometimes.
Pololu’s library did not compile without some minor changes but is better in all other aspects IMHO.
Impressed by the VL530lox accuracy and speed.
I agree the Pololu lib seems to work well, and seems to be better than the Adafruit lib.
The Adafruit lib seems to use STM’s files, but the setup of these devices is the hard bit, and Pololu’s setup seems better
I found the single shot mode more useful than the continuous, but I wanted to measure long distances i.e over 1m.
[RogerClark – Mon Aug 14, 2017 10:22 am] –
I didn’t remember needing to change anything to make the Pololu library work, but perhaps I did.
I was getting error: call of overloaded ‘write(long unsigned int)’ is ambiguous with writeReg32Bit() I changed it to the following which gets rid of it…not sure if thats the best way
// Write a 32-bit register
void VL53L0X::writeReg32Bit(uint8_t reg, uint32_t value)
{
Wire.beginTransmission(address);
Wire.write(reg);
Wire.write((byte)(value >> 24) & 0xFF); // value highest byte
Wire.write(((byte)value >> 16) & 0xFF);
Wire.write(((byte)value >> 8) & 0xFF);
Wire.write( (byte)value & 0xFF); // value lowest byte
last_status = Wire.endTransmission();
}
yes. I valuely remember that one…
I will see what I did to fix it.
Strangely the Wire library uses uint8 as the type for Write() so “uint8” must be defined somewhere, but is not part of the include path for that library
I think this is something that probably needs to be fixed in the core