|
| 1 | +# APDS-9960 on Raspberry Pi |
| 2 | + |
| 3 | +## Wiring |
| 4 | + |
| 5 | +The APDS-9960 can be connected to the I²C bus of the RPi using the P01 header: |
| 6 | + |
| 7 | +| Board Pin | Function | RPi Pin | RPi Function | |
| 8 | +|-----------|--------------|----------|----------------| |
| 9 | +| VL | IR LED Power _(optional)_ | n.c. | _(not connected)_ |
| 10 | +| GND | Ground | P01-9 | GND |
| 11 | +| VCC | +3.3V | P01-1 | 3.3V PWR |
| 12 | +| SDA | Data | P01-3 | I2C1 SDA |
| 13 | +| SCL | Clock | P01-5 | I2C1 SCL |
| 14 | +| INT | Interrupt | P01-7 | GPIO 4 _(optional)_ |
| 15 | + |
| 16 | + |
| 17 | +## I²C |
| 18 | + |
| 19 | +You need to have enabled loading of the I²C kernel module. You might use `raspi-config` to enable I²C: |
| 20 | +- run `raspi-config` |
| 21 | +- select `5 Interfacing Options` |
| 22 | +- enable `P5 I2C` |
| 23 | + |
| 24 | +The APDS-9960 supports a I²C clock up to 400KHz (default is 100KHz). To speed up detection performance you should increase the clock rate be using the following option in `/boot/config.txt`: |
| 25 | + |
| 26 | +``` |
| 27 | +dtparam=i2c_arm=on,i2c_baudrate=400000 |
| 28 | +``` |
| 29 | + |
| 30 | +A reboot is required to apply the change. |
| 31 | + |
| 32 | + |
| 33 | +## Verify |
| 34 | + |
| 35 | +To verify your setup use the `i2cdetect` command. The APDS-9960 chip is hard coded at the address 0x39: |
| 36 | + |
| 37 | +```shell |
| 38 | +# i2cdetect -y 1 |
| 39 | + 0 1 2 3 4 5 6 7 8 9 a b c d e f |
| 40 | +00: -- -- -- -- -- -- -- -- -- -- -- -- -- |
| 41 | +10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
| 42 | +20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
| 43 | +30: -- -- -- -- -- -- -- -- -- 39 -- -- -- -- -- -- |
| 44 | +40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
| 45 | +50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
| 46 | +60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
| 47 | +70: -- -- -- -- -- -- -- -- |
| 48 | +``` |
0 commit comments