DFRobot EC Meter.
More...
The driver was tested with the DFRobot EC Analog Sensor.
This device measure the electrical conductivity of an aqueous solution. The included probe is a K=1 model.
Calibration is somewhat complicated - see the DFRobot wiki for instructions on calibration. Functions are provided to supply the appropriate values. By default, the values used in the DFRobot arduino example are used.
wiki: https://www.dfrobot.com/wiki/index.php/Analog_EC_Meter_SKU:DFR0300
while (shouldRun) {
sensor.update();
cout << "EC = " << sensor.getEC() << " ms/cm" << endl;
cout <<
"Volts = " << sensor.getVolts() <<
", Temperature = " << sensor.
getTemperature()
<< " C" << endl;
cout << endl;
upm_delay(2);
}
DFREC |
( |
unsigned int |
apin, |
|
|
unsigned int |
uart_ow, |
|
|
unsigned int |
device_idx, |
|
|
float |
a_ref |
|
) |
| |
DFREC object constructor
- Parameters
-
apin | Analog pin to use. |
uart_ow | The UART that the ds10b20 temperature sensor is connected to. |
device_idx | The device index of the ds18b20 sensor to use. If you only have 1 ds18b20 sensor on your DS one wire bus, you would pass 0 here. |
a_ref | The analog reference voltage in use |
- Returns
- dfrec context
Read the sensor status and update internal state. dfrec_update() must have been called before calling any of the other get*() functions.
void setOffset |
( |
float |
offset | ) |
|
Set sensor offset. This offset is applied to the return EC value before scaling. Default is 0.0.
- Parameters
-
offset | The offset to apply. |
void setScale |
( |
float |
scale | ) |
|
Set sensor scale. The return EC value is scaled by this value before the offset is applied. Default is 1.0.
- Parameters
-
Get computed EC (ms/cm) value from the sensor. update() must have been called prior to calling this function.
- Returns
- EC value in ms/cm.
Get the measured volts from the sensor. update() must have been called prior to calling this function.
- Returns
- The voltage measurement.
Get the normalized ADC value from the sensor. update() must have been called prior to calling this function.
- Returns
- The normalized ADC value.
float getTemperature |
( |
void |
| ) |
|
Get the measured temperature from the temperature sensor. The return value will be in Celsius.
- Returns
- temperature read from the sensor in Celsius.
void setThresholdMinMax |
( |
float |
min, |
|
|
float |
max |
|
) |
| |
Set the global threshold min and max values. See the DFRobot wiki for details.
- Parameters
-
min | Minimum threshold to be valid. Default 150. |
max | Maximum threshold to be valid. Default 3300. |
void setThreshold1 |
( |
float |
thres, |
|
|
float |
scale, |
|
|
float |
offset |
|
) |
| |
Set the threshold 1 values. See the DFRobot wiki for details.
- Parameters
-
thres | Threshold maximum for value section 1. Default 448. |
scale | Scale for value section 1. Default 6.64. |
offset | Offset for value section 1. Default -64.32. |
void setThreshold2 |
( |
float |
thres, |
|
|
float |
scale, |
|
|
float |
offset |
|
) |
| |
Set the threshold 2 values. See the DFRobot wiki for details.
- Parameters
-
thres | Threshold maximum for value section 2. Default 1457. |
scale | Scale for value section 2. Default 6.98. |
offset | Offset for value section 2. Default -127.0. |
void setThreshold3 |
( |
float |
scale, |
|
|
float |
offset |
|
) |
| |
Set the threshold 3 values. See the DFRobot wiki for details.
- Parameters
-
scale | Scale for value section 3. Default 5.3. |
offset | Offset for value section 3. Default 2278. |
The documentation for this class was generated from the following files: