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
VL6180X freezes
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_carter
- Posts: 29168
- Joined: Tue Nov 29, 2016 2:45 pm
Re: VL6180X freezes
Post a photo of your setup showing all connections. Also, the full code your are using.
- bootsector2000
- Posts: 8
- Joined: Wed Jun 14, 2017 7:13 am
Re: VL6180X freezes
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 (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
- adafruit_support_carter
- Posts: 29168
- Joined: Tue Nov 29, 2016 2:45 pm
Re: VL6180X freezes
Have you tried powering with 3.3V instead of 5V?
- bootsector2000
- Posts: 8
- Joined: Wed Jun 14, 2017 7:13 am
Re: VL6180X freezes
Not yet, but will try tomorrow morning since it's almost 6pm in berlin and closing time is calling ;-)
- adafruit_support_carter
- Posts: 29168
- Joined: Tue Nov 29, 2016 2:45 pm
Re: VL6180X freezes
Sure thing. Might not work, but it's a good first thing to try. Report back when you've tested it out. Cheers.
- bootsector2000
- Posts: 8
- Joined: Wed Jun 14, 2017 7:13 am
Re: VL6180X freezes
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...
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...
- adafruit_support_carter
- Posts: 29168
- Joined: Tue Nov 29, 2016 2:45 pm
Re: VL6180X freezes
What Python code are you using for talking to the VL6180X?
Code: Select all
from Sector_VL6180 import VL6180X
- bootsector2000
- Posts: 8
- Joined: Wed Jun 14, 2017 7:13 am
Re: VL6180X freezes
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...
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...
- adafruit_support_carter
- Posts: 29168
- Joined: Tue Nov 29, 2016 2:45 pm
Re: VL6180X freezes
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.
- bootsector2000
- Posts: 8
- Joined: Wed Jun 14, 2017 7:13 am
Re: VL6180X freezes
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...
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...
- adafruit_support_carter
- Posts: 29168
- Joined: Tue Nov 29, 2016 2:45 pm
Re: VL6180X freezes
Don't do that. Just run this with Python 2:but that would mean to change my whole code
https://bitbucket.org/310weber/st_vl618 ... ew-default
and see if it "freezes".
Use original/unmodified module.
- bootsector2000
- Posts: 8
- Joined: Wed Jun 14, 2017 7:13 am
Re: VL6180X freezes
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
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
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
Re: VL6180X freezes
I2C was developed to communicate between chips on a computer board and the fact that it works over any distance is amazing.
- adafruit_support_carter
- Posts: 29168
- Joined: Tue Nov 29, 2016 2:45 pm
Re: VL6180X freezes
Yep. What Franklin said. And cable quality, environment, etc. will play in to how far you can go. Glad you got it working.
Please be positive and constructive with your questions and comments.