VL53L0X Teensy 3.5

Status
Not open for further replies.

hnaki

New member
Hi Everyone,

I am trying to use the Adafruit vL53L0X on the teensy 3.5. I have made the following connection: <Vin = 3.3V> <GND = GND> <SCL = A5/19> <SDA = A4/18>. I am currently trying to run the "continuous.ino" example but keep getting the following error: 65535. Below is the example I am using:
/* This example shows how to use continuous mode to take
range measurements with the VL53L0X. It is based on
vl53l0x_ContinuousRanging_Example.c from the VL53L0X API.

The range readings are in units of mm. */

#include <Wire.h>
#include <VL53L0X.h>

VL53L0X sensor;

void setup()
{
Serial.begin(9600);
Wire.begin();

sensor.init();
sensor.setTimeout(500);

// Start continuous back-to-back mode (take readings as
// fast as possible). To use continuous timed mode
// instead, provide a desired inter-measurement period in
// ms (e.g. sensor.startContinuous(100)).
sensor.startContinuous();
}

void loop()
{
Serial.print(sensor.readRangeContinuousMillimeters());
if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

Serial.println();
}
 
Without seeing a picture of you wiring try connecting vin to the 5v pin just as a test. I have used this sensor without a problem with a teensy 3.5 with the only difference being that I connected vin to 5v. If you are using a t3.6 I would connect it to 3.3v. According to the spec sheet the I2C level shifters pull up the voltage to the Vin logic level.
 
Mjs513,

Thanks for the feedback!

I had it working on the Arduino fine. But once I transferred it to the Teensy 3.5 with the above example code; I get the following error: 65535.

My connections are as follows:

Teensy 3.5 VL53L0X
3.3V(250mA max) Vin
Analog GND GND
Pin 19/A5 SCL
Pin 18/A4 SDA
 
Mjs513,

Thanks for the feedback!

I had it working on the Arduino fine. But once I transferred it to the Teensy 3.5 with the above example code; I get the following error: 65535.

My connections are as follows:

Teensy 3.5 VL53L0X
3.3V(250mA max) Vin
Analog GND GND
Pin 19/A5 SCL
Pin 18/A4 SDA

Hi hnaki,

I was wondering if you've found a solution to this problem. I am in the exact same situation where I got the VL53L0X to give distances on the Arduino UNO and the Teensy 3.2 but can't seem to get any readings other than 65535 on the Teensy 3.6. I've tried to connect the VL53L0X's Vcc into the Vin and the 3.3v of the T3.6 but they didn't make a difference.

Thanks!
trixr

Edit: Here is an image of my setup
teensy3.6_vl53l0x.jpg
 
Last edited:
Same problem here with VL53L0X and Teensy 3.5.
I2C Scanner detects it at 0x29 but begin() just throws an error.
Did anyone solve it?
 
From your picture of the wiring, you do not have pull-up resistors installed. Some devices provide pull-up resistors, so do not. So, try adding two pull-up resistors, one between pin 18/A4 (SDA) and 3.3v and the other between pin 19/A5 (SCL) and 3.3v. These resistors are in parallel to to the data wire that connects the SDA and SCL pins to the device. For a simple i2c bus with 1-2 devices, you would typically want a 2.2K resistor for each of the pull-up resistors.

Second, do not connect 5v to the VIN of the I2c device, connect 3.3v.

If your i2c device needs 5v power, the first solution is to search around for a different device that can work at 3.3v directly. Note, if you use a Teensy LC, 3.6, or 4.0, you might wind up frying your Teensy, since those microprocessors are not tolerant of more than 3.3v on the data pins.

If you do need to convert your i2c bus to 5v, there are level shifters that you plug the 3.3v stuff on one side and it converts to/from 5v on the other. While I've done this in the past with an i2c display that needed 5v, it is better not to have to do the level shifting.
 
Thank you. The photos are from a different user. I actually have pullups installed (4.7k from SDA and SCL each to 3V3) and connected VIN to 3V3. No 5V being used. I am not drawing too much current from the Teensy's 3V3, am I?
 
If I remember correctly, the VL53L0X needs to be configured differently depending on the supply voltage (1.8, 3.3, or 5V). It might be that the Adafruit library does set the VL53 configuration hard coded to 5V which implies problems when operating at lower voltages and which explains the problems starting from begin() where the initialization happens. You should check the library's source code and the VL53L0X data sheet and modify the configuration data block which the library sends to the VL53 during initialization.
 
The chip operates at 2.8V. The adafruit board comes with an on-board voltage regulator so it can work at 3.3V or 5V. I connected it to 3V3 and I measure 2.8V at the output of the regulator, so that seems to be fine.
 
@travelboy

Just hooked up my VL53L0X and did a couple of tests both in continuous mode.

If you use the Pololu Library - EDIT: My fault - just tested and it is working on the T4

If you use the Adafruit_VL53L0X library it is working:
Code:
Reading a measurement... Distance (mm): 125
Reading a measurement... Distance (mm): 122
Reading a measurement... Distance (mm): 121
Reading a measurement... Distance (mm): 122
Reading a measurement... Distance (mm): 125

EDIT: Configuraturation:
3.3v to Vin
Gnd to GND
SDA to SDA (pin 18)
SCL to SCL (pin 19)

No pullups needed.

EDIT: What sensor are you using (pololu, adafruit or sparkfun);
 
Last edited:
Thank you. The photos are from a different user. I actually have pullups installed (4.7k from SDA and SCL each to 3V3) and connected VIN to 3V3. No 5V being used. I am not drawing too much current from the Teensy's 3V3, am I?

Yes, I was responding to the user trixr. I should have quoted part of the header, so it was obvious who I was talking to.

But it looks like other users with the VL53LOX are chiming in.
 
Status
Not open for further replies.
Back
Top