Coder Social home page Coder Social logo

pycozir's Introduction

PyCOZIR

PyCOZIR is a Python interface to COZIR™ CO2 sensors.

This module wraps the communication on a serial port with a COZIR CO2 sensor. It gives a higher level API than the serial communication protocol.

Implemented functionalities:

  • data reading (CO2, temperature and humidity)
  • sensor configuration (digital filter, calibration, ...)

This code is freely available under a 3-Clause BSD license (see LICENSE file).

Usage

Create a connection to a sensor connected to serial port '/dev/ttyUSB0':

>>> from cozir import Cozir
>>> c = Cozir('/dev/ttyUSB0')
connected to "/dev/ttyUSB0"
set operating mode to "polling"

Read data from sensors:

>>> print('CO2: {} ppm'.format(c.read_CO2()))
CO2: 1189.0 ppm
>>> print('Temp: {} °C'.format(c.read_temperature()))
Temp: 27.3 °C
>>> print('Humid: {} %'.format(c.read_humidity()))
Humid: 39.3 %

note: temperature and humidity sensors are an optional add-on in COZIR sensors.

Compatibility

This module was tested with Python 3.6, under Linux, but is meant to work under Windows as well.

Not currently tested with Python 2.7, but version before June 2017 was compatible.

Data logger

A simple data logging script is provided. It runs from the command line and save the data in CSV format in file:

$ python logger.py /dev/ttyUSB0
connected to "/dev/ttyUSB0"
set operating mode to "polling"
logging to "cozir_log_2015-09-14_12-01-10.csv"
logging interval: 30 s
1077 ppm, 22.0 °C, 52.6 %
...

The filename of the logfile is created based on datetime at startup.

About the COZIR CO2 sensor

More information on the manufacturer website: http://www.gassensing.co.uk/product/cozir-ambient/

Note that this software, written by Pierre Haessig, is not affiliated with the GSS Ltd., the manufacturer of COZIR™ sensors. Also, COZIR is a trademark of GSS.

pycozir's People

Contributors

pierre-haessig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pycozir's Issues

running it with GC-0010 erro

when running like so:

python3 cozir_test.py
I get the following error:

connected to "/dev/ttyUSB0"
set operating mode to "polling"
Traceback (most recent call last):
  File "cozir_test.py", line 2, in <module>
    c = Cozir('/dev/ttyUSB0')
  File "/usr/local/lib/python3.5/dist-packages/PyCOZIR-0.1-py3.5.egg/cozir/cozir.py", line 48, in __init__
  File "/usr/local/lib/python3.5/dist-packages/PyCOZIR-0.1-py3.5.egg/cozir/cozir.py", line 113, in set_mode

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.