Skip to content

Commit e9a29dc

Browse files
committed
Add some documentation.
1 parent f5baee8 commit e9a29dc

2 files changed

Lines changed: 71 additions & 0 deletions

File tree

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Python APDS-9960 Library
2+
3+
Python library for the APDS-9960 gesture sensor developed while I was looking to get the APDS-9960 to work with a _Raspberry Pi_ to build a user interface feeling like in _Minority Report_.
4+
5+
This library is a port of the [APDS-9960 Raspberry Pi Library](https://bitbucket.org/justin_woodman/apds-9960-raspberry-pi-library) of [Justin Woodman](https://justinwoodman.wordpress.com/2014/11/15/using-the-apds-9960-rgb-proximity-and-gesture-sensor-with-the-raspberry-pi-2/). Sadly his library is coded in C++ and seems not to be maintained any more.
6+
7+
This library has been tested with [SparkFun RGB and Gesture Sensor - APDS-9960](https://www.sparkfun.com/products/12787) but should work with any other APDS-9960 based I²C device, too.
8+
9+
Features:
10+
- operational voltage: 3.3V
11+
- ambient light & RGB color sensing
12+
- proximity sensing
13+
- gesture detection
14+
- operating range: 10 - 20cm
15+
- I²C interface (hard wired I²C address: 0x39)
16+
17+
Documentation:
18+
- [RPi](RASPBERRY.md) - connect and configure the APDS-9960 on Raspberry Pi
19+
- Example scripts:
20+
- [test-ambient](test-ambient) - simple ambient light level demo
21+
- [test-gesture](test-gesture) - simple gesture detection demo
22+
- [test-prox](test-prox) - simple proximity level demo
23+

RPi.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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

Comments
 (0)