Skip to main content

Communication tools for Campbell CR1000-type Dataloggers

Project description

PyCampbellCR1000 is a python project which aims to allow the communication with Campbell CR1000 Type Datalogger

The main features include automatic collecting of data and settings (read only) as a list of dictionnaries.

The tool can be used in your python scripts for data post-processing, or in command line mode to collect data as CSV.

We don’t update anything from PyCampbellCR1000 besides time, because we are assuming that the dataloggers are already configured.

Note: PyCampbellCR1000 uses the PyLink lib, offers a universal communication interface with File-Like API.

Examples

We init communication by giving the datalogger URL.

>>> from pycampbellcr1000 import CR1000
>>> device = CR1000.from_url('tcp:host-ip:port')
>>> # or with Serial connection
>>> device = CR1000.from_url('serial:/dev/ttyUSB0:38400')

To get time, use:

>>> device.gettime()
datetime.datetime(2012, 7, 16, 12, 27, 55)

To get data, you have to enter the table name where it is stored. If you don’t know the table name, you cannot collect the list of available tables in the datalogger.

>>> device.list_tables()
['Status', 'Table1', 'Public']

Choose the time period to get your data from start date to stop date.

>>> import datetime
>>> start = datetime.datetime(2012, 7, 16, 11, 0, 0)
>>> stop = datetime.datetime(2012, 7, 16, 12, 0, 0)
>>> data = device.get_data('Table1', start, stop)
>>> data[0]["Datetime"]
datetime.datetime(2012, 7, 16, 11, 0)
>>> data[0]["CurSensor1_mVolt_Avg"]
2508.0
>>> print(data.filter(('Datetime', 'CurSensor3_mAmp_Avg')).to_csv())
Datetime,CurSensor3_mAmp_Avg
2012-07-16 11:00:00,18.7
2012-07-16 11:01:00,18.48
...
2012-07-16 11:59:00,17.25

Features

  • Collecting data as a list of dictionaries

  • Collecting data in a CSV file

  • Reading and adjusting the data logger’s internal clock

  • Retrieving table definitions

  • Listing table names

  • Reading settings

  • Collect file list and download file content

  • Tested with CR1000 and CR800 dataloggers (should work with CR3000 datalogger)

  • Various types of connections are supported (TCP, UDP, Serial, GSM)

  • Comes with a command-line script

  • Compatible with Python 2.6+ and 3.x

Installation

You can install, upgrade, uninstall PyCampbellCR1000 with these commands

$ pip install pycampbellcr1000
$ pip install --upgrade pycampbellcr1000
$ pip uninstall pycampbellcr1000

Or if you don’t have pip

$ easy_install pycampbellcr1000

Or you can get the source code from github.

$ git clone https://github.com/LionelDarras/PyCampbellCR1000.git
$ cd PyCampbellCR1000
$ python setup.py install

Documentation

See documentation here: http://pycampbellcr1000.readthedocs.org

Changelog

Version 0.4

Released on 2017-11-28

  • Distinction between pakbus address and node in the pakbus protocol.

  • Minor bug correction to can visualize help on python 3.x.

  • Allow seconds in settime.

Version 0.3

Released on 2014-03-26.

  • Bug correction about communication with NL115, NL120 and NL200 modules using “CSI/O” serial port.

  • Support python 3.3 and 3.4

Version 0.2

Released on 2012-07-26.

  • Fixed a bug related to update command (on Windows)

  • Used UTC datetime

  • Decoded pakbus packet properly

  • Other minor bugs fixed

Version 0.1

Released on 2012-07-18.

First properly tagged release.

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

PyCampbellCR1000-0.4.tar.gz (358.4 kB view details)

Uploaded Source

File details

Details for the file PyCampbellCR1000-0.4.tar.gz.

File metadata

File hashes

Hashes for PyCampbellCR1000-0.4.tar.gz
Algorithm Hash digest
SHA256 466037583209f459dec4db87f20e20dfa97b5f6bcf8f528341fbd99272247a91
MD5 2207ed948b5622fa46a47a800b125130
BLAKE2b-256 04c45ba0a034690db62461dfd8ec55ba5737c0859b8a1c478483818bac1941c7

See more details on using hashes here.

Supported by

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