Giter VIP home page Giter VIP logo

swmeas's Introduction

Python tools for controlling water monitoring sensors

Example: CO2 Sensor

Works with SensAir K30 CO2 Sensor.

from swmeas import CO2_Sensor

co2 = CO2_Sensor(SN='your_serial_no')

# all reads are [timestamp, value] pairs

# read single CO2 measurement
co2.read()

# read 5 CO2 measurements, 3 seconds apart
co2.read_multi(n=5, wait=3.)

# write the last read value to individual [timestamp, value] rows of a file file
co2.write('data.csv')

# write all the previously read values to a single line in a file [timestamp, value_0, ..., value_n]
co2.write_batch('batch_data.csv')

Example: O2 & Temperature Sensor

Works with a Pyro Piccolo2 O2 / Temperature meter

from swmeas import O2_Sensor

o2 = O2_Sensor(SN='your_serial_no')

# all reads are [timestamp, data_0, ..., data_13] lists

# read a single measurement
o2.read()

# read 5 measurements, 1.3 seconds apart
o2.read_multi(n=5, wait=1.3)

# write the last read values to csv file
o2.write('pyro_data.csv')

# write only the Temp and O2 measurements to batch files (i.e. each row is [timestamp, var_0, ..., var_n])
o2.write_TempO2_batch('temp.csv', 'o2.csv')

Determining Device Serial Number

Works on Mac/Linux.

  1. Start with the sensor unplugged, open a terminal window and run:
cd /dev
ls -l | grep usb

This should return nothing.

  1. Plug in the sensor, and run:
ls -l | grep usb 

This should return 2 entries, the end of which is the serial number of the sensor. It doesn't actually have to be the serial number - just a unique string which identifies the sensor in the list of tty entries in /dev.

It's possible that this won't work. If you don't see anything the second time, try removing | grep usb. You'll be presented with a long list of files, and you'll need to identify the one that appears / disappears when you connect / disconnect the sensor.

swmeas's People

Contributors

oscarbranson avatar

Watchers

James Cloos avatar  avatar  avatar

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.