APDS9900 APDS 9900 Proximity Sensor not operable in ESP8266

So I connected VL53L0x ToF sensor (It should be APDS9900 APDS 9900 Proximity Sensor) to my ESP8266 board with this configuration: SLC to D1, SDA to D2, VCC to 3V3, and GND to GND. Then I tested it using I2C Scanner and it found a device with class 0x39 which corresponds to my sensor. But when I used the adafruit example sketch for VL53L0x, it gives error said the sensor isn't connected. Below are some documentaries for this post:



Here's the code used:

#include "Adafruit_VL53L0X.h"

Adafruit_VL53L0X lox = Adafruit_VL53L0X();

void setup() {
  Serial.begin(115200);

  // wait until serial port opens for native USB devices
  while (! Serial) {
    delay(1);
  }
  
  Serial.println("Adafruit VL53L0X test");
  if (!lox.begin()) {
    Serial.println(F("Failed to boot VL53L0X"));
    while(1);
  }
  // power 
  Serial.println(F("VL53L0X API Simple Ranging example\n\n")); 
}


void loop() {
  VL53L0X_RangingMeasurementData_t measure;
    
  Serial.print("Reading a measurement... ");
  lox.rangingTest(&measure, false); // pass in 'true' to get debug data printout!

  if (measure.RangeStatus != 4) {  // phase failures have incorrect data
    Serial.print("Distance (mm): "); Serial.println(measure.RangeMilliMeter);
  } else {
    Serial.println(" out of range ");
  }
    
  delay(100);
}

The problem could be your soldering.
VCC of the module is definately a cold solder joint.
Leo..

1 Like

Simple Tests to Check for Pull-ups:

  1. Blink Test (Using Arduino Blink Example):
    • Upload the basic Blink sketch to your Arduino.
    • Measure the voltage on the SCL and SDA pins.
    • If these lines measure close to Vcc, there are likely pull-up resistors on the bus.
    • The Blink sketch helps because I²C pins should default to input mode or be floating.
  2. Divider Test (No Arduino Connected):
    • Power up the I²C modules without connecting them to the Arduino.
    • Connect a 10kΩ resistor from SDA or SCL to ground, then measure the voltage on the line.
    • If the voltage reads around half of Vcc, there's likely a 10kΩ pull-up present (forming a voltage divider).
    • If the voltage reads 0V, then no pull-up is present.
    • Other voltage readings may indicate different pull-up values.
    These basic tests help you understand what’s already present on the bus and allow you to size your external pull-ups appropriately.
    Try this:
    Serial.print ("\n SDA = "); Serial.print(digitalRead(SDA)); Serial.print(" "); Serial.print(SDA);
    Serial.print ("\n SCL = "); Serial.print(digitalRead(SCL)); Serial.print(" "); Serial.print(SCL);
    This will tell you if the pin is a 1 or zero, if zero more then likely there is no pull up resistor.
    It will also tell you the pin number that is associated with it.


This is really bad. You need to remove all the solder and do it again.

1 Like

Also see:

Sorry guys for the confusion, I just searched the module online and found out that this is a sensor with series TECHNO MCU APDS9900 APDS 9900. I don't know if this will works using the VL53L0x libraries, should I search for another library? And does this will works the same as ToF sensor or proximity sensor? Because we want to detect if there's an object near the sensor or not.


Oh, and should I make another post to ask for this module specificly?

You Should use this library instead?

Additional Information:

See also:

No, that would be considered as being against the forum rules. You can change the title of your post if you want to be more specific. Just hover your cursor over the title until you see a big black pencil appear, click that and you can edit your post title or / and move to another section of the forum if you want.

Okay, I just experiencing a moody APDS 9900 or APDS 9960 Proximity Sensor. I connected it to my ESP8266 and run the example sketch from Adafruit APDS 9960 library below:

#include <Wire.h>
#include <SparkFun_APDS9960.h>
 
// Global Variables
SparkFun_APDS9960 apds = SparkFun_APDS9960();
uint8_t proximity_data = 0;
 
void setup() {
  
  // Initialize Serial port
  Serial.begin(115200);
  Serial.println();
  Serial.println(F("------------------------------------"));
  Serial.println(F("APDS-9960 - ProximitySensor"));
  Serial.println(F("------------------------------------"));
  
  // Initialize APDS-9960 (configure I2C and initial values)
  if ( apds.init() ) {
    Serial.println(F("APDS-9960 initialization complete"));
  } else {
    Serial.println(F("Something went wrong during APDS-9960 init!"));
    while(1);
  }
  
  // Adjust the Proximity sensor gain
  if ( !apds.setProximityGain(PGAIN_2X) ) {
    Serial.println(F("Something went wrong trying to set PGAIN"));
  }
  
  // Start running the APDS-9960 proximity sensor (no interrupts)
  if ( apds.enableProximitySensor(false) ) {
    Serial.println(F("Proximity sensor is now running"));
  } else {
    Serial.println(F("Something went wrong during sensor init!"));
  }
}
 
void loop() {
  
  // Read the proximity value
  if ( !apds.readProximity(proximity_data) ) {
    Serial.println("Error reading proximity value");
  } else {
    Serial.print("Proximity: ");
    Serial.println(apds.readProximity(proximity_data));
    // Serial.println("Masuk nih bang");
  }
  
  // Wait 250 ms before next reading
  delay(250);
}

it works at first, but after several minute testing and configuring it, it doesn't work anymore and returns error. It says:
Something went wrong during APDS-9960 init!
Something went wrong trying to set PGAIN
Something went wrong during sensor init!

I have tried unplug the sensor and reupload the code to the board, but still it doesn't work. I have checked with I2C Scanner program, and it also returns error value 2. The program is like this:

// --------------------------------------
// 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
//    http://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(); // Arduino
   Wire.begin(4, 5); // ESP8266
 
  Serial.begin(115200);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.print ("\n SDA = "); Serial.print(digitalRead(SDA)); Serial.print(" "); Serial.print(SDA);
  Serial.print ("\n SCL = "); Serial.print(digitalRead(SCL)); Serial.print(" "); Serial.print(SCL);
  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();
    Serial.print(error);

    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
}

I have also tried to switch the cable for uploading the program, but still doesn't work. Any idea guys?

You keep bombarding us with code and ignore the fact that your soldering is bad.
First show us your corrected soldering, then we might look at the code.
Also tell us if and what kind of flux you have used.
Leo..

2 Likes

Good or Bad code will not fix or mitigate bad soldering! Follow the advice given by @Wawa @PaulRB @embeddedkiddie , I am out because it appears you have your mind made up it is code and not possibly hardware. With that in mind I am out, Good Luck!

Sorry guys, I have corrected the soldering since 5 days ago when
PaulRB gave the advice. Here's the current state of our soldering and I think its better than before.