pyupm_dfrec module

class pyupm_dfrec.DFREC(apin, uart_ow, device_idx, a_ref)[source]

Bases: object

DFRobot EC Meter.

ID: dfrec

Name: Analog Electrical Conductivity (EC) Sensor

Category: liquid

Manufacturer: dfrobot

Connection: analog uart

Link:https://www.dfrobot.com/index.php?route=product/product&product_id=1123&search=DFR0300&description=true #.Vx49p-_n-M8 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

C++ includes: dfrec.hpp

getEC()[source]

float getEC()

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

EC value in ms/cm.

getNormalized()[source]

float getNormalized()

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

The normalized ADC value.

getTemperature()[source]

float getTemperature()

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

temperature read from the sensor in Celsius.

getVolts()[source]

float getVolts()

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

The voltage measurement.

setOffset(offset)[source]

void setOffset(float offset)

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

offset: The offset to apply.

setScale(scale)[source]

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.

scale: The scale to apply.

setThreshold1(thres, scale, offset)[source]

void setThreshold1(float thres, float scale, float offset)

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

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.

setThreshold2(thres, scale, offset)[source]

void setThreshold2(float thres, float scale, float offset)

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

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.

setThreshold3(scale, offset)[source]

void setThreshold3(float scale, float offset)

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

scale: Scale for value section 3. Default 5.3.

offset: Offset for value section 3. Default 2278.

setThresholdMinMax(min, max)[source]

void setThresholdMinMax(float min, float max)

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

min: Minimum threshold to be valid. Default 150.

max: Maximum threshold to be valid. Default 3300.

update()[source]

void update()

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