VL6180X freezes

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
bootsector2000
 
Posts: 8
Joined: Wed Jun 14, 2017 7:13 am

VL6180X freezes

Post by bootsector2000 »

Hi all,
I'm currently working on a university project for which I want to use the VL6180x TOF sensor.
The aim is to measure the distance to a water surface with a floating plastic disc on top of it to determine the water level.

I'm using the raspi 3 with the newest raspbian image for programming with python3.

besides the tof sensor there are also 2 ina219 sensors connected to the I2C bus of the raspi to measure the current in the system.

Now it appears from time to time that the output coming from the tof sensor just FREEZES and doesnt change with changing water levels. There is no error, no exception, no whatsoever... restarting the program doesnt help, only restarting the raspi seems to help for an undefined amount of time.
Sometimes the system works perfectly fine for days without any negative issues , sometimes the tof sensor stops sending its measurements after about 10 minutes.
After the tof sensor stopped, the 2 current sensors are still working so it seems like there's no problem with the I2C itself, but with the sensor.
I already changed it with a new one - same behaviour.

I'm pretty new to the whole maker world, so in my opinion I've done all I could and would very appreciate any idea coming from you about what to check.

Many thanks in advance!

Best regards, bootsector2000

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL6180X freezes

Post by adafruit_support_carter »

Post a photo of your setup showing all connections. Also, the full code your are using.

User avatar
bootsector2000
 
Posts: 8
Joined: Wed Jun 14, 2017 7:13 am

Re: VL6180X freezes

Post by bootsector2000 »

Since this is a quiet big project with hundrets of lines of code, I tried to shorten everything. The Fritzing sample is only a small excerpt of the whole project, as well as the code. FInd everything that probably matters attached.
Attachments
adasamplefritzing.png
adasamplefritzing.png (255.09 KiB) Viewed 848 times
adasample_Sector_bonsai.txt
(1.77 KiB) Downloaded 97 times
ada_sample_bonsai.txt
(1.55 KiB) Downloaded 89 times

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL6180X freezes

Post by adafruit_support_carter »

Have you tried powering with 3.3V instead of 5V?

User avatar
bootsector2000
 
Posts: 8
Joined: Wed Jun 14, 2017 7:13 am

Re: VL6180X freezes

Post by bootsector2000 »

Not yet, but will try tomorrow morning since it's almost 6pm in berlin and closing time is calling ;-)

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL6180X freezes

Post by adafruit_support_carter »

Sure thing. Might not work, but it's a good first thing to try. Report back when you've tested it out. Cheers.

User avatar
bootsector2000
 
Posts: 8
Joined: Wed Jun 14, 2017 7:13 am

Re: VL6180X freezes

Post by bootsector2000 »

1st test seems successfull.
But as I told, sometimes it works and sometimes it doesn't... I'm gonna keep testing and will send updates i couple of hours...

Update: unfortunately this didn't change anything, the tof keeps freezing...

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL6180X freezes

Post by adafruit_support_carter »

What Python code are you using for talking to the VL6180X?

Code: Select all

from Sector_VL6180 import VL6180X

User avatar
bootsector2000
 
Posts: 8
Joined: Wed Jun 14, 2017 7:13 am

Re: VL6180X freezes

Post by bootsector2000 »

It's the VL6180X Library, written by Arnie Weber, which you can find here
http://BANNED/2rzpawa

It's written for python2.xx, so I made some changes torun the lib under python3. Basically only print-statements where changed.

Update: not completely true...
I also commented out all "if self.debug:"... routines...
maybe thats why...

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL6180X freezes

Post by adafruit_support_carter »

As a quick check, can you try just running with Python 2 and using the module as is? And just write a simple Python program to exercise the VL6180X and see if you can recreate the freezing behaviour with Python 2 and unmodified module.

User avatar
bootsector2000
 
Posts: 8
Joined: Wed Jun 14, 2017 7:13 am

Re: VL6180X freezes

Post by bootsector2000 »

well thats a lot of work... I just changed the <if self.debug >statements to python3
I can try using python2 next week, but that would mean to change my whole code...

Update: changes didn't improve anything :-(
will try it with python2 next week...

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL6180X freezes

Post by adafruit_support_carter »

but that would mean to change my whole code
Don't do that. Just run this with Python 2:
https://bitbucket.org/310weber/st_vl618 ... ew-default
and see if it "freezes".

Use original/unmodified module.

User avatar
bootsector2000
 
Posts: 8
Joined: Wed Jun 14, 2017 7:13 am

Re: VL6180X freezes

Post by bootsector2000 »

So I did try using the original library with python2 - didn't work.
I tried another new sensor AND a new Raspi without success.
Last thing to check was the wiring even though I DO get data from the sensor. I shortened every connection cable from about 30cm to about 20cm.
Now it works and I get perfect values from the VL6180x. I read an article about the I²C bus which I can't find anymore where the author said something about cable lengths up to 50m.
I Definitely can't confirm that, but the problem is solved anyway.

Thanks for your hints!
I hope this will help prevent struggling with the same problem for other makers :-)

Best regards, bootsector2000

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: VL6180X freezes

Post by Franklin97355 »

I2C was developed to communicate between chips on a computer board and the fact that it works over any distance is amazing.

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL6180X freezes

Post by adafruit_support_carter »

Yep. What Franklin said. And cable quality, environment, etc. will play in to how far you can go. Glad you got it working.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”