Skip to content

Port of maxlklaxl/python-tsl2591for micropython-based devices like the ESP8266.

License

Notifications You must be signed in to change notification settings

elschopi/micropython-tsl2591

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Micropython TSL2591 module

This is a simple python library for the Adafruit TSL2591 breakout board based on the Arduino library from Adafruit. python-tsl2591 was developed to work on a Raspberry PI. I then forked it to create a Micropython version. There were two changes from the original:

  1. Micropython does not provide an smbus api, so smbus was emulated on top of the lower-level I2C library it does provide.
  2. The ESP8266 and other chips are severely memory limited. With the Raspberry Pi version, even importing the tsl2591 module caused it to run out of memory on the ESP8266. The code was simplified were possible and all the comments stripped out.

INFO

Coming soon...

Installing

Just copy tsl2591.py to your micropython board. Micropython's webrepl has experimental support for copying files. I instead used the mpfshell to copy files to my ESP8266 board.

Quickstart

import tsl2591

tsl = tsl2591.Tsl2591()  # initialize
full, ir = tsl.get_full_luminosity()  # read raw values (full spectrum and ir spectrum)
lux = tsl.calculate_lux(full, ir)  # convert raw values to lux
print lux, full, ir

License

Python files in this repository are released under the MIT license.

About

Port of maxlklaxl/python-tsl2591for micropython-based devices like the ESP8266.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%