py-opc

py-opc: operate the Alphasense OPC-N2 from a raspberry pi or other popular microcontrollers/microcomputers - Published in JOSS (2018)

https://github.com/dhhagan/py-opc

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
    1 of 8 committers (12.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords from Contributors

pde
Last synced: 6 months ago · JSON representation

Repository

Python wrapper for the Alphasense OPC-N2 built around py-spidev

Basic Info
  • Host: GitHub
  • Owner: dhhagan
  • License: mit
  • Language: Python
  • Default Branch: master
  • Size: 511 KB
Statistics
  • Stars: 30
  • Watchers: 12
  • Forks: 26
  • Open Issues: 12
  • Releases: 11
Created about 11 years ago · Last pushed over 6 years ago
Metadata Files
Readme Contributing License

README.md

status Build Status PyPI version Coverage Status DOI

py-opc

Python library for operating the Alphasense OPC-N2 Optical Particle Counter using a Raspberry Pi (or other linux device). Full documentation can be found here.

Dependencies

One of the following, depending on whether you use GPIO pins or a SPI-USB adapter:

  1. py-spidev - for those using GPIO pins
  2. pyusbiss - for those using a SPI-USB adapter (python3+ only)

Additional Dependencies for Local Development

If you wish to build the local documentation or run unittests, there are a few additional dependencies that are required including:

  • sphinx
  • sphinxrtdtheme
  • mock

The complete list can be found in requirements-dev.txt.

Installation

For use on the Raspberry Pi (or any other linux device?), install via pip:

$ pip install py-opc [--upgrade]

If you are using the SPI-USB adapter only, you will also need to install pyusbiss. This can be done as follows:

$ pip install pyusbiss

Depending on your python setup, you may need to use pip3 instead of pip to install for python3+:

$ pip3 install pyusbiss

If you are using the GPIO pins to communicate with the OPC-N2, you must download the requirement py-spidev as follows:

$ pip install git+https://github.com/doceme/py-spidev.git

License

This library is licensed under the MIT license. The full text of the license can be found in this repository at LICENSE.txt.

Documentation

Full documentation can be found here.

You can also build the documentation by navigating to the docs directory and issuing the command:

$ make html

Sample Script / Getting Started

To quickly get up and running, follow one of the two examples:

GPIO-connected OPC-N2

Use if you are using the GPIO pins in conjunction with py-spidev

import spidev
import opc
from time import sleep

spi = spidev.SpiDev()
spi.open(0, 0)
spi.mode = 1
spi.max_speed_hz = 500000

alphasense = opc.OPCN2(spi)

# Turn the opc ON
alphasense.on()

sleep(1)

# Read the information string
print (alphasense.read_info_string())

# Read the histogram
print (alphasense.histogram())

# Turn the opc OFF
alphasense.off()

SPI-USB Adapter with OPC-N2

Use this approach if you have connected your RPi to the OPC-N2 via a SPI-USB adapter.

NOTE: Currently, this method is only supported on python3+ due to limitations in the pyusbiss library.

from usbiss.spi import SPI
import opc
from time import sleep

# Build the connector
spi = SPI("/dev/ttyACM0")

# Set the SPI mode and clock speed
spi.mode = 1
spi.max_speed_hz = 500000

alpha = opc.OPCN2(spi)

# Turn on the device
alpha.on()

sleep(1)

# read the information string
print (repr(alpha.read_info_string()))

# Read the histogram
alpha.histogram()

# Turn the device off
alpha.off()

Owner

  • Name: David H Hagan
  • Login: dhhagan
  • Kind: user
  • Location: Cambridge, MA
  • Company: Massachusetts Institute of Technology

Building @quant-aq.

JOSS Publication

py-opc: operate the Alphasense OPC-N2 from a raspberry pi or other popular microcontrollers/microcomputers
Published
June 29, 2018
Volume 3, Issue 26, Page 782
Authors
David H. Hagan ORCID
Massachusetts Institute of Technology
Andrew Tolmie
University of Leeds, National Physical Laboratory
Jakub Trochim
Sensonar
Editor
Kevin M. Moerman ORCID
Tags
python c++ aerosols atmospheric chemistry raspberry pi particle photon arduino

GitHub Events

Total
Last Year

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 168
  • Total Committers: 8
  • Avg Commits per committer: 21.0
  • Development Distribution Score (DDS): 0.06
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
David Hagan d****n@m****u 158
DancingQuanta a****r@g****m 4
rach8cww 3****w 1
The Gitter Badger b****r@g****m 1
Jakub Trochim t****b@g****m 1
Florentin Bulot 3****S 1
Arfon Smith a****n 1
Will w****l@w****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 59
  • Total pull requests: 28
  • Average time to close issues: 3 months
  • Average time to close pull requests: 2 days
  • Total issue authors: 27
  • Total pull request authors: 8
  • Average comments per issue: 6.56
  • Average comments per pull request: 1.32
  • Merged pull requests: 24
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • dhhagan (23)
  • tshu (3)
  • metallicano (3)
  • DancingQuanta (3)
  • H60gh (3)
  • beleme (2)
  • rouvoy (2)
  • tomasfichetti (1)
  • jared711 (1)
  • Ny4nmaru (1)
  • DonnaVakalis (1)
  • agent2003 (1)
  • lionfish0 (1)
  • jeffisfast (1)
  • Myszka (1)
Pull Request Authors
  • dhhagan (19)
  • FlorentinBulotAQ (2)
  • DancingQuanta (2)
  • gitter-badger (1)
  • arfon (1)
  • tavurth (1)
  • rach8cww (1)
  • jtrochim (1)
Top Labels
Issue Labels
enhancement (11) bug (10) question (4) v2 (3)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 21 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 3
  • Total versions: 9
  • Total maintainers: 1
pypi.org: py-opc

Python libary for operating the Alphasense OPC-N2 optical particle counter

  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 3
  • Downloads: 21 Last month
Rankings
Forks count: 7.6%
Dependent repos count: 9.0%
Dependent packages count: 10.0%
Stargazers count: 11.9%
Average: 14.4%
Downloads: 33.4%
Maintainers (1)
Last synced: 6 months ago

Dependencies

requirements-dev.txt pypi
  • mock * development
  • sphinx * development
  • sphinx_rtd_theme * development