There is a newer version of the record available.

Published March 6, 2019 | Version v0.21.0
Software Open

EnviroDIY/ModularSensors: v0.21.0: Support for all Atlas Scientific I2C sensors, compiler-safe begin functions

  • 1. Stroud Water Research Center
  • 2. LimnoTech

Description

The EnviroDIY ModularSensors library gives environmental sensors a common interface of functions for use with Arduino-framework data loggers, such as the EnviroDIY Mayfly Logger. The ModularSensors library is specifically designed to support wireless, solar-powered environmental data logging applications that:

  • Retrieve data from many physical sensors;

  • Save that data to a SD memory card;

  • Transmit that data wirelessly to a web server; and

  • Put the processor, sensors and all other peripherals to sleep between readings to conserve power.

The ModularSensors library coordinates these tasks by "wrapping" native sensor libraries into a common interface of functions and returns. These wrapper functions serve to harmonize and simplify the process of iterating through and logging data from a diverse set of sensors and variables. Using the common sensor and variable interface, the library attempts to optimize measurement timing as much as possible to reduce logger "on-time" and power consumption. Although this library was written primarily for the EnviroDIY Mayfly data logger board, it is also designed to be compatible with a variety of other Arduino-based boards as well.

New for v0.21.0: Support for all Atlas Scientific I2C sensors, compiler safe begin functions:

New Features

  • Added full support for all Atlas Scientific EZO curcuits and sensors that support I2C
    • CO2
    • DO (dissolved oxygen)
    • EC (conductivity)
    • ORP (oxidation/reduction potential)
    • pH
    • RTD (temperature
  • Created empty constructors for the logger, publisher, variable array, and variable classes and all of their subclasses. For all classes created a corresponding "begin" function to set internal class object values.
    • See note for more details: https://github.com/EnviroDIY/ModularSensors/commit/b1a619ed74bc790743bce35b3a4e78a2d2237b22
    • The order of input arguments for all variable objects has changed. For variable subclasses (ie, variables from sensors), there is no change to the user. For calculated variable objects, all code must be updated! Please check the structure in the examples! Older code will compile without error but the variable metadata fields will be incorrectly populated.
  • Very preliminary support for SD cards with switchable power

Improvements:

  • Eliminated any time-out waits on libraries using the Wire class
  • Simplified the logger begin function - the removed functionality should be called in individual program setup functions
    • Removed clock sync
    • Removed logger file creation
    • Removed sensor setup
  • Moved the check for setup from the wake function to the startSingleMeasurement function for all sensors
    • Previously, the first time the wake was called for a function, the status bit for setup was checked and if the sensor had not been setup, the setup function was called. This will no longer happen the first time the wake function is called, but instead the first time the startSingleMeasurement function is called. The main motivator for the change was the modem which could end up behaving strangely because the setup function actually called the wake function internally.
  • Improved example coding for SARA R410 cellular modules

Bug Fixes

  • Fixed call to a null pointer causing the array's completeUpdate to crash with calculated variables
  • Fixed source of ADS1x15 dependency
  • Removed "default" wake/sleep functions from modem. These were non-working skeleton functions.

Known Issues

  • Running some I2C sensors on switched power will cause unrecoverable hangs at the first call to any other I2C peripheral (ie, the DS3231 RTC) after sensor power is turned off. This is a hardware problem and is un-fixable within this library.
  • The sensor class and all of its subclasses still require input arguments in the constructor.

Files

EnviroDIY/ModularSensors-v0.21.0.zip

Files (302.3 kB)

Name Size Download all
md5:ad4df2ddb9c9b964de8339f38e276a8e
302.3 kB Preview Download

Additional details

Funding

CZO: Spatial and temporal integration of carbon and mineral fluxes: a whole watershed approach to quantifying anthropogenic modification of critical zone carbon sequestration. 0724971
National Science Foundation
Christina River Basin CZO: a whole watershed approach to integrating feedbacks between water, mineral and carbon fluxes in human landscapes 1331856
National Science Foundation