Coder Social home page Coder Social logo

sensorreporter's Introduction


SensorReporter


SensorReporter is the quickest way to fetch and publish data from IoT sensors.


Installation & configuration

SensorReporter is an Arduino Library but was only tested with Particle ecosystem.

Note: if you tested it with any other platforms, please create a PR with instructions to let everyone know!

  1. Using the Web IDE, Desktop IDE or the CLI add the SensorReporter to your project.
  2. Create a sr-config.h file and configure all connected sensors and reporters
  3. In your main file, Include and instantiate SensorReporter:
    #include "sensor_reporter.h"
    SensorReporter sensorReporter;
  4. In setup() function initalize all sensors and reporters:
    void setup()
    {
        sensorReporter.begin();
    }
  5. In loop() function request a report:
    void loop()
    {
        sensorReporter.loop();
    }
  6. If you're using external library, add it to the library.properties file as well

Supported sensors & reporters

Note: if you want to implement additional sensors or reporters, please submit a PR!

Sensors

Reporters

sr-config.h file

This header file is used to configure the SensorReporter. To disable a sensor or reporter, comment out the relevant lines. Here's a reference file:

// ***** GENERAL SETTINGS *****
 
// All sample names will be prefixed with this string
#define SAMPLE_PREFIX "home_"
// How many miliseconds wait before next report
#define REPORTING_INTERVAL 10000

// ***** SENSORS *****

// First built-in ADC pin (in the future, you'll be able to pull more pins)
#define SENSOR_ANALOG_PIN_1 A0
// Name to report this pin as
#define SENSOR_ANALOG_PIN_1_NAME "soil"

// HTU21D temperature and humidity sensor
#define SENSOR_HTU21D

// PMS3003 air quality sensor
#define SENSOR_PMS3003

// Soil moisture sensor using ADC
#define SENSOR_MOISTURE_ANALOG_PIN A7
// Pin connected to sensor's VCC
#define SENSOR_MOISTURE_ENABLE_PIN D2

// ***** REPORTERS *****

// Serial port reporter
#define REPORTER_SERIAL_BAUDRATE 9600

// Particle event reporter
#define REPORTER_PARTICLE

Implementing new reporters or sensors

  1. Take a peek at src/sensors and src/reporters directories
  2. Create a class that inherits ISensor or IReporter and implements all virtual methods
  3. In sensor_reporter.cpp:
    • add declarations of your classes in the beginning
    • in the begin() function:
      • initialize your class
      • add it to collector with collector.addSensor() or collector.addReporter()

Once it's working, please create a PR so more people can use it :) All contributions (no matter if small or big) are always welcome!

Attributions

  • Thermometer, Wind & Drops icons by Luis Rodrigues from the Noun Project
  • Serial Port icon by Dalpat Prajapati from the Noun Project

sensorreporter's People

Contributors

suda avatar

Stargazers

 avatar  avatar

Watchers

 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.