Distance Proximity And Ambient Light Sensor CJMCU-9930 APDS-9930

AED 30.45



This is CJMCU 9930 APDS-9930 Digital Proximity And Ambient Light Sensor. The APDS-9930 provides digital ambient light sensing (ALS), IR LED, and a complete proximity detection system in a single 8-pin package. The proximity function offers plug-and-play detection to 100 mm (without front glass) thus eliminating the need for factory calibration of the end equipment or sub-assembly.

The proximity detection operates well in bright sunlight to dark rooms. The wide dynamic range also allows for operation in short-distance detection behind dark glass such as a cell phone.

In addition, an internal state machine provides the ability to put the device into a low power mode in between ALS and proximity measurements providing very low average power consumption. The ALS provides a photopic response to light intensity in very low light conditions or behind a dark faceplate.



• Ambient Light Sensing (ALS)

- Approximate human visual response
- Programmable interrupt capability with upper and lower thresholds
- Up to 16-bit resolution
- High sensitivity operation behind dark glass
- 0.01lux low lumen performance

• Proximity detection

- Fully calibrated to 100 mm detection
- Integrated infrared LED and synchronous LED driver
- Eliminates factory calibration of the proximity sensor
• Programmable wait timer
- Wait state power consumption - 90μA typical
- Programmable range from 2.7 ms to more than 8 seconds

• I2C interface compatible
- Up to 400kHz (I2C fast mode)
- Dedicated interrupt pin
• Sleep Mode Power - 2.2μA typical
• Small package 3.94 (L) x 2.36 (W) x 1.35 (H) mm


• Adjustable light mobile phone backlight
• Notebook / display security
• automatically enabled hands-free mode
• Automatic menu popup
• Digital camera eye sensor

Pinout of the module:


Pin Label Description
VL Optional power to the IR LED. Must be 3.0 – 4.5V
GND  Ground.
VCC Must be 2.4 – 3.6V
SDA I2C data
SCL I2C clock
INT External interrupt pin.



You need to install the following library – https://github.com/Davideddu/APDS9930 . This is an ambient light example, there are also proximity examples

We also recommend you take a look at the sparkfun library – https://github.com/sparkfun/APDS-9960_RGB_and_Gesture_Sensor/ and take a look at those examples as well

Arduino Pin      APDS-9930     Board Function
3.3V                    VCC               Power
GND                    GND               Ground
A4                       SDA               I2C Data
A5                       SCL               I2C Clock
#define DUMP_REGS
#include "Wire.h"
#include "APDS9930.h"
// Global Variables
APDS9930 apds = APDS9930();
float ambient_light = 0; // can also be an unsigned long
uint16_t ch0 = 0;
uint16_t ch1 = 1;
void setup() 
  // Initialize Serial port
  // Initialize APDS-9930 (configure I2C and initial values)
  if ( apds.init() ) 
    Serial.println(F("APDS-9930 initialization complete"));
    Serial.println(F("Something went wrong during APDS-9930 init!"));
  // Start running the APDS-9930 light sensor (no interrupts)
  if ( apds.enableLightSensor(false) ) 
    Serial.println(F("Light sensor is now running"));
    Serial.println(F("Something went wrong during light sensor init!"));
  // Wait for initialization and calibration to finish
void loop() 
  // Read the light levels (ambient, red, green, blue)
  if (  !apds.readAmbientLightLux(ambient_light) ||
        !apds.readCh0Light(ch0) || 
        !apds.readCh1Light(ch1) ) {
    Serial.println(F("Error reading light values"));
    Serial.print(F("Ambient: "));
    Serial.print(F("  Ch0: "));
    Serial.print(F("  Ch1: "));
  // Wait 1 second before next reading