Skip to main content

Omega Smartsensor Python SDK

Project description

Omega Smartsensor Python SDK

This Python SDK allows you to communicate with Omega Smart Sensor devices via I2C interface or Modbus interface and easily integrate them to embedded platform such as Raspberry Pi, etc...

Requirements

Python 3.5+

Installation & Usage

pip install

The package can be installed by running:

pip install omegasensor
Then import the package:

from omegasensor import *

Setuptools

Clone from repository. And Install via Setuptools from source directory:

python setup.py install --user

Getting started

import time
from omegasensor import *  

def main():    
    bus = BusModbus('/dev/ttyUSB0', SMARTSENSOR_MODBUS_ADDR)   # for Modbus interface 
    # bus = BusI2C(1, SMARTSENSOR_I2C_ADDR) # for I2C interface
    ss = Smartsensor(bus)    

    ss.soft_reset()    
    ss.preset_config()    
    print("Firmware 0x%08x" % ss.read(R.FIRMARE_VERSION))    
    print("Device Id 0x%08x" % ss.read(R.DEVICE_ID))    
    print("Device %s" % ss.read(R.DEVICE_NAME))    
    sensor_cnt = ss.read(R.NUMBER_OF_SENSORS)    
    print("Onboard %d sensors" % sensor_cnt)    
    print("Onboard %d outputs" % ss.read(R.NUMBER_OF_OUTPUTS))    

    sensor_units = [ss.sensor_unit(i) for i in range(sensor_cnt)]    

    while True:    
        print("Time: ", ss.current_time_str())    
        for i in range(sensor_cnt):    
            print("%0.2f" % ss.sensor_reading(i),    
                  " %s" % sensor_units[i],    
                  "\t", end='')    
        print('\n')    
        time.sleep(1)    


if __name__ == "__main__":    
    main()  

Examples

Examples can be found in SDK Example directory

Hardware Setup

Omega BTH-SMP smart probes can be used with the I2C interface. On Raspberry Pi, here are the connections:

Raspberry Pi BTH-SMP
Pin 3 /BCM 2 SDA
Pin 5 /BCM 3 CLK
Pin 1 3.3V
Pin 6 GND

Alternatively, Omega Smart sensor dongle can be used which converts I2C interface to Modbus interface. On Linux system, the dongle will show up as /dev/ttyUSB0 or /dev/ttyACM0 for example.

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

omegasensor-0.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

omegasensor-0.1-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file omegasensor-0.1.tar.gz.

File metadata

  • Download URL: omegasensor-0.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for omegasensor-0.1.tar.gz
Algorithm Hash digest
SHA256 d24e9bdc9c5b3ba3692c1567e19d05443ebfde760e63fbb381a04e87d53d358f
MD5 1e3cc9f881d1c1e598f7031077f4721d
BLAKE2b-256 891e3b81550c2a2c02be0f24b7cc27ace3e773d14bf2f1e6808f04d21b5d802c

See more details on using hashes here.

File details

Details for the file omegasensor-0.1-py3-none-any.whl.

File metadata

  • Download URL: omegasensor-0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for omegasensor-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 62e3b21e0843674463c0ee73da56547921ebd187b845e6cac7cd962a5f902d21
MD5 4072c77dfe95ea8bd525ed9e42781e2e
BLAKE2b-256 67139585f0e317a9612f32eae15fd4299f38adff5c49a4d68b6d84b195bab1df

See more details on using hashes here.

Supported by

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