Data Gator
Hardware and software documentation for the Data Gator project.
Loading...
Searching...
No Matches
VWCSensor Class Reference

Interface for converting a voltage measurement from an analog sensor into a double, as a Volume of water per volume of soil percentage. More...

#include <VWCSensor.hpp>

Inheritance diagram for VWCSensor:

Public Types

enum  SoilMedia { MINERAL_SOIL , SOILLESS }
 Defines types of soil for which the volumetric water content calculation needs to be adjusted. More...
 

Public Member Functions

virtual double getVWC (SoilMedia media, double voltage)
 Convert raw data to volume water/volume soil percentage.
 
virtual std::string getSensorType ()
 Return brand+sensor model string for topic.
 
virtual std::string toJSON (double voltage)
 Convert data to JSON key value pairs.
 

Detailed Description

Interface for converting a voltage measurement from an analog sensor into a double, as a Volume of water per volume of soil percentage.

Member Enumeration Documentation

◆ SoilMedia

Defines types of soil for which the volumetric water content calculation needs to be adjusted.

These types are defined according to the needs of the Meter Teros10, though in principle this can be extended to other sensors or disregarded by sub-classes. Pass to VWCSensor::getVWC(...) to apply to conversion from analog voltage to digital VWC value.

Enumerator
MINERAL_SOIL 

Mineral-based soil. Dirt!

SOILLESS 

Fake soil, potting soil for example.

Member Function Documentation

◆ getSensorType()

virtual std::string VWCSensor::getSensorType ( )
virtual

Return brand+sensor model string for topic.

Returns
The sensor type as a string identifier, not unique since most VWC sensors are wired with no unique identifier.

Reimplemented in Teros10.

◆ getVWC()

virtual double VWCSensor::getVWC ( SoilMedia  media,
double  voltage 
)
virtual

Convert raw data to volume water/volume soil percentage.

Parameters
[in]mediaThe type of soil the sensor is going to be used in. This is assumed to be natural dirt by default, but some sensors allow this value to be changed to provide better accuracy.
[in]voltageThe raw reading from the sensor.
Returns
Soil volumetric water content as a double. Values outside of range [0.0, 1.0] indicate sensor error.

Reimplemented in Teros10.

◆ toJSON()

virtual std::string VWCSensor::toJSON ( double  voltage)
virtual

Convert data to JSON key value pairs.

Parameters
[in]voltageThe analog voltage read from the sensor.
Returns
a JSON object string with both the raw reading (voltage) and the converted value as a float with valid values on range [0, 1].

Reimplemented in Teros10.


The documentation for this class was generated from the following file: