Skip to content

depau/python-apds9930

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python module for APDS-9930 sensor

Python module for the APDS-9930 I2C Ambient Light and Proximity sensor

This is a Python port of the AVR APDS-9930 library.

Simple and easy to use. Makes heavy use of Python-specific programming concepts, such as properties, to make usage even easier. Depends on python-smbus, the I2C library for Python.

DO NOT EMAIL ME IF YOU HAVE AN ISSUE

It will be deleted without reading. If you have an issue, create an issue here on GitHub.

Unmaintained

I'm not going to maintain this library any more. I will merge pull requests, though. Contributions are welcome. Just don't expect anything from me.


I tested this on Linux a desktop computer, using the I2C pins of a nVidia graphics card, using the Nouveau graphics driver. This has been reported to work for both ATI and nVidia cards, but not for integrated Intel (and I can confirm this).

Check the pinout:

Graphics-I2C pinout

Color Pin Usage
Gray 5 GND
Red 9 +5V/VCC
Yellow 15 SCL (serial clock)
Blue 12 SDA (serial data)

For more pinouts and information, check this article

It should work on Raspberry PI. I'll be testing it on a Raspberry PI 2 as soon as I get it.

Basic usage

Load the i2c-dev kernel module.

sudo modprobe i2c-dev

Install i2c-tools to get the i2cdetect program, useful to scan for I2C devices.

sudo apt-get install i2c-tools

List the I2C buses

sudo i2cdetect -l

Connect the device to the I2C pins, then scan every bus until you find the device. Device should have address 0x39.

sudo i2cdetect -y <bus number>

# Sample good output
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- 39 -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Once you have found the correct bus, run Python as root and import the module.

sudo python

>>> from apds9930 import APDS9930

Open the bus

>>> a = APDS9930(bus_number)

That's it! You can find the full documentation at ReadTheDocs

About

Python library for the APDS-9930 I2C Ambient Light and Proximity sensor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages