Code Monkey home page Code Monkey logo

opcn2's Introduction

opcn2

C++ Library for the Alphasense OPC-N2 particle counter

Alphasense OPC-N2

About

The Alphasense OPC-N2 is an optical particle counter for use in indoor and outdoor particle monitoring. This library makes it easy to operate the OPC-N2 from a Particle Photon, Particle Electron, or Arduino (not yet tested).

Example Usage

Three examples are located in the examples folder.

  1. \run-the-opc: shows you the basics of how to use the library with a Particle photon/electron.
  2. \tests: runs through a solid portion of the methods and prints the results to the console.
  3. \wifi-opc: sets the OPC and sets the PM data as public variables.

Documentation

API documentation can be found in the docs folder.

Issues/Questions

If there is a bug or other issue with the code, please create an issue on this git repo. If you have general questions, please reach out to me via PM over github or email ([email protected]).

Recommended Components

In order to run the Alphasense OPC-N2 from a Particle Photon or Electron, you will need the Alphasense OPC-N2 and one of the microcontrollers from Particle. You will also need the appropriate 30 AWG wiring and either a breadboard, or alternate way to connect the OPC-N2 to the Particle controller.

Circuit Diagram

Connect according to the table below, and as seen in the figure below.

OPC-N2 Pin Number Particle Photon Pin
1 (GND) GND
2 (/CS) A2
3 (MOSI) A5
4 (MISO) A4
5 (CLK) A3
6 (VCC) VIN

Alphasense OPC-N2

opcn2's People

Contributors

dhhagan avatar monkbroc avatar

Stargazers

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

Watchers

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

opcn2's Issues

only constructors take member initializers

Veryfing code using this library in Particle Build fails with this error:

opcn2-library/opcn2-library.h:161:9: error: only constructors take member initializers
         bool write_config_variables(byte values[])

OPCN3

The update by the aphasense firm of its OPC-N2 sensor to N3 causes that the library can no longer be used in new projects have any update available for the new sensor ... the user marlon360 (https://github.com/marlon360/opcn3-arduino) recently published a library in this regard but lacks documentation for use or examples

Arduino compile

I'm trying to test the same code in a normal Arduino build using the IDE (mainly 1.05).
Specifically, I'm building for Uno or Blend Micro. Same thing happens in both cases.
I have the .cpp and .h files inside a folder within the libraries folder.
I have successfully built other sketches that use SPI but in those cases SPI is called from the .ino file rather than from within a library.

I made the change in the .h file

//#include "application.h"
#include "Arduino.h"

SPI not defined so added in .cpp file, the .h file and .ino file (renamed from .cpp file in /examples)

#include "SPI.h"

Still getting errors like:

no matching function for call to 'SPIClass::begin(uint8_t&)'

Evidently the IDE is converting to this from "SPI.begin(_CS);" and then failing to find "SPIClass"

A little too much magic buried in IDE? I'm trying to find out why this is happening but posting here in case I'm missing something that would be needed in a case like this. Online I see various instances of this error with other libraries but no useful solutions.

Any help appreciated ;-)

Minor issue with old versions of OPC firmware

I noticed that the version is not reported when the device sends back this string

OPC-N2 FirmwareVer=OPC-017b...............................BD

You mention this in the code but not in the READ.ME; I patched it to address this. I'll do it properly when the project is further along.

BTW. Thx for doing this. Your code is a lot more readable than the device documentation ;-)

'status' was not declared in this scope

Veryfing code using this library in Particle Build fails with this error:

opcn2/opcn2.cpp:140:3: error: 'status' was not declared in this scope
   status data

expected '

Veryfing code using this library in Particle Build fails with this error:

opcn2-library/opcn2-library.h:173:5: error: expected '

version for use with Nordic nRF52xxx

We are now looking to build the same OPC (or later version) into a device that has a lot more I/O. This will be based on nRF52832. We are planning to port this library accordingly, basing the build on the open toolchain for armgcc as used in the Nordic SDK. I'm leaving this issue just in case anyone has a similar requirement.

Laser doesn't shut off when .off() command is issue

By looking at power draw when the device is off versus disconnected, we can infer the laser is never actually turned off despite the Alphasense docs saying it should be. I will contact Alphasense to see if they can confirm.

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.