GithubHelp home page GithubHelp logo

omronmicrodevices / envsensor-observer-py Goto Github PK

View Code? Open in Web Editor NEW
35.0 5.0 41.0 32 KB

Python Bluetooth low energy observer example for OMRON Environment Sensor (2JCIE-BL01)

Python 100.00%
sensor environment-sensor influxdb omron-micro-devices sensor-status stdout visualization grafana omron

envsensor-observer-py's Introduction

Note

This division was reorganized already. It doesn't exist now. These contents are planning to move to 'https://github.com/omron-devhub'.

envsensor-observer-py

Python Bluetooth low energy observer example for OMRON Environment Sensor (2JCIE-BL01)(2JCIE-BU01).

  • No BLE connections are required
  • Accept advertisements from multiple sensor
  • Collect variety of environmental information from sensor beacon
    • Temperature
    • Humidity
    • Light
    • UV Index
    • Absolute pressure
    • Noise (Sound level)
    • 3-Axis Acceleration
    • Discomfort Index
    • Heatstroke risk indicator
    • Battery voltage
    • RSSI
  • 2JCIE-BU Environment Sensor (USB Type) is now supported (Advertising mode 0x01 & 0x02)

USB_Sensor

  • Flexible data logging options
    • Local CSV file (rotate every midnight)
    • Local / Remote fluentd daemon
    • Local / Remote InfluxDB
  • Tested on Raspberry Pi 3 model B (built-in Bluetooth connectivity)

Diagram

Requirements

Instructions

These instructions apply only to an up-to-date Raspbian Jessie with PIXEL, the official Raspberry PI distro.

Prerequisite

$ sudo apt-get install python-bluez

When using fluentd forwarder (Optional)

$ sudo pip install fluent-logger

When uploading data to influxDB 0.9 or higher (Optional)

$ sudo pip install influxdb
$ sudo pip install --upgrade influxdb

Device Setup

[2JCIE-BL01]

Sensor

Environment Sensor (2JCIE-BL01) must be configured as a beacon broadcaster (IM/EP).

In this mode of operation, sensor data is included in the advertisement packet to be transmitted.

Please refer to User's Manual for more details.

[2JCIE-BU01]

USB_Sensor

Advertising mode of USB type Environment Sensor (2JCIE-BU01) must be set to 0x01 or 0x02.

In this mode of operation, sensor data is included in the advertisement packet to be transmitted.

Currently, this sample script only support 0x01 (Sensor data) and 0x02 (Calculation data).

Please refer to User's Manual for more details.

Configuration

Open conf.py and edit your configuration.

CSV is saved under ./log/ directory in the script path by default.

You can specify a different log location in your configuration.

Run

  • Normal mode

Only sensor status information is sent to stdout in a set interval.

$ sudo ./envsensor_observer.py

You need to make envsensor_observer.py executable.

You can use Supervisor to start the script running in the background when system boot.

  • Debug mode

Full Bluetooth messages are sent to stdout in addition to the sensor status.

$ sudo ./envsensor_observer.py --debug

or

$ sudo ./envsensor_observer.py -d

Visualization

With Grafana, you can easily visualize any of data stored in InfluxDB through this script.

Dashboard

Note :

It should be noted that this example code is for demonstration purposes only, it is not intended for use in a production environment, is not guaranteed fit for any purpose.

Licence :

Copyright (c) OMRON Corporation. All rights reserved.

Licensed under the MIT License.

Reference :

envsensor-observer-py's People

Contributors

omron-me avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

envsensor-observer-py's Issues

ble.py line 395

Are you guys active on here? I'm throwing an error on this line:
ncmd, opcode = struct.unpack("<BH", pkt[:3])
With this error:
error: unpack requires a string argument of length 3

Do you know what could be causing this?

Configuration of the sensor as a beacon broadcaster (IM/EP)

Hi everyone,

I want to check the env sensor with raspberry pi 3 like you did. But I'm stuck at how to configure the env sensor as a beacon broadcaster (IM/EP? You noticed this on readme as;

Environment Sensor (2JCIE-BL01) must be configured as a beacon broadcaster (IM/EP).

Is there any configuration tool or something to achieve this?

Thanks,
Emir

0c4c3001

Hey guys,
So I'm rewriting this for nodejs and instead of getting the advertising events, I'm literally just reading the last values bytes.
Below is the print out of what my code is giving.

Found UUID. #This is the 0c4c3000 UUID
Found child UUID. #This is the 0c4c3001 UUID
30fb0776103a0002000126a90d86197206650b #This is the entire byte string that I am getting back from all 19 bytes)
Skipping byte. #This is the first byte, which as far as I could tell from your communications manual isn't used for anything on the reading side, right?
Hex: fb7 #This is byte 1 and 2 (for temp) converted to signed (removed the 0)
Int: 4023 #This is the value converted from Hex to Decimal. This converted to Fahrenheit is 104.4 degrees in an air conditioned lab.
Hex: 7610 #For humidity
Int: 30224 #I'm guessing that whatever the number is, only use the first 4? 30.22% humidity does sound right.
Hex: 3a0
Int: 928 #This is for lx. In the communication manual it says it's .01 in its readings. In a number like this, it seems more likely that it is 92.8 lx, is this a situation where code shouldn't have removed one of the two zeroes?
Hex: 20
Int: 32 # It's indoors, .32 UV sounds fine.
Hex: 126
Int: 294 # It should be around 8000 hPa to be around 25 in mercury.
Hex: a9d
Int: 2717 # 27.17 dB is probably right
Hex: 8619
Int: 34329 # Again omit the 5 character? 34.32 discomfort index?
Hex: 726
Int: 1830 # 18.3 * C in heatstroke.
Hex: 650b # Kept the leading edge 0 as it's unsigned
Int: 25867 # 2.586 Volts sounds right.

So, I get some strange readings with some seemingly accurate readings, but the one that bothers me the most is the temperature. Am I doing the conversions correctly? Take the bytes and convert directly to decimal using 16 bit?

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.