My aim is to use VL53L0X sensors as proximity detectors. Simultaneous readings below a threshold will trigger a state change response at the device site and a notification via Blynk.
I have had two of these sensors working in the "VL53L0X_dual" example a few days ago but failed since.
In an effort to trace the problem I have run the I2C scanner sketch,
(link immediately below and code pasted below.) Schematic above
With no devices attached to Arduino MKR NB 1500, run I2C Scanner unmodified from ;
https://playground.arduino.cc/Main/sourceblock_1/index.txt?action=sourceblock&num=1
via
https://playground.arduino.cc/Main/I2cScanner/
serial output is;
15:58:45.180 ->
15:58:45.180 -> Scanning...
15:58:45.180 -> I2C device found at address 0x60 !
15:58:45.180 -> I2C device found at address 0x6B !
15:58:45.180 -> done
I then attached sensors to the arduino,
Arduino 5v to sensor Vin, Arduino Gnd to sensor Gnd,
A5 to Sensor SCL and A4 to sensor SDA.
With one VL53L0X TOF sensor device attached to Arduino MKR NB 1500, run I2C Scanner,
Serial output is;
16:06:37.474 ->
16:06:37.474 -> I2C Scanner
16:06:37.474 -> Scanning...
16:06:37.474 -> I2C device found at address 0x60 !
16:06:37.474 -> I2C device found at address 0x6B !
16:06:37.474 -> done
With two VL53L0X sensors (different from the previous run) attached to Arduino MKR NB 1500 in parallel, run the I2C Scanner,
Serial output is;
16:13:58.174 ->
16:13:58.174 -> I2C Scanner
16:13:58.174 -> Scanning...
16:13:58.174 -> I2C device found at address 0x60 !
16:13:58.174 -> I2C device found at address 0x6B !
16:13:58.174 -> done
Thinking there may be something wrong with my MKR-NB-1500 board I repeated these tests with an UNO and
all I got was a single time stamp then testing with 0,1 and 2 sensors respectively.
I am struggling to understand how I get non existent I2C devices showing up on the MKR1500 and nothing on the Uno with the same hardware attached running the same sketch.
Any suggestions for a way forward will be graciously received.
Kind regards
Vere
// --------------------------------------
// i2c_scanner
//
// Version 1
// This program (or code that looks like it)
// can be found in many places.
// For example on the Arduino.cc forum.
// The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
// Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26 2013
// V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
// by Arduino.cc user Krodal.
// Changes by louarnold removed.
// Scanning addresses changed from 0...127 to 1...119,
// according to the i2c scanner by Nick Gammon
// https://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
// As version 4, but address scans now to 127.
// A sensor seems to use address 120.
// Version 6, November 27, 2015.
// Added waiting for the Leonardo serial communication.
//
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//
#include <Wire.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknown error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000); // wait 5 seconds for next scan
}