Coder Social home page Coder Social logo

tsys01-python's Introduction

tsys01-python

A Python module to interface with the TSYS01 temperature sensor. Tested on Raspberry Pi 3 with Raspbian.

The python SMBus library must be installed.

sudo apt-get install python-smbus

Usage

import tsys01

TSYS01(bus=1)

sensor = tsys01.TSYS01() # Use default I2C bus 1
sensor = tsys01.TSYS01(0) # Specify I2C bus 0

init()

Initialize the sensor. This needs to be called before using any other methods.

sensor.init()

Returns true if the sensor was successfully initialized, false otherwise.

read()

Read the sensor and update the temperature.

sensor.read()

Returns True if read was successful, False otherwise.

temperature(conversion=UNITS_Centigrade)

Get the most recent temperature measurement.

sensor.temperature() # Get temperature in default units (Centigrade)
sensor.temperature(ms5837.UNITS_Farenheit) # Get temperature in Farenheit

Valid arguments are:

tsys01.UNITS_Centigrade
tsys01.UNITS_Farenheit
tsys01.UNITS_Kelvin

Returns the most recent temperature in the requested units, or temperature in degrees Centigrade if invalid units specified. Call read() to update.

tsys01-python's People

Contributors

es-alexander avatar jaxxzer avatar williangalvani avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tsys01-python's Issues

Make python3 compatible

>>> import tsys01
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/tsys01-python/tsys01/__init__.py", line 1, in <module>
    from tsys01 import TSYS01
ImportError: cannot import name 'TSYS01' from 'tsys01' (/home/pi/tsys01-python/tsys01/__init__.py)

Can't install tsys01 from pip

root@da3e94f1b811:/# pip install bluerobotics-tsys01
Collecting bluerobotics-tsys01
  Could not find a version that satisfies the requirement bluerobotics-tsys01 (from versions: )
No matching distribution found for bluerobotics-tsys01

No module named tsys01

Hey guys,

Been trying to run these scripts on a RPi 3B+ and I keep getting an import error, "no module named tsys01." I've installed python-smbus, updated, upgraded, etc. At the moment I'm just trying to run the "example.py" script. Am I missing something super obvious here?

Thanks in advance!

ImportError: No module named tsys01

I have installed smbus onto my raspberry pi using the command "sudo apt-get install python-smbus". This seemed to have been successful, however I get the error mentioned in the title when I try to run the example code. Is there any way you could help me out with this issue? Thanks :)

-Chris

check out ian black's work

https://github.com/IanTBlack/br_sensors

  1. Changed variable/function names to more closely match TSYS01 manual.
  2. Combined read() and temperature() functions into one.
  3. Split _calculate into two functions (_read_adc and _adc2temp).
  4. Added multiple selection options to give user options for selecting temperature conversion units.
  5. Changed Kelvin conversion from 273 to 273.15.
  6. Added experimental burst_avg_temperature. Rapidly takes X number of samples, drops the first and last, and averages the rest. Need to run tests to determine if it provides any benefit.
  7. Added serial number function. I'm still trying to understand how bit manipulation works, so I may have gotten this wrong. I assumed it could be manipulated the same way as _calculate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.