scheg
February 2, 2022, 1:14pm
1
Hi everyone,
I'm doing a uni project involving an Arduino UNO (with IDE 1.8.20) and some other modules, but one of them is a VL6180 TOF050F ToF sensor (https://manuals.plus/m/330d105d2ba308f31e95f8790ef73d707d1d26ada57ae63125b266539fe4c2e7 ), using I2C communication. I received it today, wired it to my UNO and started with an example from the Adafurit VL6180X library, and here lies the issue.
On the serial monitor it returns the following:
"Adafruit VL6180x test!
Failed to find sensor"
I digged in to find the issue in my wiring, but I'm pretty sure I did everything right:
-VCC - 3.3V
-GND - GND
-SCL - A5
-SDA - A4
-GPIO1 - not connected
-XSHUT - D12 - PULLUP_INPUT
I found it interesting, that in the used library, it states that the default I2C address is 0x29 (Adafruit_VL6180X/Adafruit_VL6180X.h at master · adafruit/Adafruit_VL6180X · GitHub )
But checking for I2C devices with the I2C checker sktech by Nick, it finds a device with the adress 0x40.
I'm stuck. Changing the default value to 0x40 doesnt help, changing XSHUT to HIGH or LOW doesnt help either. Any ideas?
Thanks in advance
Then the problem must be in the software you changed.
scheg
February 2, 2022, 3:34pm
3
No changes made to the code, except chanhing the default adress, which didn't help, and brought avrdude errors. Following the tutorial from Adafruit, things should be plug & play.
Sorry, can't help unless you post YOUR version of the software.
dougp
February 2, 2022, 5:00pm
5
Try connecting sensor Vcc to UNO +5V rather than 3.3V per diagram 4.3.1.
scheg
February 2, 2022, 5:00pm
6
#include <Wire.h>
#include "Adafruit_VL6180X.h"
//#define VL6180X_DEFAULT_I2C_ADDR 0x29
Adafruit_VL6180X vl = Adafruit_VL6180X();
void setup()
{
pinMode(12, INPUT_PULLUP);
digitalWrite(12,HIGH);
Serial.begin(9600);
// wait for serial port to open on native usb devices
while (!Serial) {
delay(1);
}
Serial.println("Adafruit VL6180x test!");
if (! vl.begin()) {
Serial.println("Failed to find sensor");
while (1);
}
Serial.println("Sensor found!");
}
void loop() {
float lux = vl.readLux(VL6180X_ALS_GAIN_5);
Serial.print("Lux: "); Serial.println(lux);
uint8_t range = vl.readRange();
uint8_t status = vl.readRangeStatus();
if (status == VL6180X_ERROR_NONE) {
Serial.print("Range: "); Serial.println(range);
}
// Some error occurred, print it out!
if ((status >= VL6180X_ERROR_SYSERR_1) && (status <= VL6180X_ERROR_SYSERR_5)) {
Serial.println("System error");
}
else if (status == VL6180X_ERROR_ECEFAIL) {
Serial.println("ECE failure");
}
else if (status == VL6180X_ERROR_NOCONVERGE) {
Serial.println("No convergence");
}
else if (status == VL6180X_ERROR_RANGEIGNORE) {
Serial.println("Ignoring range");
}
else if (status == VL6180X_ERROR_SNR) {
Serial.println("Signal/Noise error");
}
else if (status == VL6180X_ERROR_RAWUFLOW) {
Serial.println("Raw reading underflow");
}
else if (status == VL6180X_ERROR_RAWOFLOW) {
Serial.println("Raw reading overflow");
}
else if (status == VL6180X_ERROR_RANGEUFLOW) {
Serial.println("Range reading underflow");
}
else if (status == VL6180X_ERROR_RANGEOFLOW) {
Serial.println("Range reading overflow");
}
delay(50);
}
You failed to include the new I2C address in this version of your program.
scheg
February 2, 2022, 5:11pm
8
The new I2C adress doesn't change the error, as I already wrote in the post.
The program you just posted does not show that new address.
scheg
February 2, 2022, 5:15pm
10
#include <Wire.h>
#include "Adafruit_VL6180X.h"
#define VL6180X_DEFAULT_I2C_ADDR 0x40
Adafruit_VL6180X vl = Adafruit_VL6180X();
void setup()
{
pinMode(12, INPUT_PULLUP);
digitalWrite(12,HIGH);
Serial.begin(115200);
// wait for serial port to open on native usb devices
while (!Serial) {
delay(1000);
}
Serial.println("Adafruit VL6180x test!");
if (! vl.begin()) {
Serial.println("Failed to find sensor");
while (1);
}
Serial.println("Sensor found!");
}
void loop() {
float lux = vl.readLux(VL6180X_ALS_GAIN_5);
Serial.print("Lux: "); Serial.println(lux);
uint8_t range = vl.readRange();
uint8_t status = vl.readRangeStatus();
if (status == VL6180X_ERROR_NONE) {
Serial.print("Range: "); Serial.println(range);
}
// Some error occurred, print it out!
if ((status >= VL6180X_ERROR_SYSERR_1) && (status <= VL6180X_ERROR_SYSERR_5)) {
Serial.println("System error");
}
else if (status == VL6180X_ERROR_ECEFAIL) {
Serial.println("ECE failure");
}
else if (status == VL6180X_ERROR_NOCONVERGE) {
Serial.println("No convergence");
}
else if (status == VL6180X_ERROR_RANGEIGNORE) {
Serial.println("Ignoring range");
}
else if (status == VL6180X_ERROR_SNR) {
Serial.println("Signal/Noise error");
}
else if (status == VL6180X_ERROR_RAWUFLOW) {
Serial.println("Raw reading underflow");
}
else if (status == VL6180X_ERROR_RAWOFLOW) {
Serial.println("Raw reading overflow");
}
else if (status == VL6180X_ERROR_RANGEUFLOW) {
Serial.println("Range reading underflow");
}
else if (status == VL6180X_ERROR_RANGEOFLOW) {
Serial.println("Range reading overflow");
}
delay(50);
}
Where in code in reply #6 Is the new address 0x40?
Not using that lib I guess the address, 0x40, should be used her. Likely between the ().
No, that is NOT how you include a new address. Look at the Adafruit library documentation and it gives an example of how to include an alternate address.
scheg
February 2, 2022, 5:28pm
13
The I2C scanner I used is having issues at identifying. Is it possible that the sensor is faulty?
I guess you will have to wait until someone copies the documentation and sends it to you. Please read the documentation for the library you are using.
system
Closed
August 1, 2022, 5:35pm
15
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.