Cảm Biến Cử Chỉ Và Màu Sắc APDS-9960-3.3 RGB And Gesture Sensor

69.000

Cảm biến hướng chuyển động hồng ngoại RGB Gesture APDS-9960 điện áp sử dụng: 3.3VDC. Giao tiếp I2C, cảm biến được hướng chuyển động

DỊCH VỤ & KHUYẾN MÃI LIÊN QUAN

Cảm biến hướng chuyển động hồng ngoại RGB Gesture APDS-9960 được sử dụng để nhận biết màu sắc cơ bản, hướng chuyển động và độ xa gần của vật thể phía trước cảm biến, cảm biến hướng chuyển động hồng ngoại sử dụng tia hồng ngoại để xác định vật thể, giao tiếp I2C với bộ code mẫu rất dể sử dụng.

 

Thông số của Cảm Biến Hướng Chuyển Động Hồng Ngoại RGB Gesture APDS-9960

  • Điện áp sử dụng: 3.3VDC
  • Cảm biến cường độ sáng và màu sắc cơ bản RGB.
  • Cảm biến được độ xa gần của vật thể.
  • Cảm biến được hướng chuyển động.
  • Khoảng cách cảm biến đến vật thể: max 10~20cm (tùy màu sắc, hình dạng và bề mặt vật thể).
  • Giao tiếp I2C (I2C Address: 0x39).
  • Kích thước: 20.6 x 15.1mm

Sơ đồ mạch của Cảm Biến Hướng Chuyển Động Hồng Ngoại RGB Gesture APDS-9960

Sơ đồ mạch của Cảm Biến Hướng Chuyển Động Hồng Ngoại RGB Gesture APDS-9960
Sơ đồ mạch của Cảm Biến Hướng Chuyển Động Hồng Ngoại RGB Gesture APDS-9960

Sơ đồ kết nối của Cảm Biến Hướng Chuyển Động Hồng Ngoại RGB Gesture APDS-9960

Sơ đồ kết nối của Cảm Biến Hướng Chuyển Động Hồng Ngoại RGB Gesture APDS-9960

Datasheet: https://cdn.sparkfun.com/datasheets/Sensors/Proximity/apds9960.pdf

Code mẫu Arduino: https://github.com/sparkfun/SparkFun_APDS-9960_Sensor_Arduino_Library/tree/V_1.4.2

Code tham khảo của Cảm Biến Hướng Chuyển Động Hồng Ngoại RGB Gesture APDS-9960

APDS9960 Pinout, Interfacing with Arduino, Examples Codes

Thư viện SparkFun_APDS9960.h: https://github.com/sparkfun/SparkFun_APDS-9960_Sensor_Arduino_Library/tree/V_1.4.2

/****************************************************************
 * Kết nối:
 *          APDS-9960                Uno              Mega
 *            VCC                    3.3V             3.3V
 *            GND                    GND              GND
 *            SCL                    A5               SCL
 *            SDA                    A4               SDA
 *            
 *            
 * Nạp code mở Serial Monitor chọn No line ending, baud 9600.
 * 
 * 
****************************************************************/
#include 
#include 
// Global Variables
SparkFun_APDS9960 apds = SparkFun_APDS9960();
uint8_t proximity_data = 0;
void setup() {
  // Initialize Serial port
  Serial.begin(9600);
  Serial.println();
  Serial.println(F("------------------------------------"));
  Serial.println(F("SparkFun 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!"));
  }
  // 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(proximity_data);
  }
  // Wait 250 ms before next reading
  delay(250);
}