The Adafruit APDS9960 Proximity Sensor is a multifunctional sensor capable of detecting proximity, gestures, and ambient light. It offers a simple yet effective way to add touchless interaction to your projects. This sensor is commonly used in applications such as gesture-controlled interfaces, touchless switches, and user presence detection.
Pin Number | Name | Description |
---|---|---|
1 | VIN | Power supply (3.3V to 5V) |
2 | GND | Ground |
3 | SCL | I2C clock |
4 | SDA | I2C data |
5 | INT | Interrupt output (active low) |
To use the APDS9960 sensor in a circuit:
#include <Wire.h>
#include <Adafruit_APDS9960.h>
Adafruit_APDS9960 apds;
void setup() {
Serial.begin(9600);
if (!apds.begin()) {
Serial.println("Failed to initialize sensor!");
while (1);
}
apds.enableProximity(true);
}
void loop() {
uint8_t proximity_data;
if (!apds.readProximity(proximity_data)) {
Serial.println("Failed to read proximity value!");
return;
}
Serial.print("Proximity: ");
Serial.println(proximity_data);
delay(250);
}
This example initializes the sensor and continuously reads the proximity data, printing it to the serial monitor.
Q: Can the APDS9960 sensor work with both 3.3V and 5V systems? A: Yes, the sensor can be powered with 3.3V to 5V, making it compatible with a wide range of microcontrollers.
Q: How can I use the interrupt feature? A: Connect the INT pin to an interrupt-capable pin on your microcontroller and configure an interrupt service routine to handle events.
Q: What is the maximum range of the proximity sensor? A: The proximity sensor can detect objects up to 100 mm away.
Q: Can the sensor detect color and light intensity? A: Yes, the APDS9960 includes ambient light and color sensing capabilities.
For further assistance, consult the Adafruit APDS9960 datasheet and the library documentation for advanced features and functions.