GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#1 Post by bastler11 » 11 Aug 2023, 08:12

Hello, I use the GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight. The firmware on the ESP I use is from 2021 a "Test" version. Now I tried to use the new Collection B.
If I flash the ESP the sensor is available, but there is no value. Also after a reboot. If I flash it back to the old version it shows the value.
Does anyone has an idea to fix the problem?

Thanks and best regards!

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#2 Post by Ath » 11 Aug 2023, 09:42

That should work as before, so this is a bit odd.
I'll hook up a VL53L0X (I have one on my bench, not connected yet) and do some tests.
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#3 Post by Ath » 11 Aug 2023, 10:17

I've tested using the 20230623 build available from the Releases page, and also with current latest 'mega' branch (latest development state, waiting to be released) and from both I get this in the serial log:

Code: Select all

30374 : Info   : VL53L0X: Address: 0x29 / Timing: 80 / Long Range: 0 / Distance: 112
30580 : Info   : EVENT: VL53L0X#Distance=112.00
35164 : Info   : VL53L0X: Address: 0x29 / Timing: 80 / Long Range: 0 / Distance: 113
35170 : Info   : EVENT: VL53L0X#Distance=113.00
40164 : Info   : VL53L0X: Address: 0x29 / Timing: 80 / Long Range: 0 / Distance: 116
40168 : Info   : EVENT: VL53L0X#Distance=116.00
(Interval set to 5 seconds)
So it's working fine over here.

Have you tried the I2C Scanner on the Tools page to see if the sensor is actually recognized?
It will only show the 0x29 (or 0x30 when configured that way) address, not the name of the sensor, like the old TEST builds used to show. The names have been removed from the Collection builds some time ago to save some .bin space, and allow for more plugins/features to remain enabled.
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#4 Post by Ath » 11 Aug 2023, 10:31

We also added a new feature that will check on initialization of a task if the hardware is actually recognized, and disable the task if the hardware is not found (and also after 10 consecutive failures while reading the sensor). (This is added to eliminate unexpected delays/hangs when an I2C device looses connection for some reason, blocking the regular working of the ESP.)
You might want to verify if the task is still enabled.

If this feature causes issues, it can be disabled on the Tools/Advanced page un-checking the 'Check I2C devices when enabled:' checkbox and submitting the page. For this sensor it should not be needed to disable that setting, most likely it'll be caused by hardware or wiring issues. (I2C wires should not be > 30 cm, and have pull-up resistors installed, but most boards have that included)

NB: When you have the VL53L1X sensor installed, but use the VL53L0X plugin/task, then the output will also be 0, as these sensors are not software compatible.
From the log (VL53L1X plugin enabled but VL53L0X installed):

Code: Select all

1326665 : Info   : VL53L1X: Sensor not found, init failed for 0x29
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#5 Post by bastler11 » 11 Aug 2023, 11:39

Thanks for reply.

I think there is a mistake from my side :oops: . I have the VL53L1X and not the VL53L0X.

I just tried to install the actual Collection B with and without VCC. In both cases the sensor (VL53L1X) is first enabled and the values are 0. If I try to edit any thing (change the time from 120s to 60s) and click on submit the enable button is empty and I could not set it again. If I make a reboot the sensor again is enabled, ....

If I flash back to ESP_Easy_mega_20210414_normal_ESP8266_4M1M.bin it works with correct values?

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#6 Post by Ath » 11 Aug 2023, 11:50

Then try to disable that setting from Tools/Advanced: 'Check I2C devices when enabled:', to see if that makes a difference. I'll search for my VL53L1X and test with that one too.
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#7 Post by bastler11 » 11 Aug 2023, 12:29

I disabled that setting from Tools/Advanced: Check I2C devices when enabled.

And now I could enable the sensor and it shoes also values. So is there any bug in the plugin?

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#8 Post by Ath » 11 Aug 2023, 12:50

First investigation learned me that the used library has changed their interface nearly a year ago. Some months ago we pulled all libraries local in ESPEasy source code, but we haven't noticed this change (no testbed with all plugins available :shock: and nobody reported this issue until now :roll:)

I'm working on a fix.
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#9 Post by bastler11 » 11 Aug 2023, 13:18

Thanks, hope it is not too much work :-)

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#10 Post by Ath » 11 Aug 2023, 15:16

I've fixed the library, and also made some small code-improvements.
A build is running in this Github Actions run. If you are logged in to Github (account is free) you can download the binaries once the build is finished.

Please report your findings after testing this build; my local testing was successful :D

Code: Select all

2985150 : Info   : VL53L1X: Address: 0x29 / Timing: 100 / Long Range: 0 / Distance: 460
2985153 : Info   : EVENT: VL53L1X#Distance=460.00
2985157 : Info   : EVENT: VL53L1X#Ambient=3416.00
NB: When running the current ESPEasy build, most likely the I2C scanner will show the sensor at address 0x14 (at least it did that during my testing, before the fix was applied).

The cause was that the library right-shifts the I2C address when it is set (0x29 >> 1 = 0x14), and ESPEasy always sets the I2C address during initialization, as it is a configurable item... Smells like poor testing at the supplier side, but I can't yet explain why we didn't encounter this before, as it has been in the library 'forever'. So maybe also poor testing on my side (though it worked fine in the past, as you have confirmed by successfully running an older build) :ugeek:
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#11 Post by bastler11 » 11 Aug 2023, 16:15

Thanks for the information, I will try it in the evening and will report!

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#12 Post by Ath » 11 Aug 2023, 16:30

I'm still working on it, as it's not really acting consistent yet, I'll update later today.
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#13 Post by bastler11 » 11 Aug 2023, 18:52

I just load the file from Github. After rebooting, there was no value. Then I set the time to 1 sec. and it works. But after enabling "Check I2C devices" it is again not possible to enable the VL53L1X. Then I make a reboot and the in the device overview you could see the enabled VL53L1X. But if you try to edit it the sensor is disabled and then it is not possible to enable it, only with a reboot. Hope the helps.

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#14 Post by Ath » 11 Aug 2023, 19:59

I've made some progress.
What I've done so far:
- Upgrade to the latest VL53L1X library (we where still at the version that I originally used when adding the plugin :oops:)
- Disable setting the I2C address of the sensor during initialization

That last action alone seems to have fixed the entire issue, I have my sensor running with that fix for over 2.5 hours without a single failure!

Next steps:
- Keep the updated VL53L1X library ('the latest is the greatest'... ;))
- Disable the address selection (limiting the list to 1 item, as sometime in the future the underlying issue may be fixed, so we can restore it easily)
- Provide you with the new build for testing

About that I2C address selection: The only way the sensor address can be changed is via software, by writing the desired address to the sensor, but this has 2 blocking issues: The only feasible reason to change the address is if you would want to connect 2 of these sensors on the same I2C bus. But reprogramming the address will only work if only one on that address would respond to the request, and that's impossible, as they both have the same address, hence will both change their address... Proposed solution: Switch off one of the sensors while programming the other: Taking away the VIN for this sensor causes the I2C bus to block (both SCL and SDA pulled low), making it impossible to re-program the other sensor...
Real solution when connecting multiple sensors using the same I2C address: Use an I2C multiplexer :) We support 4 models of I2C multiplexers, with 2, 4 or 8 separate channels, (only 1 multiplexer per I2C bus allowed, and we only have 1 I2C bus at the moment...), allowing up to 8 of the same sensors on a single ESPEasy unit.
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#15 Post by Ath » 11 Aug 2023, 20:15

New Github Actions run should be finished ~40 minutes or 1.5 hours from now (another run just was started).

Please test and provide your findings here.

Edit: updated link
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#16 Post by bastler11 » 11 Aug 2023, 21:55

Seems that there is still a problem - Check I2C devices is enabled - the TOF sensor could not enabled. After switching of I could it enable but shows no values :(

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#17 Post by Ath » 11 Aug 2023, 21:57

Did you disconnect the power at least once after the update? That might help, as previous attempts may have left it in a limbo state :?:
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#18 Post by bastler11 » 11 Aug 2023, 22:11

No I did not, the sensor is outside in the garden and now it is dark. I will try it tomorrow. But I tried to flash with the old firmware from 2021 and that is working, the values are there. Than I tried the new firmware again, but the TOF sensor still does not work. So could disconnect the power bring any success? We will see tomorrow.

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#19 Post by bastler11 » 12 Aug 2023, 09:51

Good morning together,

I disconnected the power of the ESP and the values are there (ambient and waterlevel). :)

What I remarked, when I set "Send event when value unchanged" the water level value is a moment "0" after closing the edit page. When I disabled "Send event when value unchanged" then also for a moment the value is "0". But the value of ambient will be shown the whole time. Is that ok?

Thanks!

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#20 Post by bastler11 » 12 Aug 2023, 13:26

I have one more question.

I have an other ESP8266 with an OLED SSD1306 display and want now to connect a VL530X sensor, to show the distance value on the display. How do I connect the sensor to the board?

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#21 Post by Ath » 12 Aug 2023, 13:43

bastler11 wrote: 12 Aug 2023, 13:26 I have an other ESP8266 with an OLED SSD1306 display and want now to connect a VL530X sensor, to show the distance value on the display. How do I connect the sensor to the board?
Both devices need an I2C connection, and as they have different addresses, you can just connect the SCL and SDA connections in parallel to the I2C pins, as configured on the Hardware tab.
Both devices also need GND and 3.3V connected of course ;) you can also take that from the ESP, assuming it's a Wemos D1 Mini or NodeMCU clone, as those have a sufficient regulator for 3.3V on board.

When configuring the display you can just use predefined text, using something like "Distance: [VL53L0X#Distance#d4] mm" (no quotes needed, just added here for readability)
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#22 Post by bastler11 » 12 Aug 2023, 14:43

Thanks, it works!
Attachments
IMG_4021.jpeg
IMG_4021.jpeg (1.66 MiB) Viewed 4530 times

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#23 Post by bastler11 » 12 Aug 2023, 14:49

In the moment I use 2 input signals, the value from the analog input and the distance. Both are showing one after the other. How could I switch with a contact between both values? GPIO X on ground -> value distance, GPIO open -> analog input?

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#24 Post by Ath » 12 Aug 2023, 15:52

You can increase the number of lines per frame, so multiple lines will be shown, but the font size will decrease, and looking at your already quite small display, not sure if that's readable enough :shock:

When keeping 2 frames:
Based on a Switch (== GPIO input pin) send either oledframedcmd,frame,1 for the first set of lines, and oledframedcmd,frame,2 for the second set of lines.

The interval can't be set to 0 for this plugin, so the data will still be alternated between the 2 frames after the interval expires. Will see if the Interval option can be changed so 0 is also possible (will discuss with TD-er), though that will stop the switching of the frames, it might be just what the doctor ordered ;). Edit: Cancelled, when having the Interval at 0, the display content won't be refreshed...

3rd option:
Use the button configuration option, and set the checkbox "Step through frames with Display button:" enabled, it does exactly what the label says.
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#25 Post by Ath » 12 Aug 2023, 17:16

And an alternative, 4th, option:
use Rules to set the display content:

Code: Select all

On Switch#State Do
  If %eventvalue1%=0
    OledFramedCmd,1,"Abstand [VL53L0X#Distance#d4] mm"
  Else
    OledFramedCmd,1,"Voltage [SysInfo#VCC#d2.1] V"
  Endif
Endon
In the Switch configuration you should set the Send Boot state option enabled, so it will display something after boot.
/Ton (PayPal.me)

bastler11
Normal user
Posts: 105
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#26 Post by bastler11 » 13 Aug 2023, 09:59

Thanks, if I use "Step through frames with Display button". I have this configuration.
Screenshot-Aug.-13-2023_09.49.29.jpg
Screenshot-Aug.-13-2023_09.49.29.jpg (23.49 KiB) Viewed 4433 times
If I tap the GPIO to ground the shown value is either distance or voltage. But if the value changes for example from 10mm to 50mm on the display nothing happens. I have to change from distance to voltage, then I got the actual value. What I have to do to see every time the actual value?

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#27 Post by Ath » 13 Aug 2023, 13:07

Then you'd better use the 4th option I suggested, using these rules (replacing the existing one I gave before):

Code: Select all

On System#Boot Do // If this rule already exists, add the code to the existing On System#Boot Do rule!
  LoopTimerSet,1,5 // Update display every 5 seconds with new data
Endon

On Rules#Timer=1 Do // Handle loop-timer
  AsyncEvent,UpdateDisplay=[Switch#State]
Endon

On Switch#State Do // Handle switch
  AsyncEvent,UpdateDisplay=%eventvalue1%
Endon

On UpdateDisplay Do // Common update display rule
  If %eventvalue1%=0
    OledFramedCmd,1,"Abstand [VL53L0X#Distance#d4] mm"
  Else
    OledFramedCmd,1,"Voltage [SysInfo#VCC#d2.1] V"
  Endif
Endon
Note:
- The display should NOT have any preset Lines 1..12 configuration
- The Button should NOT be configured in the Display settings, but via a separate Switch task

NB: Air-code... untested ;)
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#28 Post by Ath » 14 Aug 2023, 09:10

The fixes have been merged into the mega branch of ESPEasy, and will be included in the next release version, that is planned 'Real Soon Now (r)' ;)
You can download the current mega build from this Github Actions run.
Please test and report your findings here, or in the GH Issue TD-er opened for that
/Ton (PayPal.me)

woob
New user
Posts: 2
Joined: 22 Oct 2023, 17:20

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#29 Post by woob » 22 Oct 2023, 18:17

FYI
Tested with ESP_Easy_mega_20231013_collection_B_ESP32_4M316k.bin on GY53 VL53L1X using ESP32-wroom32D using SDA:Gpio21 SCL:Gpio22
Still won't work.
Device shortly enables after boot, then disables. Not possible to enable normally.
But I would really like this to work.

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#30 Post by TD-er » 22 Oct 2023, 19:48

Can you uncheck "Check I2C devices when enabled" on the Tools->Advanced page?
Does the device show up on the I2C scanner page?

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#31 Post by Ath » 22 Oct 2023, 21:11

And also be sure to use the correct plugin, there could easily be confusion about either the VL53L0X and the VL53L1X, but unfortunately they are not compatible with each other (at all!), despite only the minor difference in the device type-name. And on top of that, they both use the same I2C address...
/Ton (PayPal.me)

woob
New user
Posts: 2
Joined: 22 Oct 2023, 17:20

Re: GY-530 VL53L0X Laser Ranging Sensor Time-of-Flight

#32 Post by woob » 24 Oct 2023, 23:48

Thank you for your reply.
When "Check I2C devices when enabled" is enabled, the device show under address 0x30 under "I2C Scan"
When "Check I2C devices when enabled" is disabled, the device doesn't show under "I2C Scan" Then it's also possible to enable the device.

I have both, VL53L0X and the VL53L1X, but this is about the VL53L1X (Tested with ESP_Easy_mega_20231013_collection_B_ESP32_4M316k_ETH.bin on GY53 VL53L1X using ESP32-wroom32D using SDA:Gpio21 SCL:Gpio22)

Post Reply

Who is online

Users browsing this forum: No registered users and 41 guests