UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

DFREC Class

Module: dfrec

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

Methods

DFREC

(
  • apin
  • uart_ow
  • device_idx
  • a_ref
)
Number

DFREC object constructor

Parameters:

  • apin Number

    Analog pin to use.

  • uart_ow Number

    The UART that the ds10b20 temperature sensor is connected to.

  • device_idx Number

    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 Number

    The analog reference voltage in use

Returns:

Number:

dfrec context

update

()

Read the sensor status and update internal state. dfrec_update() must have been called before calling any of the other get*() functions.

setOffset

(
  • offset
)

Set sensor offset. This offset is applied to the return EC value before scaling. Default is 0.0.

Parameters:

  • offset Number

    The offset to apply.

setScale

(
  • scale
)

Set sensor scale. The return EC value is scaled by this value before the offset is applied. Default is 1.0.

Parameters:

  • scale Number

    The scale to apply.

getEC

() Number

Get computed EC (ms/cm) value from the sensor. update() must have been called prior to calling this function.

Returns:

Number:

EC value in ms/cm.

getVolts

() Number

Get the measured volts from the sensor. update() must have been called prior to calling this function.

Returns:

Number:

The voltage measurement.

getNormalized

() Number

Get the normalized ADC value from the sensor. update() must have been called prior to calling this function.

Returns:

Number:

The normalized ADC value.

getTemperature

() Number

Get the measured temperature from the temperature sensor. The return value will be in Celsius.

Returns:

Number:

temperature read from the sensor in Celsius.

setThresholdMinMax

(
  • min
  • max
)

Set the global threshold min and max values. See the DFRobot wiki for details.

Parameters:

  • min Number

    Minimum threshold to be valid. Default 150.

  • max Number

    Maximum threshold to be valid. Default 3300.

setThreshold1

(
  • thres
  • scale
  • offset
)

Set the threshold 1 values. See the DFRobot wiki for details.

Parameters:

  • thres Number

    Threshold maximum for value section 1. Default 448.

  • scale Number

    Scale for value section 1. Default 6.64.

  • offset Number

    Offset for value section 1. Default -64.32.

setThreshold2

(
  • thres
  • scale
  • offset
)

Set the threshold 2 values. See the DFRobot wiki for details.

Parameters:

  • thres Number

    Threshold maximum for value section 2. Default 1457.

  • scale Number

    Scale for value section 2. Default 6.98.

  • offset Number

    Offset for value section 2. Default -127.0.

setThreshold3

(
  • scale
  • offset
)

Set the threshold 3 values. See the DFRobot wiki for details.

Parameters:

  • scale Number

    Scale for value section 3. Default 5.3.

  • offset Number

    Offset for value section 3. Default 2278.