Skip to main content

Support library for the light sensor OPT3001 from Texas Instruments

Project description

Opt3001

Python support library for the light sensor OPT3001 from Texas Instruments

Description

Contents

Install

  • sudo apt-get install -y python-smbus
  • pip install opt3001

Usage

import opt3001 from opt3001

address = 0x44

opt3001.init() 

# Configure to run in Continuous conversions mode
opt3001.write_config_req(address, pt3001.I2C_LS_CONFIG_CONT_FULL_800MS)

while(True):
  print(opt3001.read_lux_float(address))
  time.sleep(1)

Raspberry pi

Add following line to /etc/modules to start i2c module on startup:

i2c_dev

Run following commands to start the i2c modules manually:

$ modprobe i2c-bcm2708
$ modprobe i2c_dev

Install i2c-tools to test with the terminal

$ sudo apt-get install i2c-tools

Run following command to get the address of the opt3001

$ i2cdetect -y 1

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

Run the following command to test the opt30001

$ i2cget -y 1 0x44 0x00

0x0b

Flight Manual

API

init(bus = 1, address)

read_lux_fixpoint()

Development

Build

python setup.py sdist bdist_wheel

Upload

twine upload dist/*

Team

Licence

MIT

This repository was generated by charon

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opt3001-1.1.2.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

opt3001-1.1.2-py2-none-any.whl (3.3 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page